/* ============================================================
   MEDIA GALLERY — Professional Design System (Light & Dark Mode)
   Inspired by Apple Photos / Google Photos & Immich
   ============================================================ */

:root,
[data-theme="dark"] {
    /* Color Palette: Deep Slate & Apple Dark */
    --bg-body: #090a0d;
    --bg-surface: #111318;
    --bg-card: #151720;
    --bg-card-hover: #1c1e29;
    --bg-glass: rgba(15, 17, 24, 0.88);
    --bg-glass-card: rgba(19, 22, 31, 0.72);
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-card: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.18);

    /* Text Hierarchy */
    --text-primary: #f4f4f6;
    --text-secondary: #9ea0aa;
    --text-muted: #656775;
    --text-light: #484a56;

    /* Accents */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-subtle: rgba(59, 130, 246, 0.14);
    --accent-border: rgba(59, 130, 246, 0.35);

    /* Status Colors */
    --emerald: #10b981;
    --emerald-subtle: rgba(16, 185, 129, 0.14);
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;

    /* Radii */
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);

    /* Typography & Dimensions */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --navbar-h: 58px;

    /* Component Tokens */
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: var(--border-subtle);
    --input-color: #ffffff;
    --input-focus-border: rgba(255, 255, 255, 0.3);

    --btn-primary-bg: #ffffff;
    --btn-primary-text: #090a0d;
    --btn-primary-hover: #e4e4e7;
    --btn-secondary-bg: rgba(255, 255, 255, 0.06);
    --btn-secondary-border: var(--border-subtle);
    --btn-secondary-text: var(--text-primary);
    --btn-secondary-hover: rgba(255, 255, 255, 0.1);

    --segment-bg: rgba(255, 255, 255, 0.05);
    --segment-active-bg: rgba(255, 255, 255, 0.12);
    --segment-active-text: #ffffff;
    --segment-badge-bg: rgba(0, 0, 0, 0.35);

    --table-header-bg: rgba(255, 255, 255, 0.03);
    --table-row-hover: rgba(255, 255, 255, 0.02);
    --table-border: rgba(255, 255, 255, 0.04);
}

[data-theme="light"] {
    /* Color Palette: Clean Apple Light */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.9);
    --bg-glass-card: rgba(255, 255, 255, 0.94);
    --border-subtle: rgba(0, 0, 0, 0.08);
    --border-card: rgba(0, 0, 0, 0.06);
    --border-hover: rgba(0, 0, 0, 0.16);

    /* Text Hierarchy */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    /* Accents */
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-subtle: rgba(37, 99, 235, 0.08);
    --accent-border: rgba(37, 99, 235, 0.25);

    /* Status Colors */
    --emerald: #10b981;
    --emerald-subtle: rgba(16, 185, 129, 0.12);
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.08);
    --warning: #f59e0b;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.09);

    /* Component Tokens */
    --input-bg: #ffffff;
    --input-border: rgba(0, 0, 0, 0.15);
    --input-color: #0f172a;
    --input-focus-border: var(--accent);

    --btn-primary-bg: #0f172a;
    --btn-primary-text: #ffffff;
    --btn-primary-hover: #1e293b;
    --btn-secondary-bg: #ffffff;
    --btn-secondary-border: rgba(0, 0, 0, 0.12);
    --btn-secondary-text: #0f172a;
    --btn-secondary-hover: #f1f5f9;

    --segment-bg: rgba(0, 0, 0, 0.05);
    --segment-active-bg: #ffffff;
    --segment-active-text: #0f172a;
    --segment-badge-bg: rgba(0, 0, 0, 0.06);

    --table-header-bg: #f8fafc;
    --table-row-hover: #f8fafc;
    --table-border: rgba(0, 0, 0, 0.05);
}

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

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    background: var(--bg-body);
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 13.5px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s ease;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: #252836;
    border-radius: 4px;
}
[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}
::-webkit-scrollbar-thumb:hover {
    background: #373b4d;
}
[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---- SLEEK MINIMAL NAVBAR ---- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--navbar-h);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 1000;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}
.nav-brand img {
    border-radius: 6px;
    transition: opacity 0.15s;
}
.nav-brand:hover img {
    opacity: 0.85;
}

.brand-text {
    color: var(--text-primary);
    font-weight: 600;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.nav-link:hover {
    color: var(--text-primary);
    background: rgba(125, 125, 125, 0.08);
}
.nav-link.active {
    color: var(--text-primary);
    background: rgba(125, 125, 125, 0.12);
    font-weight: 600;
}

.nav-logout-form {
    margin: 0;
}
.nav-link.nav-logout {
    font-family: var(--font);
}
.nav-link.nav-logout:hover {
    color: #f87171;
    background: var(--danger-subtle);
}

/* Theme Toggle Button */
.nav-theme-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-left: 2px;
}
.nav-theme-toggle:hover {
    color: var(--text-primary);
    background: rgba(125, 125, 125, 0.12);
}

/* Toggle icon display based on theme */
[data-theme="dark"] .theme-icon-moon {
    display: none;
}
[data-theme="dark"] .theme-icon-sun {
    display: block;
}

[data-theme="light"] .theme-icon-sun {
    display: none;
}
[data-theme="light"] .theme-icon-moon {
    display: block;
}

.nav-mobile-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

