/* ─────────────────────────────────────────────
   Mantic Gallery — Design System v2
   Dark, minimal, photography-focused
───────────────────────────────────────────── */

:root {
    /* Palette */
    --bg:           #111111;
    --bg-raised:    #181818;
    --bg-elevated:  #202020;
    --bg-overlay:   #282828;
    --border:       rgba(255,255,255,0.08);
    --border-mid:   rgba(255,255,255,0.12);
    --border-hi:    rgba(255,255,255,0.18);

    /* Text */
    --text:         #f0f0f0;
    --text-2:       #c0c0c0;
    --text-3:       #a0a0a0;

    /* Accent */
    --accent:       #4f8ef7;
    --accent-dim:   rgba(79,142,247,0.15);
    --accent-glow:  rgba(79,142,247,0.3);

    /* Semantic */
    --green:        #3fb950;
    --green-dim:    rgba(63,185,80,0.15);
    --red:          #f85149;
    --red-dim:      rgba(248,81,73,0.15);
    --yellow:       #e3b341;
    --yellow-dim:   rgba(227,179,65,0.15);

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;

    /* Shape */
    --radius-sm:  4px;
    --radius:     8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-full: 9999px;

    /* Nav */
    --nav-h: 60px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }

/* ─────────────────────────────────────────────
   NAV
───────────────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    background: rgba(17,17,17,0.92);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 var(--space-5);
    gap: var(--space-4);
}

.nav-brand { flex-shrink: 0; }

.nav-logo {
    height: 50px;
    width: auto;
}

.nav-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
}

.nav-link {
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 14px;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.nav-link:hover { color: var(--text); background: var(--bg-overlay); }

.nav-logout {
    margin-left: auto;
    color: var(--text-3);
    font-size: 13px;
}

.nav-logout:hover { color: var(--red); background: var(--red-dim); }

/* ─────────────────────────────────────────────
   MAIN LAYOUT
───────────────────────────────────────────── */
.main {
    max-width: 1440px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-5);
}

@media (max-width: 600px) {
    .main { padding: var(--space-5) var(--space-4); }
}

/* ─────────────────────────────────────────────
   BUTTONS
───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 9px 18px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s, color 0.15s, opacity 0.15s, box-shadow 0.15s;
    letter-spacing: 0.01em;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 0 var(--accent-glow);
}
.btn-primary:hover {
    background: #6a9ff8;
    color: #fff;
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-overlay);
    color: var(--text);
    border: 1px solid var(--border-mid);
}
.btn-secondary:hover { background: var(--bg-elevated); border-color: var(--border-hi); }

.btn-ghost {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text); border-color: var(--border-mid); }

.btn-danger {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(248,81,73,0.25);
}
.btn-danger:hover { background: rgba(248,81,73,0.25); }

.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

/* ─────────────────────────────────────────────
   FORMS
───────────────────────────────────────────── */
.form-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 600px;
}

.form-group { margin-bottom: var(--space-5); }

label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius);
    color: var(--text);
    padding: 11px 14px;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

input[type="file"] {
    padding: 10px 14px;
    color: var(--text-2);
    cursor: pointer;
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.form-hint {
    font-size: 12px;
    color: var(--text-3);
    margin-top: var(--space-2);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.checkbox-list { display: flex; flex-direction: column; gap: var(--space-2); }

.checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
    font-size: 14px;
}

.checkbox-item:hover { border-color: var(--border-hi); }
.checkbox-item em { color: var(--text-3); font-style: normal; font-size: 12px; }

.radio-group, .radio-list { display: flex; flex-direction: column; gap: var(--space-2); }
.checkbox-group { display: flex; flex-direction: column; gap: var(--space-2); }

.radio-item,
.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 14px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
    font-size: 14px;
    line-height: 1.5;
}

