/* ========================================
   VARIABLES & ROOT STYLES
======================================== */
:root {
    /* Dark Mode Colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #1e1e2a;
    --bg-hover: #25253a;

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
    --accent-glow: rgba(99, 102, 241, 0.3);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Birthday Theme */
    --gold: #fbbf24;
    --gold-glow: rgba(251, 191, 36, 0.3);

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-radius: 16px;
    --border-radius-sm: 8px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Fonts */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ========================================
   RESET & BASE STYLES
======================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.hidden {
    display: none !important;
}

/* ========================================
   LOGIN PAGE
======================================== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-container {
    position: relative;
    z-index: 10;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 48px;
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(20px);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.birthday-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 2s infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.login-header .subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-group {
    position: relative;
}

.input-group input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    transition: var(--transition-fast);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    opacity: 0.6;
    transition: var(--transition-fast);
}

.toggle-password:hover {
    opacity: 1;
}

.login-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--border-radius-sm);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn .arrow {
    transition: var(--transition-fast);
}

.login-btn:hover .arrow {
    transform: translateX(5px);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    text-align: center;
    animation: shake 0.5s ease;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* Particles Background */
.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-primary);
    border-radius: 50%;
    opacity: 0.4;
    animation: float 15s infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 0.4;
    }

    90% {
        opacity: 0.4;
    }

    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* ========================================
   VIDEO OVERLAY
======================================== */
.video-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-controls {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.video-btn {
    padding: 14px 28px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: white;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-normal);
    white-space: nowrap;
}

.video-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.sound-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.video-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent-gradient);
    transition: width 0.1s linear;
}

/* ========================================
   MAIN CONTENT & HEADER
======================================== */
.main-content {
    min-height: 100vh;
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-tabs {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 6px;
    border-radius: 50px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.nav-tab.active {
    background: var(--accent-gradient);
    color: white;
}

.nav-tab:not(.active):hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.tab-icon {
    font-size: 16px;
}

.logout-btn {
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

/* ========================================
   VIEW CONTROLS
======================================== */
.view-controls {
    display: flex;
    justify-content: center;
    padding: 16px 24px 0;
    max-width: 1400px;
    margin: 0 auto;
}

.view-toggle {
    display: flex;
    gap: 8px;
    background: var(--bg-tertiary);
    padding: 6px;
    border-radius: 50px;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.view-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.view-btn:not(.active):hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

@media (max-width: 480px) {
    .view-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ========================================
   GALLERY SECTION
======================================== */
.section {
    padding: 40px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

.timeline-container {
    position: relative;
}

/* Timeline Line */
.timeline-container::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary), transparent);
}

@media (min-width: 768px) {
    .timeline-container::before {
        left: 50%;
        transform: translateX(-50%);
    }
}

.year-section {
    position: relative;
    margin-bottom: 60px;
    padding-left: 60px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.year-section.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 768px) {
    .year-section {
        padding-left: 0;
    }

    .year-section:nth-child(even) .year-header {
        text-align: right;
        margin-right: calc(50% + 40px);
        margin-left: 0;
    }

    .year-section:nth-child(even) .photo-grid {
        margin-left: calc(50% + 40px);
    }

    .year-section:nth-child(odd) .year-header {
        margin-left: calc(50% + 40px);
    }

    .year-section:nth-child(odd) .photo-grid {
        margin-right: calc(50% + 40px);
    }
}

.year-marker {
    position: absolute;
    left: 10px;
    top: 0;
    width: 22px;
    height: 22px;
    background: var(--accent-gradient);
    border: 3px solid var(--bg-primary);
    border-radius: 50%;
    box-shadow: var(--shadow-glow);
}

@media (min-width: 768px) {
    .year-marker {
        left: 50%;
        transform: translateX(-50%);
    }
}

.year-header {
    margin-bottom: 24px;
}

.year-title {
    font-size: 48px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.photo-count {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

@media (max-width: 480px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

.photo-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-normal);
}

.photo-card:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-normal);
}

.photo-card:hover img {
    transform: scale(1.1);
}

.photo-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.5), transparent);
    opacity: 0;
    transition: var(--transition-fast);
}

.photo-card:hover::after {
    opacity: 1;
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-secondary);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   MAP SECTION
======================================== */
.map-section {
    padding: 24px;
}