/* ---- MAIN CONTENT WRAPPER ---- */
.main-content {
    margin-top: var(--navbar-h);
    flex: 1;
    width: 100%;
}

/* ---- UNIFIED PAGE SHELLS & MARGINS (APPLE / GOOGLE PHOTOS INSPIRED) ---- */
.gallery-shell,
.admin-shell,
.container,
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 32px 80px;
    width: 100%;
}

.settings-shell {
    max-width: 1040px;
    margin: 0 auto;
    padding: 32px 32px 80px;
    width: 100%;
}

/* Page Header & Typography */
.page-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
    margin-bottom: 6px;
    line-height: 1.25;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.admin-content {
    width: 100%;
}

/* Dashboard Stats Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}
.stat-icon-sm.icon-emerald { background: var(--emerald-subtle); color: var(--emerald); }
.stat-icon-sm.icon-amber { background: rgba(245, 158, 11, 0.14); color: var(--warning); }
.stat-icon-sm.icon-purple { background: rgba(168, 85, 247, 0.14); color: #c084fc; }
.stat-icon-sm.icon-pink { background: rgba(236, 72, 153, 0.14); color: #f472b6; }
.stat-icon-sm.icon-cyan { background: rgba(6, 182, 212, 0.14); color: #22d3ee; }

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.stat-footnote {
    font-size: 11.5px;
    color: var(--text-muted);
}

.quick-action-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.section-heading {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.section-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
}
.section-link:hover {
    text-decoration: underline;
}

/* ---- ALERTS ---- */
.alert {
    max-width: 1400px;
    margin: 16px auto 0;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}
.alert-success {
    background: var(--emerald-subtle);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}
.alert-error {
    background: var(--danger-subtle);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}
.alert-close {
    margin-left: auto;
    background: transparent;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
}
.alert-close:hover { opacity: 1; }

.gallery-toolbar-top {
    margin-bottom: 24px;
}

.toolbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.gallery-heading-area {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gallery-main-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.gallery-meta-line {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--text-muted);
}

.meta-count-badge {
    color: var(--text-secondary);
}
.count-value {
    color: var(--text-primary);
    font-weight: 600;
}

.meta-bullet {
    color: var(--text-muted);
}

.meta-storage {
    color: var(--text-secondary);
}

.meta-desc {
    color: var(--text-muted);
}

/* Toolbar Actions: Search & Upload */
.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gallery-search-bar {
    margin: 0;
}

.search-input-box {
    position: relative;
    display: flex;
    align-items: center;
    width: 250px;
}

.search-icon-svg {
    position: absolute;
    left: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

.gallery-search-field {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-full);
    padding: 7px 28px 7px 34px;
    color: var(--input-color);
    font-size: 12.5px;
    font-family: var(--font);
    outline: none;
    transition: all 0.15s ease;
}
.gallery-search-field:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.gallery-search-field::placeholder {
    color: var(--text-muted);
}

.search-clear-cross {
    position: absolute;
    right: 10px;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
}
.search-clear-cross:hover {
    color: var(--text-primary);
}

.btn-clean-upload {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-full);
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.btn-clean-upload:hover {
    background: var(--btn-primary-hover);
}

/* Filter Sub-bar */
.toolbar-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding-top: 14px;
}

.filter-segmented-tabs {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--segment-bg);
    padding: 3px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.segment-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    text-decoration: none;
}
.segment-tab:hover {
    color: var(--text-primary);
}
.segment-tab.active {
    background: var(--segment-active-bg);
    color: var(--segment-active-text);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.tab-badge {
    font-size: 10.5px;
    padding: 1px 6px;
    border-radius: 9999px;
    background: var(--segment-badge-bg);
    color: inherit;
}

/* Album Chips Scroll */
.albums-chips-scroll {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    max-width: 500px;
    padding-bottom: 2px;
}

.album-chip-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    font-size: 11.5px;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.15s ease;
    text-decoration: none;
}
.album-chip-tab:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}
.album-chip-tab.active {
    background: var(--accent-subtle);
    border-color: var(--accent-border);
    color: var(--accent);
    font-weight: 600;
}
.album-badge-count {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.75;
}

/* ============================================================
   PHOTO WALL GRID & CARDS (APPLE PHOTOS STREAM)
   ============================================================ */
.gallery-photo-stream {
    width: 100%;
}

.photo-wall-grid,
.modern-media-grid,
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 36px;
}

.media-card {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border-card);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.2s ease,
                box-shadow 0.2s ease;
}

.media-card:hover {
    transform: scale(1.02);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    z-index: 2;
}

.media-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.media-card-thumb-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #11131a;
}
[data-theme="light"] .media-card-thumb-wrap {
    background: #e2e8f0;
}

.media-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-card:hover .media-card-image {
    transform: scale(1.04);
}

/* Video Indicator (iOS Photos style in corner) */
.video-indicator-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 11px;
    font-weight: 500;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* Download Quick Action on Hover */
.card-quick-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.media-card:hover .card-quick-actions,
.media-card:focus-within .card-quick-actions {
    opacity: 1;
    transform: translateY(0);
}

.card-action-download,
.card-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(15, 17, 24, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    padding: 0;
}
.card-action-download:hover,
.card-action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.card-action-download:hover,
.card-action-btn.btn-download:hover {
    background: #ffffff;
    color: #090a0d;
    border-color: #ffffff;
}
.card-action-btn.btn-delete {
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.65);
    border-color: rgba(248, 113, 113, 0.4);
}
.card-action-btn.btn-delete:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #ef4444;
}

