@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

[x-cloak] { display: none !important; }

:root {
    --bg-base: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FEFEFE;
    --border-light: #E2E8F0;
    --border-subtle: #F1F5F9;
    --bg-hover: rgba(0, 0, 0, 0.04);

    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --text-tertiary: #94A3B8;
    --text-inverse: #FFFFFF;

    --accent-rose: #F43F5E;
    --accent-violet: #8B5CF6;
    --accent-blue: #3B82F6;
    --accent-emerald: #10B981;
    --accent-amber: #F59E0B;
    --accent-orange: #F97316;
    --accent-cyan: #06B6D4;
    --accent-sky: #0EA5E9;
    --accent-pink: #EC4899;

    --gradient-accent: linear-gradient(135deg, var(--accent-rose), var(--accent-violet));
    --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(244, 63, 94, 0.06), transparent 50%),
                   radial-gradient(ellipse at 80% 20%, rgba(167, 139, 250, 0.06), transparent 50%),
                   radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.04), transparent 50%),
                   radial-gradient(ellipse at 60% 40%, rgba(253, 186, 116, 0.03), transparent 40%);

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);
    --shadow-glow: 0 0 24px rgba(236, 72, 153, 0.18);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    --nav-height: 64px;
    --mobile-nav-height: 64px;
    --sidebar-width: 240px;

    /* ---- Glassmorphism Tokens ---- */

    /* Blur levels — named by semantic use */
    --blur-light:  blur(8px) saturate(150%);
    --blur-medium: blur(16px) saturate(160%);
    --blur-heavy:  blur(24px) saturate(180%);

    /* Glass surfaces — translucent backgrounds */
    --glass-white:        rgba(255, 255, 255, 0.72);
    --glass-white-strong: rgba(255, 255, 255, 0.85);
    --glass-white-light:  rgba(255, 255, 255, 0.55);
    --glass-dark:         rgba(0, 0, 0, 0.75);
    --glass-rose:         rgba(244, 63, 94, 0.08);

    /* Glass borders — edge definition on translucent surfaces */
    --glass-border:         rgba(255, 255, 255, 0.45);
    --glass-border-strong:  rgba(255, 255, 255, 0.60);
    --glass-border-dark:    rgba(255, 255, 255, 0.12);
    --glass-border-colored: rgba(244, 63, 94, 0.20);

    /* Rose subtle surface — from Flutter roseSubtle */
    --color-rose-subtle: #FFF1F2;

    /* Glass shadows — deeper than normal for floating surfaces */
    --shadow-glass:      0 8px 32px rgba(0, 0, 0, 0.10);
    --shadow-glass-rose: 0 8px 32px rgba(244, 63, 94, 0.12);

    /* Touch target minimum */
    --touch-min: 44px;
}

/* ---- x-cloak: hide Alpine elements before init ---- */
[x-cloak] { display: none !important; }

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body { overscroll-behavior-x: none; }

img { image-orientation: from-image; }

body {
    font-family: var(--font);
    background: var(--bg-base) var(--gradient-bg);
    color: var(--text-primary);
    min-height: 100dvh;
    line-height: 1.5;
}

/* ---- App Background Image ---- */
.app-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.app-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform-origin: center center;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ---- Typography ---- */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 1.125rem; font-weight: 600; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }

/* ---- Layout ---- */
.app-shell {
    display: flex;
    min-height: 100dvh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-white);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border-right: 1px solid var(--glass-border);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

.sidebar-brand h1 {
    font-size: 1.25rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-brand .subtitle {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 8px 12px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 44px;
}

.nav-item:hover {
    background: var(--border-subtle);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(244, 63, 94, 0.2);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    color: var(--accent-rose);
}

.nav-item .icon { font-size: 1.2rem; width: 24px; text-align: center; }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-weight: 700;
    font-size: 0.85rem;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px 32px;
    min-height: 100dvh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

/* ---- Cards ---- */
.card {
    background: var(--glass-white);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-glass);
    transition: all 0.25s ease;
}

@media (hover: hover) {
    .card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
    }
}

.stat-card {
    text-align: center;
    padding: 24px 20px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* ---- Grid ---- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-accent);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
    background: var(--glass-white-strong);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover { background: var(--border-subtle); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover { background: var(--border-subtle); color: var(--text-primary); }

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ---- Form Elements ---- */
.input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.80);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    color: var(--text-primary);
    min-height: 44px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
    outline: none;
    border-color: var(--accent-rose);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.1);
}

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

select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

textarea.input { min-height: 80px; resize: vertical; }