.photo-map {
    height: calc(100vh - 160px);
    min-height: 400px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.map-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.legend-icon {
    font-size: 20px;
}

/* Leaflet Custom Styles */
.leaflet-container {
    background: var(--bg-secondary) !important;
}

.leaflet-popup-content-wrapper {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-radius: var(--border-radius-sm) !important;
    box-shadow: var(--shadow-md) !important;
}

.leaflet-popup-content {
    margin: 8px !important;
}

.leaflet-popup-tip {
    background: var(--bg-card) !important;
}

.map-popup-image {
    width: 160px;
    height: 120px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.map-popup-image:hover {
    transform: scale(1.05);
}

.map-popup-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ========================================
   LIGHTBOX
======================================== */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 10;
}

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

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
}

.lightbox-info {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========================================
   RESPONSIVE & TOUCH-FRIENDLY
======================================== */

/* Touch-friendly: minimum 48px touch targets */
@media (pointer: coarse) {

    .nav-tab,
    .view-btn,
    .logout-btn,
    .video-btn,
    .lightbox-close,
    .lightbox-nav {
        min-height: 48px;
        min-width: 48px;
    }

    .photo-card {
        /* Slightly larger tap area */
        min-height: 120px;
    }

    /* Active states for touch feedback */
    .nav-tab:active,
    .view-btn:active,
    .login-btn:active,
    .video-btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }

    .photo-card:active {
        transform: scale(0.98);
    }
}

/* Mobile Layout */
@media (max-width: 768px) {
    .header {
        padding: 12px 16px;
        gap: 8px;
    }

    .logo-text {
        display: none;
    }

    .tab-text {
        display: none;
    }

    .nav-tab {
        padding: 12px 18px;
        font-size: 18px;
    }

    .nav-tabs {
        padding: 4px;
    }

    .year-title {
        font-size: 32px;
    }

    .section {
        padding: 20px 12px;
    }

    /* View controls full width on mobile */
    .view-controls {
        padding: 12px;
    }

    .view-toggle {
        width: 100%;
        justify-content: space-around;
    }

    .view-btn {
        flex: 1;
        justify-content: center;
        padding: 12px 8px;
        font-size: 12px;
    }

    /* Photo grid 2 columns on mobile */
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .photo-card {
        border-radius: 8px;
    }

    /* Lightbox mobile optimizations */
    .lightbox-nav {
        display: none;
    }

    .lightbox-close {
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }

    .lightbox-content img {
        max-height: 75vh;
        border-radius: 8px;
    }

    .lightbox-info {
        font-size: 13px;
        padding: 0 16px;
        text-align: center;
    }

    /* Map adjustments */
    .photo-map {
        height: calc(100vh - 200px);
        border-radius: 12px;
    }

    .map-legend {
        font-size: 13px;
        padding: 8px 0;
    }

    /* Timeline simplified on mobile */
    .timeline-container::before {
        left: 12px;
    }

    .year-section {
        padding-left: 40px;
        margin-bottom: 40px;
    }

    .year-marker {
        left: 4px;
        width: 18px;
        height: 18px;
    }

    .year-header {
        margin-bottom: 16px;
    }

    .photo-count {
        font-size: 13px;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .nav-tab {
        padding: 10px 12px;
        font-size: 16px;
    }

    .view-btn {
        padding: 10px 4px;
        font-size: 11px;
    }

    .year-title {
        font-size: 28px;
    }

    .photo-grid {
        gap: 6px;
    }
}

/* Swipe hint for lightbox on touch devices */
.swipe-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    color: var(--text-secondary);
    font-size: 13px;
    animation: fadeInOut 3s ease forwards;
    pointer-events: none;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        display: none;
    }
}

/* Landscape mode optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 8px 16px;
    }

    .section {
        padding: 12px;
    }

    .year-title {
        font-size: 28px;
    }

    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .lightbox-content img {
        max-height: 70vh;
    }
}

/* Safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
    .header {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .lightbox {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========================================
   EMPTY STATE
======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .empty-state {
        padding: 40px 16px;
    }

    .empty-state-icon {
        font-size: 48px;
    }

    .empty-state-title {
        font-size: 18px;
    }
}