[data-theme="light"] .card-action-download,
[data-theme="light"] .card-action-btn {
    background: rgba(255, 255, 255, 0.92);
    color: #0f172a;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .card-action-download:hover,
[data-theme="light"] .card-action-btn.btn-download:hover {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
}
[data-theme="light"] .card-action-btn.btn-delete {
    color: #dc2626;
    background: rgba(254, 226, 226, 0.95);
    border-color: #fca5a5;
}
[data-theme="light"] .card-action-btn.btn-delete:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #dc2626;
}

/* Media Selection Checkbox (Batch Actions) */
.media-card-checkbox-label {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(15, 17, 24, 0.7);
    backdrop-filter: blur(8px);
}
.media-card:hover .media-card-checkbox-label,
.media-card-checkbox-label.is-checked {
    opacity: 1;
}
.media-card-checkbox-label input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #dc2626;
    margin: 0;
}

[data-theme="light"] .media-card-checkbox-label {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.15);
}

/* Card Bottom Meta on Hover */
.media-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px 10px 8px;
    background: linear-gradient(to top, rgba(9, 10, 13, 0.92) 0%, rgba(9, 10, 13, 0.4) 70%, transparent 100%);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 6;
}

.media-card:hover .media-card-overlay {
    opacity: 1;
    transform: translateY(0);
}

.media-card-title {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.media-card-meta {
    font-size: 11px;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.meta-dot {
    color: #64748b;
}

.meta-album-name {
    color: #93c5fd;
}

/* ---- EMPTY STATE ---- */
.gallery-empty-state {
    text-align: center;
    padding: 70px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    max-width: 480px;
    margin: 40px auto;
}

.empty-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(125, 125, 125, 0.08);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.empty-state-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.empty-state-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 380px;
    margin: 0 auto;
}

/* ============================================================
   PAGINATION (APPLE STYLE & DEFENSIVE SAFETY)
   ============================================================ */
.gallery-pagination-bar,
.pagination-wrapper {
    margin-top: 32px;
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

/* Defensive rule: prevent ANY pagination SVG from breaking layout */
nav[role="navigation"] svg,
.apple-pagination svg,
.gallery-pagination-bar svg,
.pagination-wrapper svg,
.pagination svg {
    width: 16px !important;
    height: 16px !important;
    max-width: 16px !important;
    max-height: 16px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
}

.apple-pagination {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .apple-pagination {
    background: rgba(30, 30, 35, 0.75);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.apple-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary, #0f172a);
    background: transparent;
    border-radius: 9999px;
    text-decoration: none;
    transition: all 0.18s ease;
    cursor: pointer;
    user-select: none;
}

.apple-page-btn:hover:not(.disabled) {
    background: rgba(0, 0, 0, 0.06);
    color: var(--accent, #0A84FF);
}

[data-theme="dark"] .apple-page-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #38bdf8;
}

.apple-page-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

.apple-page-numbers {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 4px;
}

.apple-page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    text-decoration: none;
    transition: all 0.18s ease;
}

.apple-page-number:hover:not(.active) {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary, #0f172a);
}

[data-theme="dark"] .apple-page-number:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

.apple-page-number.active {
    background: var(--accent, #0A84FF);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(10, 132, 255, 0.35);
}

.apple-page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 32px;
    color: var(--text-muted, #94a3b8);
    font-size: 0.8125rem;
}

/* ============================================================
   LIGHTBOX MODAL (APPLE QUICKLOOK AMBIENT)
   ============================================================ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #000000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: #000000;
}

/* Floating Top Bar (Apple Photos Header) */
.lightbox-topbar {
    position: relative;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(18, 18, 22, 0.78);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.lightbox.chrome-hidden .lightbox-topbar {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.lightbox-nav-back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    color: #38bdf8;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.15s ease;
    font-family: var(--font);
}
.lightbox-nav-back:hover {
    background: rgba(56, 189, 248, 0.12);
    color: #7dd3fc;
}

.lightbox-header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    max-width: 50%;
    overflow: hidden;
}

.lightbox-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.lightbox-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lightbox-inline-rename-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #94a3b8;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}
.lightbox-inline-rename-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.lightbox-meta-row {
    font-size: 11.5px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lightbox-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-counter-pill {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    font-size: 11px;
    font-weight: 600;
    color: #cbd5e1;
}

.lightbox-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}
.lightbox-action-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

.lightbox-action-btn.close-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

/* Stage Viewport */
.lightbox-stage {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    max-height: calc(100vh - 170px);
    overflow: hidden;
    user-select: none;
}

.lightbox-media-viewport {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.lightbox-image-frame,
.lightbox-video-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 92vw;
    max-height: 75vh;
}

.lightbox-image-element {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.85);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox-video-element {
    max-width: 100%;
    max-height: 75vh;
    border-radius: 4px;
    outline: none;
    background: #000000;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.85);
}

.lightbox-nav-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 20;
    backdrop-filter: blur(16px);
}
.lightbox-nav-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.08);
}
.lightbox.chrome-hidden .lightbox-nav-btn {
    opacity: 0;
    pointer-events: none;
}