label { font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); display: block; margin-bottom: 6px; }

.form-group { margin-bottom: 16px; }

/* ---- Upload Zone ---- */
.upload-zone {
    border: 2px dashed rgba(244, 63, 94, 0.3);
    border-radius: var(--radius-xl);
    padding: 56px 24px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: var(--glass-white-light);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent-rose);
    background: rgba(255, 255, 255, 0.70);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    box-shadow: var(--shadow-glass-rose);
}

.upload-zone .upload-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.upload-zone .upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-zone .upload-hint {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-top: 4px;
}

/* ---- Item Grid ---- */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.item-card {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: var(--border-subtle);
    transition: all 0.25s ease;
}

.item-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

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

.item-card .item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.5) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: flex-end;
    padding: 10px;
}

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

.item-card .item-overlay .item-title {
    color: var(--text-inverse);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-card .item-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.item-card .badge {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    backdrop-filter: blur(8px);
}

.video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.6);
    color: var(--text-inverse, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    backdrop-filter: blur(4px);
    z-index: 2;
    pointer-events: none;
}

.video-duration-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    color: var(--text-inverse, #fff);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
}

.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px 12px;
    gap: 8px;
}

.doc-card .doc-icon { font-size: 2rem; flex-shrink: 0; }

.doc-card .doc-info { min-width: 0; width: 100%; }

.doc-card .doc-name {
    font-weight: 500;
    font-size: 0.8rem;
    word-break: break-word;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.doc-card .doc-meta {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    margin-top: 2px;
}

/* ---- Dashboard Tabs ---- */
.dash-tabs {
    display: flex;
    gap: 2px;
    background: rgba(241, 245, 249, 0.7);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dash-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.dash-tab:hover { color: var(--text-primary); }

.dash-tab.active {
    background: var(--glass-white-strong);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tab-count {
    font-size: 0.75rem;
    background: var(--border-subtle);
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.dash-tab.active .tab-count {
    background: var(--accent-rose);
    color: var(--text-inverse);
}

/* ---- Category Cards ---- */
.category-card {
    padding: 24px;
    text-align: center;
    cursor: pointer;
}

.category-card .cat-icon { font-size: 2.5rem; margin-bottom: 10px; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08)); }
.category-card .cat-name { font-weight: 600; font-size: 0.95rem; letter-spacing: 0.01em; }
.category-card .cat-count { font-size: 0.8rem; color: var(--text-tertiary); margin-top: 4px; }

.category-card-wrap { padding: 0; overflow: hidden; }
.category-card-link {
    display: block;
    padding: 24px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
}
.category-card-link:hover { background: var(--border-subtle); }

.subcategory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 12px 12px;
}
.subcategory-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(241, 245, 249, 0.8);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    border: 1px solid var(--glass-border);
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    transition: background 0.15s;
}
.subcategory-chip:hover { background: var(--border-light); color: var(--text-primary); }

.subcategory-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.subcategory-tab {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--glass-border);
    background: var(--glass-white);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
    min-height: 44px;
}
.subcategory-tab:hover { border-color: var(--accent-rose); color: var(--accent-rose); }
.subcategory-tab.active {
    background: var(--gradient-accent);
    color: white;
    border-color: transparent;
}

/* ---- Timeline ---- */
.timeline { position: relative; padding-left: 32px; }

.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gradient-accent);
    border-radius: 1px;
}

.timeline-group { margin-bottom: 32px; }

.timeline-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    padding: 8px 0;
    font-weight: 700;
    font-size: 1.1rem;
}

.timeline-header::before {
    content: '';
    position: absolute;
    left: -26px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    background: var(--gradient-accent);
    box-shadow: 0 0 0 4px var(--bg-base);
}

.timeline-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    scrollbar-width: none;
}

.timeline-strip::-webkit-scrollbar { display: none; }

.timeline-thumb {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.timeline-thumb:hover { transform: scale(1.05); }
.timeline-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Lightbox ---- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
}

.lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.lightbox-nav:hover { background: rgba(255,255,255,0.2); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

/* Legacy lightbox-meta — now inside .lightbox-panel */
.lightbox-meta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    display: none; /* hidden — panel replaces this */
}

.lightbox-meta .meta-title { font-size: 1.1rem; font-weight: 600; }
.lightbox-meta .meta-detail { font-size: 0.8rem; opacity: 0.7; margin-top: 4px; }

/* Lightbox bottom toolbar — replaces floating icon buttons */
.lightbox-toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
}

.lightbox-toolbar-toggle {
    position: absolute;
    top: -44px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(8px);
}

