:root {
    --bg-primary: #0a192f;
    --bg-secondary: #112240;
    --text-primary: #ccd6f6;
    --text-secondary: #8892b0;
    --accent: #64ffda;
    --border-color: #233554;
    --success: #00ff9d;
    --error: #ff5555;
    --warning: #f1fa8c;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.view-switcher {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--accent);
    border-radius: 4px;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.view-switcher:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.header h1 {
    color: var(--accent);
    font-size: 1.5rem;
    font-weight: 600;
}

.header-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

.camera-filter select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.camera-filter select:hover {
    border-color: var(--accent);
}

.camera-filter select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(100, 255, 218, 0.2);
}

/* Main container */
.main-container {
    display: flex;
    height: 100vh;
    padding-top: 60px;
}

/* Photo grid with performance optimizations */
.photo-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-right: 0;
    /* Performance optimizations for smooth scrolling */
    will-change: scroll-position;
    transform: translateZ(0); /* Force hardware acceleration */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: smooth;
}

/* Style the scrollbar to be less intrusive but still functional */
.photo-grid-container::-webkit-scrollbar {
    width: 8px;
}

.photo-grid-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.photo-grid-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.photo-grid-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    max-width: 1400px;
    margin: 0 auto;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-secondary);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s;
}

.photo-item:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.photo-item .placeholder {
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: center;
    padding: 20px;
}

.photo-item .loading-spinner {
    width: 30px;
    height: 30px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.photo-item .photo-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 12px 8px 8px;
    color: white;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

.photo-date {
    font-weight: 600;
    margin-bottom: 2px;
}

.photo-time {
    opacity: 0.8;
}

/* Timeline sidebar */
.timeline-sidebar {
    width: 200px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
}

.timeline-header {
    padding: 20px 15px 15px;
    border-bottom: 1px solid var(--border-color);
}

.timeline-header h3 {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 10px;
}

.timeline-stats {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.timeline-scroll-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.timeline-track {
    position: absolute;
    right: 12px;
    top: 20px;
    bottom: 20px;
    width: 10px;
    background: var(--border-color);
    border-radius: 5px;
    cursor: pointer;
}

.timeline-thumb {
    position: absolute;
    right: 10px;
    width: 14px;
    height: 30px;
    background: var(--accent);
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.timeline-thumb:hover {
    background: var(--success);
}

.timeline-labels {
    position: absolute;
    left: 15px;
    right: 35px;
    top: 20px;
    bottom: 20px;
    pointer-events: none;
}

.timeline-label {
    position: absolute;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    transform: translateY(-50%);
}

.timeline-label.current {
    color: var(--accent);
    font-weight: 600;
}

/* Timeline current time indicator */
.timeline-current-indicator {
    position: absolute;
    right: 35px;
    background: var(--accent);
    color: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    transform: translateY(-50%) translateX(100%);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    max-width: 120px;
}

.timeline-current-indicator::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 4px solid var(--accent);
}

.timeline-current-indicator.visible {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 25, 47, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-content {
    text-align: center;
}

.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* Photo modal */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.photo-modal.active {
    display: flex;
}

.photo-modal img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}

.photo-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.7);
    border: 2px solid var(--accent);
    border-radius: 50%;
    color: var(--accent);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.photo-modal-close:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Responsive design */
@media (max-width: 768px) {
    .timeline-sidebar {
        width: 150px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 6px;
    }
    
    .header h1 {
        font-size: 1.2rem;
    }
    
    .header-controls {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .timeline-sidebar {
        width: 120px;
    }
    
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 4px;
    }
    
    .photo-grid-container {
        padding: 15px 10px;
    }
    
    .header-left {
        gap: 10px;
    }
    
    .header h1 {
        font-size: 1rem;
    }
}