/* Apple Photos Bottom Section (Filmstrip + Floating Dock) */
.lightbox-bottom-section {
    position: relative;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 0 16px max(14px, env(safe-area-inset-bottom));
    width: 100%;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s ease;
}

.lightbox.chrome-hidden .lightbox-bottom-section {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

/* Filmstrip Scroller Container */
.lightbox-filmstrip-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
}

/* Filmstrip Mini-Scroller */
.lightbox-filmstrip-bar {
    max-width: min(92vw, 760px);
    width: 100%;
    height: 56px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    display: flex;
    align-items: center;
    padding: 4px 8px;
    background: rgba(22, 22, 26, 0.76);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}
.lightbox-filmstrip-bar::-webkit-scrollbar {
    display: none;
}

.lightbox-filmstrip-bar.minimized {
    height: 0;
    padding: 0;
    margin: 0;
    opacity: 0;
    border-color: transparent;
    pointer-events: none;
    transform: translateY(12px) scale(0.96);
    overflow: hidden;
}

.filmstrip-minimize-btn {
    position: sticky;
    right: 0;
    flex-shrink: 0;
    width: 26px;
    height: 44px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 6px;
    transition: all 0.2s ease;
    z-index: 6;
}
.filmstrip-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.05);
}

/* Floating Restore Pill Button */
.filmstrip-restore-pill {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(22, 22, 26, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    margin-bottom: 4px;
}
.filmstrip-restore-pill.visible {
    display: inline-flex;
    animation: pillFadeIn 0.22s ease-out;
}
.filmstrip-restore-pill:hover {
    background: rgba(35, 35, 45, 0.95);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.04);
}
@keyframes pillFadeIn {
    from { opacity: 0; transform: translateY(6px) scale(0.94); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}


.lightbox-filmstrip-track {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: auto;
}

.filmstrip-item {
    position: relative;
    flex-shrink: 0;
    width: 38px;
    height: 46px;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.45;
    transform: scale(0.96);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    border: 1.5px solid transparent;
}
.filmstrip-item:hover {
    opacity: 0.85;
    transform: scale(1.05);
}
.filmstrip-item.active {
    opacity: 1;
    transform: scale(1.16);
    border-color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
    z-index: 5;
}
.filmstrip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.filmstrip-video-indicator {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 8px;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Apple Photos Floating Action Dock */
.lightbox-apple-dock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: rgba(28, 28, 32, 0.85);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.dock-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 12px;
    border-radius: 9999px;
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    min-width: 46px;
}
.dock-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    transform: translateY(-1px);
}
.dock-btn:active {
    transform: scale(0.95);
}

.dock-btn.is-active,
.dock-btn.is-active svg {
    color: #ef4444;
}

.dock-btn.dock-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.lightbox-bottom-hint {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 4px 12px;
    font-size: 10.5px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.hint-dot {
    color: #475569;
}

.dock-btn-filmstrip.active {
    color: #38bdf8;
}

@media (max-width: 640px) {
    .lightbox-apple-dock {
        max-width: 96vw;
        overflow-x: auto;
        padding: 4px 6px;
        gap: 2px;
        scrollbar-width: none;
    }
    .lightbox-apple-dock::-webkit-scrollbar {
        display: none;
    }
    .dock-btn {
        min-width: 38px;
        padding: 4px 6px;
        font-size: 9px;
    }
    .dock-btn svg {
        width: 16px;
        height: 16px;
    }
}

/* Download Entire Album Button in Toolbar */
.btn-download-album {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(10, 132, 255, 0.12);
    color: #0a84ff;
    border: 1px solid rgba(10, 132, 255, 0.28);
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.18s ease;
}
.btn-download-album:hover {
    background: rgba(10, 132, 255, 0.22);
    border-color: #0a84ff;
    color: #60a5fa;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(10, 132, 255, 0.25);
}
.btn-download-album:active {
    transform: scale(0.97);
}
[data-theme="light"] .btn-download-album {
    background: #eff6ff;
    color: #0284c7;
    border-color: #bfdbfe;
}
[data-theme="light"] .btn-download-album:hover {
    background: #dbeafe;
    color: #0369a1;
    border-color: #93c5fd;
}

/* Album Card Download Button */
.album-card-download-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 5;
    opacity: 0.85;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.album-visual-card:hover .album-card-download-btn {
    opacity: 1;
    transform: scale(1.08);
}
.album-card-download-btn:hover {
    background: rgba(10, 132, 255, 0.9);
    border-color: #ffffff;
    transform: scale(1.15) !important;
    box-shadow: 0 4px 14px rgba(10, 132, 255, 0.5);
}


@media (max-width: 640px) {
    .lightbox-nav-btn {
        display: none !important;
    }
    .lightbox-bottom-hint {
        display: none !important;
    }
    .lightbox-header-center {
        max-width: 55%;
    }
    .dock-btn {
        padding: 5px 8px;
        min-width: 40px;
    }
    .dock-btn span {
        font-size: 9px;
    }
}

/* ============================================================
   ADMIN DASHBOARD & UTILITIES (APPLE SYSTEM STYLE)
   ============================================================ */
.admin-shell {
    max-width: 1360px;
    margin: 0 auto;
    padding: 20px 20px 60px;
}

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

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.stat-icon-sm {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(125, 125, 125, 0.08);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-emerald { color: #10b981; background: var(--emerald-subtle); }
.icon-amber { color: #f59e0b; background: rgba(245, 158, 11, 0.12); }
.icon-purple { color: #8b5cf6; background: rgba(139, 92, 246, 0.12); }
.icon-pink { color: #ec4899; background: rgba(236, 72, 153, 0.12); }
.icon-cyan { color: #06b6d4; background: rgba(6, 182, 212, 0.12); }

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.15;
    margin-bottom: 4px;
}

.stat-footnote {
    font-size: 11.5px;
    color: var(--text-muted);
}

.admin-section-header {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-heading {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.2px;
}

.section-link {
    font-size: 12.5px;
    color: var(--text-secondary);
}
.section-link:hover {
    color: var(--text-primary);
}

.quick-action-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

/* Global Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    font-family: var(--font);
    text-decoration: none;
}

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

.btn-secondary {
    background: var(--btn-secondary-bg);
    border-color: var(--btn-secondary-border);
    color: var(--btn-secondary-text);
}
.btn-secondary:hover {
    background: var(--btn-secondary-hover);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger-subtle);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}
.btn-danger:hover {
    background: #ef4444;
    color: #ffffff;
}

.btn-lg {
    padding: 10px 18px;
    font-size: 13px;
}
.btn-sm {
    padding: 5px 10px;
    font-size: 11.5px;
}

/* Forms & Tables */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input, .form-textarea, .form-select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--input-color);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 12.5px;
}
.table th {
    background: var(--table-header-bg);
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}
.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--table-border);
    color: var(--text-primary);
}
.table tr:hover td {
    background: var(--table-row-hover);
}

.action-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--btn-secondary-bg);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.action-btn:hover {
    background: var(--btn-secondary-hover);
    color: var(--text-primary);
}
.action-btn-download:hover {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
}
.action-btn-edit:hover {
    background: var(--accent-subtle);
    color: var(--accent);
    border-color: var(--accent-border);
}
.action-btn-delete:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.modal-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}
.modal-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
}
.modal-close:hover { color: var(--text-primary); }
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Auth Login & 2FA Cards */
.login-page {
    min-height: calc(100vh - var(--navbar-h) - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}
.login-header {
    text-align: center;
    margin-bottom: 24px;
}
.login-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}
.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}
.login-btn {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    font-size: 13.5px;
}
.form-error {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
}