.radio-item input[type="radio"],
.checkbox-item input[type="checkbox"] { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.radio-item:hover,
.checkbox-item:hover { border-color: var(--border-hi); }

.flag-count { color: var(--text-3); font-style: normal; font-size: 13px; margin-left: 4px; }

/* ─────────────────────────────────────────────
   ALERTS
───────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: var(--space-5);
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-error  { background: var(--red-dim);    border: 1px solid rgba(248,81,73,0.3);    color: #ff9d97; }
.alert-success{ background: var(--green-dim);  border: 1px solid rgba(63,185,80,0.3);    color: #7ee787; }
.alert-info   { background: var(--accent-dim); border: 1px solid rgba(79,142,247,0.3);   color: #8fbfff; }

/* ─────────────────────────────────────────────
   PAGE HEADER
───────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
    gap: var(--space-4);
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text);
}

.page-header-left {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-3);
    padding: 3px 10px;
    background: var(--bg-elevated);
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
}

.photo-count {
    font-size: 13px;
    color: var(--text-3);
}

.back-link {
    font-size: 13px;
    color: var(--text-3);
    transition: color 0.15s;
    flex-shrink: 0;
}
.back-link:hover { color: var(--text-2); }

/* ─────────────────────────────────────────────
   EMPTY STATE
───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: var(--space-8) var(--space-5);
    color: var(--text-3);
}

.empty-state p { font-size: 15px; margin-bottom: var(--space-5); }

/* ─────────────────────────────────────────────
   GALLERY LIST (homepage cards)
───────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-4);
}

@media (min-width: 768px) {
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

.gallery-card {
    display: block;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
}

.gallery-card:hover {
    border-color: var(--border-hi);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.gallery-thumb {
    aspect-ratio: 4/3;
    background: var(--bg-elevated);
    overflow: hidden;
    position: relative;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain; /*cover*/
    transition: transform 0.4s ease;
}

.gallery-card:hover .gallery-thumb img { transform: scale(1.04); }

.gallery-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    color: var(--text-3);
    letter-spacing: -2px;
    background: linear-gradient(135deg, var(--bg-elevated), var(--bg-overlay));
}

.gallery-card-info {
    padding: 14px 16px 16px;
}

.gallery-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-card-count {
    font-size: 12px;
    color: var(--text-3);
}

/* ─────────────────────────────────────────────
   FILTER BAR
───────────────────────────────────────────── */
.filter-bar {
    margin-bottom: var(--space-5);
}

.filter-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: var(--space-1);
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-mid);
    background: var(--bg-elevated);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
    white-space: nowrap;
}

.filter-chip input[type="checkbox"] { display: none; }
.filter-chip:hover { border-color: var(--border-hi); color: var(--text); background: var(--bg-overlay); }
.filter-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.filter-reset {
    font-size: 12px;
    color: var(--text-3);
    padding: 4px 8px;
    border-radius: var(--radius-full);
    transition: color 0.15s;
    margin-left: var(--space-2);
}
.filter-reset:hover { color: var(--red); }

/* ─────────────────────────────────────────────
   PHOTO GRID
───────────────────────────────────────────── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
}

@media (min-width: 480px)  { .photo-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  { .photo-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1100px) { .photo-grid { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 1400px) { .photo-grid { grid-template-columns: repeat(6, 1fr); } }
@media (min-width: 1800px) { .photo-grid { grid-template-columns: repeat(7, 1fr); } }

.photo-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    cursor: default;
}

.photo-thumb-wrap {
    aspect-ratio: 1;
    overflow: hidden;
    width: 100%;
    cursor: pointer;
}

.photo-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain; /*cover*/
    display: block;
    opacity: 0;
    transition: opacity 0.25s;
}

.photo-thumb.lazy-loaded { opacity: 1; }

/* Flag buttons — row below the image */
.photo-flags {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 2px;
    padding: 4px 4px;
    background: var(--bg-elevated);
}

