/* Core Variables & Tokens */
:root {
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-card: rgba(31, 41, 55, 0.55);
    --border-color: rgba(75, 85, 99, 0.3);
    
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-primary: #06b6d4;      /* Cyan */
    --accent-primary-hover: #0891b2;
    --accent-secondary: #8b5cf6;    /* Violet */
    --accent-success: #10b981;      /* Emerald */
    --accent-danger: #ef4444;       /* Rose */

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', var(--font-sans);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-primary);
    background-image: radial-gradient(at 0% 0%, rgba(6, 182, 212, 0.07) 0, transparent 50%),
                      radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.07) 0, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    overflow-y: scroll;
}

/* Layout Containers */
.app-container {
    max-width: 760px;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem 1rem;
}

/* Header Styles */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 2.25rem;
    height: 2.25rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 8px;
    color: white;
}

.logo-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.logo-area h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.25);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(6, 182, 212, 0.35);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* Composer Panel */
.composer-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: slideDown var(--transition-normal);
}

.composer-card.hidden {
    display: none;
}

.composer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.composer-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.form-group {
    margin-bottom: 1rem;
}

textarea {
    width: 100%;
    background: rgba(17, 24, 39, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    resize: none;
    transition: var(--transition-fast);
    outline: none;
}

textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

/* Drag & Drop Zone */
.dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: rgba(17, 24, 39, 0.25);
    cursor: pointer;
    transition: var(--transition-fast);
    margin-bottom: 1.25rem;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent-primary);
    background: rgba(6, 182, 212, 0.04);
}

.dropzone-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    transition: var(--transition-fast);
}

.dropzone:hover .dropzone-icon {
    color: var(--accent-primary);
    transform: translateY(-2px);
}

.dropzone p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.dropzone p span {
    color: var(--accent-primary);
    font-weight: 600;
}

/* Image Upload Preview Container */
.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
}

.preview-container.hidden {
    display: none;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

.preview-remove:hover {
    background: var(--accent-danger);
}

.composer-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.composer-status {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Upload Progress Overlay */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.upload-overlay.hidden {
    display: none;
}

.upload-progress-card {
    background: #1f2937;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.upload-progress-card h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #374151;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(to right, var(--accent-primary), var(--accent-secondary));
    width: 0%;
    transition: width 0.1s ease;
}

.upload-progress-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.empty-state svg {
    width: 3rem;
    height: 3rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    max-width: 320px;
}

/* Timeline Cards */
.timeline-feed {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.timeline-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.timeline-card:hover {
    border-color: rgba(6, 182, 212, 0.2);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.author-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    background: #374151;
    border-radius: 50%;
    color: var(--text-secondary);
}

.header-meta {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.card-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.log-text {
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    margin-bottom: 1rem;
}

/* Image Grids */
.image-grid {
    display: grid;
    gap: 0.5rem;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 0.75rem;
    border: 1px solid var(--border-color);
}

.image-wrapper {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: #1f2937;
}

.log-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-normal);
}

.image-wrapper:hover .log-image {
    transform: scale(1.03);
}

/* Grid specific layouts */
.grid-1 {
    grid-template-columns: 1fr;
    max-height: 480px;
}

.grid-1 .image-wrapper {
    aspect-ratio: auto;
}

.grid-1 .log-image {
    object-fit: contain;
    max-height: 480px;
}

.grid-2 {
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 16/10;
}

.grid-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16/10;
}

.grid-3 .image-wrapper:first-child {
    grid-row: span 2;
}

.grid-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    aspect-ratio: 16/12;
}

.grid-5, .grid-6, .grid-7, .grid-8, .grid-9, .grid-10 {
    grid-template-columns: repeat(3, 1fr);
    aspect-ratio: 16/12;
}

/* Image Preview Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    animation: zoomIn 0.2s cubic-bezier(0.1, 0.8, 0.25, 1);
}

.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Mobile Media Queries */
@media (max-width: 640px) {
    .app-container {
        padding: 1rem 0.75rem;
    }
    .app-header {
        padding: 0.75rem 1rem;
        margin-bottom: 1.25rem;
    }
    .composer-card {
        padding: 1rem;
        margin-bottom: 1.25rem;
    }
    .logo-area h1 {
        font-size: 1.25rem;
    }
    .timeline-card {
        padding: 1rem;
    }
}