/* Utility Flex */
.flex { display: flex; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.mt-24 { margin-top: 24px; }

/* Admin Toolbar & Search */
.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 12px 18px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.search-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius-full);
    padding: 7px 14px;
    color: var(--input-color);
    font-size: 12.5px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.15s ease;
}
.search-input:focus {
    border-color: var(--input-focus-border);
}

/* Album Grid in Admin */
.album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}
.album-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.album-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}
.album-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.album-info {
    flex: 1;
    min-width: 0;
}
.album-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.album-count {
    font-size: 12px;
    color: var(--text-muted);
}
.album-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Upload Zone */
.upload-zone {
    max-width: 800px;
    margin: 0 auto;
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 50px 24px;
    text-align: center;
    background: var(--bg-card);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}
.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.upload-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.upload-zone-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}
.upload-zone-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}
.upload-zone-hint {
    font-size: 12px;
    color: var(--text-muted);
}
.upload-progress-list {
    max-width: 800px;
    margin: 20px auto 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.upload-progress-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
}
.upload-progress-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
.upload-progress-bar {
    width: 120px;
    height: 6px;
    background: rgba(125, 125, 125, 0.15);
    border-radius: 3px;
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.15s ease;
}
.upload-progress-status {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 32px;
    text-align: right;
}
.upload-progress-status.success {
    color: var(--emerald);
}
.upload-progress-status.error {
    color: var(--danger);
}