.flag-btn {
    flex: 1;
    height: 26px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    background: var(--bg-overlay);
    color: rgba(255,255,255,0.35);
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.flag-btn:hover {
    background: var(--bg-overlay);
    color: #fff;
}

.flag-btn.active { background: var(--bg-overlay); }
.flag-btn[data-flag="select"].active   { color: var(--green); }
.flag-btn[data-flag="favorite"].active { color: var(--yellow); }
.flag-btn[data-flag="reject"].active   { color: var(--red); }

/* Rejected photo — dimmed, grey overlay */
.photo-rejected .photo-thumb { opacity: 0.35 !important; }
.photo-rejected::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}

/* ─────────────────────────────────────────────
   PAGINATION
───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-7) 0 var(--space-5);
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius);
    border: 1px solid var(--border-mid);
    background: var(--bg-elevated);
    color: var(--text-2);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.15s;
    font-family: inherit;
}

.page-btn:hover  { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn.disabled { opacity: 0.3; cursor: default; pointer-events: none; }

.page-ellipsis { color: var(--text-3); padding: 0 var(--space-2); font-size: 13px; }

/* ─────────────────────────────────────────────
   ACTION BAR (fixed bottom)
───────────────────────────────────────────── */
.action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(24,24,24,0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: var(--space-3) var(--space-5);
    display: none;
    align-items: center;
    justify-content: space-between;
    z-index: 200;
    gap: var(--space-4);
}

.action-bar.visible { display: flex; }

.action-bar-info {
    font-size: 14px;
    color: var(--text-2);
}

.action-bar-info #selectedCount {
    font-weight: 700;
    color: var(--text);
}

.action-bar-actions { display: flex; gap: var(--space-2); }

/* ─────────────────────────────────────────────
   DATA TABLE
───────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tbody tr {
    transition: background 0.1s;
}

.data-table tbody tr:hover td { background: var(--bg-elevated); }

.data-table .actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

.data-table .text-muted { color: var(--text-3); font-size: 12px; font-family: 'SF Mono', 'Fira Code', monospace; }
.data-table .row-disabled td { opacity: 0.45; }

/* ─────────────────────────────────────────────
   BADGES
───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.badge-green { background: var(--green-dim); color: var(--green); }
.badge-gray  { background: var(--bg-overlay); color: var(--text-3); }
.badge-blue  { background: var(--accent-dim); color: var(--accent); }
.badge-red   { background: var(--red-dim);    color: var(--red); }

/* ─────────────────────────────────────────────
   STATS GRID (admin dashboard)
───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-7);
}

.stat-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1.5px;
    color: var(--text);
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
}

.stat-link {
    font-size: 12px;
    color: var(--accent);
    margin-top: auto;
    padding-top: var(--space-3);
}

.stat-link:hover { text-decoration: underline; }

/* ─────────────────────────────────────────────
   DASHBOARD SECTIONS
───────────────────────────────────────────── */
.dashboard-section {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.section-header h2 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.view-all {
    font-size: 13px;
    color: var(--accent);
    padding: var(--space-4) var(--space-5);
    display: block;
    text-align: center;
    border-top: 1px solid var(--border);
    transition: background 0.15s;
}
.view-all:hover { background: var(--bg-elevated); }

/* ─────────────────────────────────────────────
   UPLOAD
───────────────────────────────────────────── */
.upload-section { display: flex; flex-direction: column; gap: var(--space-5); }

.upload-zone {
    border: 2px dashed var(--border-mid);
    border-radius: var(--radius-xl);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: var(--bg-raised);
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.upload-zone-inner { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }

.upload-icon {
    font-size: 48px;
    color: var(--text-3);
    line-height: 1;
    margin-bottom: var(--space-2);
}

.upload-hint {
    font-size: 15px;
    color: var(--text-2);
}

.upload-hint-small {
    font-size: 12px;
    color: var(--text-3);
}

.upload-summary {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.upload-stats {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 13px;
    flex-wrap: wrap;
}

.sep { color: var(--text-3); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.text-muted { color: var(--text-3); }

.upload-progress-bar {
    height: 4px;
    background: var(--bg-overlay);
    border-radius: var(--radius-full);
    overflow: hidden;
}

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

.upload-queue {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 360px;
    overflow-y: auto;
}

.queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-raised);
    border-radius: var(--radius);
    font-size: 13px;
    gap: var(--space-3);
}

.qi-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.qi-status { white-space: nowrap; font-size: 12px; font-weight: 500; }
.qi-pending   { color: var(--text-3); }
.qi-uploading { color: var(--accent); }
.qi-done      { color: var(--green); }
.qi-failed    { color: var(--red); }
.qi-skipped   { color: var(--text-3); font-style: italic; }

/* ─────────────────────────────────────────────
   EXPORT
───────────────────────────────────────────── */
.export-summary {
    font-size: 15px;
    color: var(--text-2);
    margin-bottom: var(--space-5);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ─────────────────────────────────────────────
   SETTINGS / LOGO
───────────────────────────────────────────── */
.logo-preview {
    margin-bottom: var(--space-5);
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-logo { max-height: 60px; max-width: 200px; }

/* ─────────────────────────────────────────────
   AUTH
───────────────────────────────────────────── */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: var(--space-5);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgba(79,142,247,0.08), transparent);
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: var(--bg-raised);
    border: 1px solid var(--border-mid);
    border-radius: var(--radius-xl);
    padding: var(--space-7) var(--space-6);
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.auth-brand {
    text-align: center;
    margin-bottom: var(--space-7);
}

.auth-logo { height: 50px; width: auto; margin: 0 auto; }
.auth-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }

.auth-heading {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-2);
    letter-spacing: -0.3px;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--text-3);
    margin-bottom: var(--space-6);
}