.lightbox-toolbar-toggle:hover { background: rgba(0,0,0,0.7); }

.lightbox-panel {
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border-top: 1px solid var(--glass-border-dark);
    padding: 16px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

/* Meta info row inside panel */
.lightbox-panel-meta {
    margin-bottom: 12px;
}

.lightbox-panel-meta .meta-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-inverse);
}

.lightbox-panel-meta .meta-detail {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
    margin-top: 2px;
}

/* AI description shown inline */
.lightbox-ai-info {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    font-style: italic;
    margin-top: 4px;
    line-height: 1.4;
}

/* People chips row inside panel */
.lightbox-panel-people {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* Action buttons — full width, labeled */
.lightbox-action-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 12px;
}

.lightbox-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 60px;
}

.lightbox-action-btn span {
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    opacity: 0.8;
}

.lightbox-action-btn:hover,
.lightbox-action-btn:active { background: rgba(255,255,255,0.15); }
.lightbox-action-btn.active { background: var(--accent-rose); color: white; }
.lightbox-action-btn.active span { opacity: 1; }
.lightbox-action-btn.danger { color: var(--accent-rose); }
.lightbox-action-btn.danger:hover { background: rgba(239,68,68,0.2); }

/* Expandable sub-panels (categories, people picker) */
.lightbox-sub-panel {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-md);
}

.lightbox-sub-panel-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.lightbox-sub-panel .pick-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* Inline add person form */
.lightbox-add-person {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    align-items: center;
}

.lightbox-add-person input {
    flex: 1;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    color: white;
    font-size: 0.85rem;
    min-width: 0;
}

.lightbox-add-person input::placeholder { color: rgba(255,255,255,0.35); }

.lightbox-add-person button {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent-rose);
    color: white;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

/* Use as reference checkbox */
.lightbox-ref-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
}

.lightbox-ref-toggle input[type="checkbox"] {
    accent-color: var(--accent-rose);
}

.people-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--accent-rose);
    color: var(--text-inverse);
}

.people-chip.ai-tagged {
    background: var(--accent-blue);
}

.category-pick-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    min-height: 44px;
    transition: background 0.15s;
}

.category-pick-btn:hover { background: var(--bg-hover); }
.category-pick-btn.active { background: var(--accent-rose); color: white; }

.lightbox-doc {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: white;
    text-align: center;
    padding: 40px;
}

.lightbox-doc-icon {
    font-size: 4rem;
    margin-bottom: 16px;
}

.lightbox-doc-name {
    font-size: 1.1rem;
    font-weight: 500;
    word-break: break-word;
    max-width: 400px;
}

/* ---- Search ---- */
.search-bar {
    position: relative;
    max-width: 480px;
}

.search-bar input {
    padding-left: 44px;
}

.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

/* ---- Progress Bar ---- */
.progress-bar {
    height: 4px;
    background: var(--border-subtle);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* ---- Upload Preview ---- */
.upload-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.upload-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--border-subtle);
}

.upload-thumb img { width: 100%; height: 100%; object-fit: cover; }

.upload-thumb .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.upload-thumb .upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
}

/* ---- Toast ---- */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--glass-white-strong);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-glass);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
}

.toast.success { border-left: 3px solid var(--accent-emerald); }
.toast.error { border-left: 3px solid var(--accent-rose); }

@media (prefers-reduced-motion: no-preference) {
    @keyframes slideIn {
        from { transform: translateX(100%); opacity: 0; }
        to { transform: translateX(0); opacity: 1; }
    }

    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }

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

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-text { color: var(--text-secondary); }

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

.folder-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s cubic-bezier(0.4,0,0.2,1), box-shadow 0.2s;
}

.folder-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.folder-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

.folder-name {
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 4px;
}

.folder-meta {
    text-align: center;
    font-size: 0.8rem;
}