/* Settings Page */
.settings-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 20px 48px;
}
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
}
.settings-subcard {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 16px;
    color: var(--text-primary);
}
.settings-card h2, .settings-card h3 {
    color: var(--text-primary) !important;
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION BAR (iOS / ANDROID NATIVE STYLE)
   ============================================================ */
.mobile-bottom-nav {
    display: none;
}

/* ============================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ============================================================ */
@media (max-width: 768px) {
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--bg-glass);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-top: 1px solid var(--border-subtle);
        z-index: 1000;
        align-items: center;
        justify-content: space-around;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 10.5px;
        font-weight: 500;
        flex: 1;
        height: 100%;
        transition: all 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

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

    .mobile-nav-item.active {
        color: var(--accent);
        font-weight: 600;
    }

    .mobile-nav-item.upload-center {
        position: relative;
    }

    .mobile-upload-btn {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: var(--accent);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45);
        margin-top: -6px;
        transition: transform 0.15s ease, background-color 0.15s ease;
    }

    .mobile-nav-item.upload-center:active .mobile-upload-btn {
        transform: scale(0.9);
    }

    /* Container padding on mobile */
    .nav-container {
        padding: 0 16px;
    }
    .gallery-shell,
    .admin-shell,
    .settings-shell,
    .container,
    .page-container {
        padding: 16px 14px 40px;
    }

    .page-header {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }
    .page-title {
        font-size: 1.35rem;
    }

    .toolbar-main {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .toolbar-actions {
        width: 100%;
        justify-content: space-between;
    }
    .search-input-box {
        flex: 1;
        width: auto;
    }

    /* Dense, Apple Photos style grid on mobile */
    .photo-wall-grid,
    .modern-media-grid,
    .media-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 3px;
        margin-bottom: 24px;
    }
    .media-card {
        border-radius: 4px;
        border-width: 0;
    }

    .card-quick-actions {
        opacity: 1;
        top: 4px;
        right: 4px;
        gap: 4px;
    }
    .card-action-btn,
    .card-action-download {
        width: 28px;
        height: 28px;
    }
    .card-action-btn svg,
    .card-action-download svg {
        width: 13px;
        height: 13px;
    }
    .video-indicator-badge {
        bottom: 4px;
        left: 4px;
        padding: 2px 5px;
        font-size: 9px;
    }
    .media-card-title {
        font-size: 10.5px;
    }

    /* Navbar on mobile */
    .nav-mobile-toggle {
        display: block;
    }
    .nav-links {
        display: none;
        position: absolute;
        top: var(--navbar-h);
        left: 0;
        right: 0;
        background: var(--bg-surface);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 14px 20px;
        border-bottom: 1px solid var(--border-subtle);
        box-shadow: var(--shadow);
    }
    .nav-links.show {
        display: flex;
    }
    .nav-link {
        width: 100%;
        padding: 10px 12px;
        font-size: 14px;
    }
    .nav-theme-toggle {
        margin: 6px 0 0;
        width: 100%;
        justify-content: flex-start;
        padding: 10px 12px;
    }

    /* Lightbox on Mobile */
    .lightbox-topbar {
        padding: 10px 14px;
    }
    .lightbox-title {
        font-size: 12.5px;
        max-width: 140px;
    }
    .lightbox-meta-row {
        font-size: 10.5px;
    }
    .lightbox-action-btn {
        padding: 5px 10px;
        font-size: 11px;
        gap: 4px;
    }
    .lightbox-counter-pill {
        font-size: 10px;
        padding: 2px 7px;
    }
    .lightbox-bottom-hint {
        display: none;
    }
    .lightbox-nav-btn {
        width: 38px;
        height: 38px;
        background: rgba(0, 0, 0, 0.4);
    }
    .lightbox-nav-btn svg {
        width: 20px;
        height: 20px;
    }
    .lightbox-nav-btn.prev-btn { left: 6px; }
    .lightbox-nav-btn.next-btn { right: 6px; }

    /* Admin Toolbar on Mobile */
    .admin-toolbar {
        padding: 12px 14px;
        gap: 10px;
    }
    .admin-toolbar .search-input {
        max-width: 100% !important;
        width: 100%;
    }

    /* Filter Segmented Tabs */
    .filter-segmented-tabs {
        width: 100%;
        justify-content: space-between;
    }
    .segment-tab {
        flex: 1;
        justify-content: center;
        padding: 6px 6px;
        font-size: 12px;
    }
    .albums-chips-scroll {
        padding: 4px 0 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .albums-chips-scroll::-webkit-scrollbar {
        display: none;
    }
}

/* Extra small mobile phones (< 380px) */
@media (max-width: 380px) {
    .photo-wall-grid,
    .modern-media-grid,
    .media-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 4px;
    }
    .lightbox-title {
        max-width: 100px;
    }
}

/* ============================================================
   MOBILE BOTTOM NAVIGATION BAR (iOS / ANDROID NATIVE STYLE)
   ============================================================ */
.mobile-bottom-nav {
    display: none !important;
}

@media (max-width: 768px) {
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-bottom-nav {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--bg-glass);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border-top: 1px solid var(--border-subtle);
        z-index: 1000;
        align-items: center;
        justify-content: space-around;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 10.5px;
        font-weight: 500;
        flex: 1;
        height: 100%;
        transition: all 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

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

    .mobile-nav-item.active {
        color: var(--accent);
        font-weight: 600;
    }

    .mobile-nav-item.upload-center {
        position: relative;
    }

    .mobile-upload-btn {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: var(--accent);
        color: #ffffff;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45);
        margin-top: -6px;
        transition: transform 0.15s ease, background-color 0.15s ease;
    }

    .mobile-nav-item.upload-center:active .mobile-upload-btn {
        transform: scale(0.9);
    }
}

/* ============================================================
   AUTHENTIC GALLERY FEATURES: Move, Copy, Multi-Select,
   Date Headers, Favorites, Info Drawer, Slideshow
   ============================================================ */