.auth-form { display: flex; flex-direction: column; gap: 0; }

.auth-form .form-group { margin-bottom: var(--space-4); }
.auth-form .btn-full { margin-top: var(--space-2); height: 46px; font-size: 15px; }

/* ─────────────────────────────────────────────
   ERROR PAGES
───────────────────────────────────────────── */
.error-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: var(--space-5);
}

.error-container {
    text-align: center;
    max-width: 400px;
}

.error-code {
    font-size: 96px;
    font-weight: 900;
    letter-spacing: -6px;
    color: var(--bg-overlay);
    line-height: 1;
    margin-bottom: var(--space-4);
    background: linear-gradient(180deg, var(--text-3), var(--bg-elevated));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.error-container h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: var(--space-3);
}

.error-container p {
    color: var(--text-3);
    font-size: 15px;
    margin-bottom: var(--space-6);
}

/* ─────────────────────────────────────────────
   RESPONSIVE NAV
───────────────────────────────────────────── */
@media (max-width: 600px) {
    .nav { padding: 0 var(--space-4); }
    .page-header h1 { font-size: 20px; }
    .form-card { padding: var(--space-5) var(--space-4); }
    .auth-card { padding: var(--space-6) var(--space-4); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .data-table td, .data-table th { padding: 10px 12px; }
}

/* ─────────────────────────────────────────────
   SCROLLBAR
───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ─────────────────────────────────────────────
   LIGHTBOX
───────────────────────────────────────────── */
#lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
#lightbox.lb-open { display: flex; }

.lb-backdrop {
    position: absolute;
    inset: 0;
    z-index: 0;
    background: rgba(0,0,0,0.95);
}

/* lb-content defined in lb-main section below */

.lb-img {
    max-width: 100%;
    max-height: calc(100vh - 64px);
    object-fit: contain;
    display: block;
    opacity: 1;
    transition: opacity 0.15s;
}
#lightbox.lb-loading .lb-img { opacity: 0.2; }

.lb-close {
    position: absolute;
    top: 4px;
    right: 16px;
    z-index: 2;
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 22px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    transition: color 0.15s;
}
.lb-close:hover { color: var(--text); }

/* On desktop shift close button left of the sidebar */
@media (min-width: 769px) {
    .lb-close { right: calc(280px + 12px); }
}

.lb-prev, .lb-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 32px;
    line-height: 1;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.15s;
}
.lb-prev:hover, .lb-next:hover { background: rgba(0,0,0,0.7); }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

.lb-bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 16px 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
}