.shared-badge {
    display: inline-block;
    background: var(--gradient-accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    vertical-align: middle;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.breadcrumbs a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumbs a:hover, .breadcrumbs a.active {
    color: var(--accent-rose);
}

.breadcrumb-sep {
    margin: 0 4px;
    color: var(--text-tertiary);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    backdrop-filter: blur(4px);
}

/* ---- Login ---- */
.login-container {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 6px;
    font-size: 1.5rem;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-bottom: 32px;
    letter-spacing: 0.02em;
}

.login-card .login-error {
    background: rgba(244, 63, 94, 0.08);
    color: var(--accent-rose);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* ---- Settings ---- */
.settings-section {
    margin-bottom: 32px;
}

.settings-section h3 {
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.storage-bar {
    height: 8px;
    background: var(--border-subtle);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.storage-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 4px;
}

/* ---- Settings Links ---- */
.settings-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: -4px -20px;
}

.settings-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    border-radius: 0;
}

.settings-link:hover {
    background: var(--border-subtle);
}

.settings-link:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.settings-link:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---- Text Link ---- */
.text-link {
    color: var(--accent-rose);
    text-decoration: none;
    transition: opacity 0.15s;
}

.text-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* ---- Mobile ---- */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-white-strong);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border-top: 1px solid rgba(226, 232, 240, 0.4);
    z-index: 100;
    padding: 0 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-inner {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    height: 72px;
    width: 100%;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    border-radius: 0;
    text-decoration: none;
    color: var(--text-tertiary);
    font-size: 0.7rem;
    font-weight: 500;
    min-height: 72px;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

.mobile-nav-item:active {
    background: rgba(244, 63, 94, 0.06);
}

.mobile-nav-item .nav-icon { font-size: 1.5rem; }

.mobile-nav-item.active {
    color: var(--accent-rose);
}

.mobile-nav-item.active .nav-icon {
    transform: scale(1.1);
}

.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--glass-white-strong);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border-bottom: 1px solid rgba(226, 232, 240, 0.4);
    z-index: 90;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0px);
    align-items: center;
    justify-content: space-between;
}

.mobile-header h1 {
    font-size: 1.1rem;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }

    .mobile-nav { display: block; }
    .mobile-header { display: flex; }

    .main-content {
        margin-left: 0;
        padding: 80px 16px calc(88px + env(safe-area-inset-bottom, 0px));
        overflow-x: hidden;
    }

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

    .item-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }

    .upload-zone { padding: 32px 16px; }
    .upload-zone .upload-icon { font-size: 2rem; }

    .lightbox-meta { padding: 16px; }

    .timeline-thumb { width: 80px; height: 80px; }
}

@media (max-width: 480px) {
    .grid-2 { grid-template-columns: 1fr; }
    .item-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}

/* ---- Social Memories ---- */
.social-badge {
    background: var(--gradient-accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

.platform-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0;
}

.platform-tabs::-webkit-scrollbar { display: none; }

.platform-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    background: var(--glass-white);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
}

.platform-tab:hover {
    border-color: var(--accent-rose);
    color: var(--text-primary);
}

.platform-tab.active {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.08), rgba(139, 92, 246, 0.08));
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

.platform-icon { font-size: 1.1rem; }

.social-year-group { margin-bottom: 32px; }

.social-year-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    z-index: 10;
}

.social-posts { display: flex; flex-direction: column; gap: 16px; }

.social-post-card {
    padding: 20px;
    transition: all 0.25s ease;
}

.social-post-card:hover {
    box-shadow: var(--shadow-md);
}

.social-post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.social-post-platform {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.social-post-text {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--text-primary);
    white-space: pre-line;
    word-wrap: break-word;
    margin-bottom: 12px;
}

.social-post-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
}

.social-gallery-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.social-gallery-thumb:hover {
    transform: scale(1.03);
}

.social-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.social-fav-active {
    background: rgba(244, 63, 94, 0.1) !important;
}

.family-badge {
    background: var(--gradient-accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--radius-full);
}

@media (max-width: 768px) {
    .social-post-gallery {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    }
    .social-year-header {
        font-size: 1.25rem;
    }
}

/* ---- Loading Spinner ---- */
.page-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 0;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent-rose);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ---- File Icon (folder detail) ---- */
.file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 2rem;
    background: var(--border-subtle);
    color: var(--text-secondary);
}

/* ---- Utilities ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

.fade-in { animation: fadeIn 0.3s ease; }

/* ---- Memories ---- */
.memories-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.memories-hero {
    text-align: center;
    padding: 20px 0 28px;
}

.memories-date {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.memories-year-group {
    margin-bottom: 28px;
}

.memories-year-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 10px 0;
    font-size: 1.3rem;
    font-weight: 700;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 14px;
    position: sticky;
    top: 0;
    background: rgba(248, 250, 252, 0.85);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    z-index: 10;
}

.memories-years-ago {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent-rose);
    background: rgba(244, 63, 94, 0.1);
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

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