/* 1. Date Section Header (Apple / Google Photos Style) */
.gallery-date-section-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 24px 4px 10px;
    margin-top: 8px;
    border-bottom: 1px solid var(--border-subtle);
}
.gallery-date-section-header:first-child {
    margin-top: 0;
    padding-top: 6px;
}
.date-header-left {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.date-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}
.date-header-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* 2. Selection Mode & Checkbox */
.btn-select-mode {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--btn-secondary-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-select-mode:hover,
.btn-select-mode.active {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}
.card-select-checkbox {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    z-index: 12;
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-select-checkbox svg {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease;
}
.media-card:hover .card-select-checkbox,
body.selection-active .card-select-checkbox {
    opacity: 1;
    transform: scale(1);
}
.media-card.is-selected .card-select-checkbox {
    background: var(--accent);
    border-color: var(--accent);
    opacity: 1;
    transform: scale(1);
}
.media-card.is-selected .card-select-checkbox svg {
    opacity: 1;
    transform: scale(1);
}
.media-card.is-selected {
    transform: scale(0.96);
    box-shadow: 0 0 0 3px var(--accent), 0 8px 24px rgba(0, 0, 0, 0.4);
    border-radius: var(--radius);
}

/* 3. Card Favorite Badge */
.card-favorite-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    cursor: pointer;
    z-index: 12;
    opacity: 0;
    transform: scale(0.85);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-favorite-badge.is-active {
    opacity: 1;
    transform: scale(1);
    color: #ef4444;
    background: rgba(0, 0, 0, 0.65);
}
.media-card:hover .card-favorite-badge {
    opacity: 1;
    transform: scale(1);
}

/* 4. Floating Multi-Selection Action Bar */
.floating-selection-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 110;
    max-width: 90vw;
    animation: floatBarSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes floatBarSlideUp {
    from { opacity: 0; transform: translate(-50%, 20px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
.selection-bar-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 18px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-full);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
.selection-count-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    border-right: 1px solid var(--border-subtle);
}
.selection-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 700;
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-full);
}
.selection-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}
.selection-actions-group {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bar-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--btn-secondary-bg);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.bar-action-btn:hover {
    background: var(--btn-secondary-hover);
    border-color: var(--border-hover);
}
.bar-action-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}
.bar-action-btn.primary:hover {
    background: var(--accent-hover);
}
.bar-action-btn.danger {
    background: var(--danger-subtle);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}
.bar-action-btn.danger:hover {
    background: var(--danger);
    color: #ffffff;
}
.bar-action-btn.close {
    padding: 7px 9px;
    border-radius: 50%;
}

@media (max-width: 768px) {
    .floating-selection-bar {
        bottom: calc(var(--mobile-nav-h, 60px) + 14px);
    }
    .selection-bar-inner {
        padding: 8px 12px;
        gap: 8px;
    }
    .selection-text {
        display: none;
    }
    .bar-action-btn {
        padding: 6px 10px;
        font-size: 11.5px;
    }
}

/* 5. Organize & Rename Modal */
.organize-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    padding: 20px;
    animation: fadeInModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}
.organize-modal-box {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: scaleModal 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes scaleModal {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.organize-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}
.header-icon-pill {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.organize-modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.organize-modal-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 2px 0 0;
}
.organize-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}
.organize-close-btn:hover {
    color: var(--text-primary);
    background: var(--btn-secondary-bg);
}
.organize-form-body {
    padding: 20px;
    max-height: 55vh;
    overflow-y: auto;
}
.organize-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.organize-album-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}
.album-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.15s ease;
}
.album-option-card:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
}
.album-option-card input[type="radio"] {
    accent-color: var(--accent);
    width: 17px;
    height: 17px;
    cursor: pointer;
}
.album-option-info {
    display: flex;
    flex-direction: column;
}
.album-option-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}
.album-option-desc {
    font-size: 11.5px;
    color: var(--text-muted);
}
.new-album-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 18px 0 12px;
}
.new-album-divider::before,
.new-album-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}
.new-album-divider span {
    padding: 0 10px;
    font-size: 11.5px;
    color: var(--text-muted);
    text-transform: lowercase;
}
.new-album-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    transition: border-color 0.2s ease;
}
.new-album-input-wrap:focus-within {
    border-color: var(--accent);
}
.new-album-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13.5px;
}
.organize-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
}

/* 6. Lightbox Full-Featured Body, Info Drawer & Slideshow */
.lightbox-main-body {
    display: flex;
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100% - 60px);
    overflow: hidden;
}
.lightbox-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.lightbox-inline-rename-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}
.lightbox-inline-rename-btn:hover {
    color: var(--text-primary);
}
.lightbox-action-btn.icon-only {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
    border-radius: var(--radius-sm);
}
.lightbox-action-btn.is-active {
    color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.15) !important;
}

/* Slideshow Progress */
.slideshow-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 100;
}
.slideshow-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 4.5s linear;
}

/* Info Drawer (Apple / Google Photos Inspector) */
.lightbox-info-drawer {
    width: 340px;
    height: 100%;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 50;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}
.lightbox-info-drawer.open {
    transform: translateX(0);
}
.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}
.drawer-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.drawer-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
}
.drawer-close-btn:hover {
    color: var(--text-primary);
}
.drawer-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.info-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.info-sec-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0;
}
.info-data-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg-card);
    padding: 12px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
}
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
}
.info-label {
    color: var(--text-muted);
    font-size: 12px;
}
.info-val {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}
.info-storage-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius);
}
.storage-badge-icon {
    flex-shrink: 0;
    margin-top: 2px;
}
.storage-badge-text strong {
    font-size: 13px;
    color: var(--text-primary);
    display: block;
    margin-bottom: 2px;
}
.storage-badge-text p {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}
.info-actions-bottom {
    margin-top: auto;
    padding-top: 10px;
}

@media (max-width: 768px) {
    .lightbox-info-drawer {
        width: 100%;
        height: 60vh;
        top: auto;
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
    }
    .lightbox-info-drawer.open {
        transform: translateY(0);
    }
}

/* ============================================================
   VISUAL ALBUMS SHOWCASE (Apple / Google Photos Style)
   ============================================================ */