.lb-counter {
    font-size: 13px;
    color: var(--text-3);
    white-space: nowrap;
}

.lb-caption {
    flex: 1;
    font-size: 13px;
    color: var(--text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-flags {
    display: flex;
    gap: var(--space-2);
}

/* Desktop: flags in sidebar, mobile flags hidden */
@media (min-width: 769px) {
    .lb-flags-mobile { display: none; }
    .lb-flags-desktop {
        padding: 10px 14px;
        border-top: 1px solid var(--border);
        justify-content: center;
    }
}

/* Mobile: sidebar flags hidden */
@media (max-width: 768px) {
    .lb-flags-desktop { display: none; }
}

.lb-flag-btn {
    font-size: 20px;
    padding: 6px 10px;
}

.photo-thumb-wrap { position: relative; }

.photo-comment-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

@media (max-width: 600px) {
    .lb-prev, .lb-next { font-size: 24px; padding: 10px 12px; }
    .lb-caption { display: none; }
}

/* ─────────────────────────────────────────────
   LIGHTBOX SIDEBAR / COMMENTS
───────────────────────────────────────────── */
.lb-main {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.lb-content {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 48px 12px 12px;
}

.lb-sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-raised);
    border-left: 1px solid var(--border);
}

.lb-sidebar-bar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.lb-download {
    margin-left: auto;
    font-size: 12px;
    color: var(--accent);
    text-decoration: none;
    white-space: nowrap;
    padding: 3px 8px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
}
.lb-download:hover { background: var(--accent); color: #fff; }

.lb-comments {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lb-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lb-no-comments, .lb-comments-loading {
    color: var(--text-3);
    font-size: 13px;
}

.lb-comment {
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    position: relative;
}

.lb-comment-author {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    margin-right: 6px;
}

.lb-comment-time {
    font-size: 11px;
    color: var(--text-3);
}

.lb-comment-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    background: none;
    border: none;
    color: var(--text-3);
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 4px;
}
.lb-comment-delete:hover { color: var(--red); }

.lb-comment-body {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.lb-comment-form {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lb-comment-input {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 8px 10px;
    font-size: 13px;
    resize: none;
    font-family: inherit;
}
.lb-comment-input:focus {
    outline: none;
    border-color: var(--accent);
}

.lb-comment-submit {
    align-self: flex-end;
}

/* On mobile: hide sidebar, show it toggled */
@media (max-width: 768px) {
    .lb-sidebar { display: none; }
    .lb-content { padding-top: 44px; }
    .lb-flag-btn { font-size: 24px; padding: 8px 12px; }
}

/* ─────────────────────────────────────────────
   GALLERY DESCRIPTION
───────────────────────────────────────────── */
.gallery-description {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-5);
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.7;
    white-space: normal;
    word-break: break-word;
}

.download-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    background: var(--bg-raised);
    border: 1px solid var(--green);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-5);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.download-bar-label {
    font-size: 14px;
    color: var(--text-2);
}

.form-optional { color: var(--text-3); font-size: 12px; font-weight: 400; }

.nav-link-home { display: flex; align-items: center; }
.nav-link-home svg { display: block; }

/* ─────────────────────────────────────────────
   LIGHTBOX MOBILE COMMENT SHEET
───────────────────────────────────────────── */
.lb-comments-toggle {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-2);
    padding: 6px 10px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
}
.lb-comments-toggle svg { display: block; }
.lb-comments-toggle:hover { color: var(--text); }

/* Hide toggle on desktop (sidebar handles comments) */
@media (min-width: 769px) {
    .lb-comments-toggle { display: none; }
}

.lb-comments-sheet {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: var(--bg-raised);
    border-top: 1px solid var(--border-mid);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    max-height: 70vh;
    flex-direction: column;
    overflow: hidden;
}
.lb-comments-sheet.lb-sheet-open { display: flex; }

.lb-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.lb-sheet-close {
    background: none;
    border: none;
    color: var(--text-3);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.lb-sheet-close:hover { color: var(--text); }

.lb-sheet-comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lb-sheet-comment-form {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