.memory-card {
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.memory-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.memory-thumb {
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
}

.memory-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.memory-gallery {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    position: relative;
}

.memory-gallery-thumb {
    aspect-ratio: 1;
    overflow: hidden;
}

.memory-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memory-gallery-more {
    position: absolute;
    bottom: 0;
    right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 4px 10px;
    font-size: 0.85rem;
    font-weight: 600;
}

.memory-text {
    padding: 12px 14px 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.memory-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    font-size: 0.8rem;
}

.memory-source {
    font-weight: 600;
}

.memory-actions {
    display: flex;
    gap: 4px;
}

.memory-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    opacity: 0.5;
    transition: opacity 0.15s;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.memory-action-btn:hover, .memory-action-btn.active {
    opacity: 1;
}

.memories-nudge {
    text-align: center;
    padding: 24px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .memories-date { font-size: 1.3rem; }
    .memories-year-header { font-size: 1.1rem; }
    .memories-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .memory-text { font-size: 0.85rem; padding: 8px 10px 0; }
    .memory-footer { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .memories-grid { grid-template-columns: 1fr; }
}

/* ---- Timeline V2 (Year Scrubber) ---- */
.timeline-v2 { }

.year-scrubber {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0;
    margin-bottom: 12px;
}

.year-scrubber::-webkit-scrollbar { display: none; }

.year-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    background: var(--glass-white);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
}

.year-pill:hover {
    border-color: var(--accent-rose);
    color: var(--text-primary);
}

.year-pill.active {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.08), rgba(139, 92, 246, 0.08));
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

.year-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-tertiary);
    background: var(--border-subtle);
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.year-pill.active .year-count {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
}

.month-scrubber {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 0;
    margin-bottom: 16px;
}

.month-scrubber::-webkit-scrollbar { display: none; }

.month-pill {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    background: var(--glass-white);
    backdrop-filter: var(--blur-light);
    -webkit-backdrop-filter: var(--blur-light);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-height: 44px;
}

.month-pill:hover {
    border-color: var(--accent-violet);
    color: var(--text-primary);
}

.month-pill.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08), rgba(59, 130, 246, 0.08));
    border-color: var(--accent-violet);
    color: var(--accent-violet);
}

.month-count {
    font-size: 0.7rem;
    color: var(--text-tertiary);
}

.month-pill.active .month-count {
    color: var(--accent-violet);
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 24px 0;
}

.btn-sm {
    padding: 6px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    background: var(--bg-card);
    color: var(--text-secondary);
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.btn-sm:hover:not(:disabled) {
    border-color: var(--accent-rose);
    color: var(--accent-rose);
}

.btn-sm:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ---- Map Page ---- */
#map-container {
    width: 100%;
    min-height: 60vh;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.map-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.map-stats strong {
    color: var(--text-primary);
}

/* Fix Leaflet popups to match app style */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-lg) !important;
    font-family: var(--font) !important;
}

.leaflet-popup-content {
    margin: 10px 14px !important;
    font-size: 0.85rem !important;
}

/* ---- Albums ---- */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.album-card {
    background: var(--glass-white);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.album-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.album-cover {
    aspect-ratio: 4/3;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.08), rgba(139, 92, 246, 0.12));
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.album-cover-empty {
    font-size: 2.5rem;
    opacity: 0.4;
}

.album-info {
    padding: 12px 14px;
}

.album-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.album-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.album-share-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-emerald);
    background: rgba(16, 185, 129, 0.1);
    padding: 1px 8px;
    border-radius: var(--radius-full);
}

/* Album Detail */
.album-header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.album-share-url {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    margin-top: 8px;
}

.album-share-url code {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.item-card .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-inverse);
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
}

.item-card:hover .remove-btn {
    opacity: 1;
}

/* Add Items Picker */
.add-items-panel {
    background: var(--glass-white);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.add-items-results {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 8px 0;
}

.add-items-results::-webkit-scrollbar { display: none; }

.add-item-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s;
}

.add-item-thumb:hover {
    transform: scale(1.05);
}

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

.add-item-thumb .add-overlay {
    position: absolute;
    inset: 0;
    background: rgba(244, 63, 94, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}

.add-item-thumb:hover .add-overlay {
    opacity: 1;
}

/* Create Album Modal */
.create-album-form {
    background: var(--glass-white);
    backdrop-filter: var(--blur-medium);
    -webkit-backdrop-filter: var(--blur-medium);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.create-album-form .input {
    margin-bottom: 12px;
}

.mb-3 { margin-bottom: 12px; }

@media (max-width: 768px) {
    .album-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .album-info { padding: 8px 10px; }
    .album-name { font-size: 0.85rem; }
    .album-header-actions { flex-direction: column; }
    #map-container { min-height: 50vh; }
    .year-pill { padding: 6px 12px; font-size: 0.8rem; }
    .month-pill { padding: 4px 10px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
    .album-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}