.btn-create-album-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-create-album-pill:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}
.albums-showcase-container {
    margin-top: 24px;
}
.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 24px;
}
.album-visual-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.album-visual-card:hover {
    transform: translateY(-4px);
}
.album-cover-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow);
}
.album-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.album-visual-card:hover .album-cover-img {
    transform: scale(1.05);
}
.album-cover-empty {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
    color: var(--text-muted);
}
.empty-folder-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
}
.empty-folder-text {
    font-size: 12px;
    font-weight: 500;
}
.album-count-badge {
    position: absolute;
    bottom: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
.album-hover-peek {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.album-visual-card:hover .album-hover-peek {
    opacity: 1;
}
.album-meta-under {
    padding: 10px 2px 2px;
}
.album-visual-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.album-visual-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card "+ Buat Album Baru" */
.album-card-create {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-lg);
    border: 2px dashed var(--border-hover);
    background: var(--bg-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
}
.album-card-create:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}
.create-card-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
}
.create-icon-bubble {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    transition: transform 0.2s ease;
}
.album-card-create:hover .create-icon-bubble {
    transform: scale(1.1);
    background: var(--accent);
    color: #ffffff;
}
.create-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.create-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .albums-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }
    .album-visual-title {
        font-size: 13.5px;
    }
    .album-visual-subtitle {
        font-size: 11px;
    }
    .btn-create-album-pill {
        padding: 6px 12px;
        font-size: 12px;
    }
}
@media (max-width: 380px) {
    .albums-grid {
        gap: 10px;
    }
}

/* ============================================================
   APPLE PHOTOS iOS 18 "JENIS MEDIA" INSET GROUPED LIST
   ============================================================ */
.ios-media-types-section {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
}

.ios-section-heading {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    letter-spacing: -0.02em;
}

.ios-media-types-list {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ios-media-type-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    text-decoration: none;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-subtle);
}
.ios-media-type-row:last-child {
    border-bottom: none;
}
.ios-media-type-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.type-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.type-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.type-icon-photo {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
}

.type-icon-video {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.type-icon-fav {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.type-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.type-row-right {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.type-count {
    font-size: 13px;
    font-weight: 500;
}

.chevron-arrow {
    opacity: 0.5;
    transition: transform 0.15s ease;
}
.ios-media-type-row:hover .chevron-arrow {
    transform: translateX(2px);
    opacity: 0.9;
}

/* ============================================================
   APPLE PHOTOS DUPLICATES MODAL & UTILITY STYLES
   ============================================================ */
.duplicates-modal-box {
    max-width: 880px !important;
    width: 95vw !important;
    max-height: 88vh !important;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    overflow: hidden;
    background: rgba(22, 23, 30, 0.94) !important;
    backdrop-filter: blur(28px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(28px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
    border-radius: 20px !important;
}

.duplicates-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.02);
}

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

.dup-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(10, 132, 255, 0.18);
    color: #0A84FF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 16px rgba(10, 132, 255, 0.2);
}

.dup-header-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #f3f4f6;
    letter-spacing: -0.3px;
}

.dup-header-subtitle {
    margin: 2px 0 0 0;
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.6);
}

.dup-summary-bar {
    padding: 12px 24px;
    background: rgba(10, 132, 255, 0.08);
    border-bottom: 1px solid rgba(10, 132, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dup-summary-info {
    font-size: 13px;
    color: #93c5fd;
    font-weight: 500;
}

.dup-summary-info strong {
    color: #ffffff;
    font-weight: 700;
}

.duplicates-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.dup-group-card {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.2s ease;
}

.dup-group-card:hover {
    border-color: rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
}

.dup-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dup-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-all;
}

.dup-group-meta {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
}

.btn-merge-group {
    background: rgba(10, 132, 255, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(10, 132, 255, 0.4);
    border-radius: 10px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-merge-group:hover {
    background: #0A84FF;
    color: #ffffff;
    border-color: #0A84FF;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.35);
    transform: translateY(-1px);
}

.dup-items-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.dup-item-card {
    position: relative;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dup-item-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: #0f1015;
    overflow: hidden;
}

.dup-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.dup-item-card:hover .dup-item-img {
    transform: scale(1.03);
}

.dup-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    backdrop-filter: blur(8px);
}

.dup-badge-keeper {
    background: rgba(16, 185, 129, 0.85);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.dup-badge-copy {
    background: rgba(239, 68, 68, 0.85);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.dup-item-info {
    padding: 10px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.dup-item-date {
    font-weight: 500;
    color: #e5e7eb;
}

.dup-item-album {
    font-size: 10.5px;
    color: #93c5fd;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dup-delete-btn {
    align-self: flex-end;
    margin-top: 4px;
    background: transparent;
    border: none;
    color: rgba(239, 68, 68, 0.8);
    cursor: pointer;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s ease;
}

.dup-delete-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.dup-empty-state {
    text-align: center;
    padding: 48px 24px;
}

.dup-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.dup-empty-title {
    font-size: 18px;
    font-weight: 700;
    color: #f3f4f6;
    margin-bottom: 6px;
}

.dup-empty-desc {
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.6);
    max-width: 420px;
    margin: 0 auto;
}

.video-repair-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0 8px;
}

.video-repair-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0A84FF, #60a5fa);
    width: 0%;
    transition: width 0.25s ease;
}



