:root {
    --bg: #141414;
    --bg-elev: #1f1f1f;
    --bg-elev-2: #2a2a2a;
    --text: #f5f5f5;
    --muted: #a0a0a0;
    --accent: #e50914;
    --accent-hover: #f6121d;
    --border: #303030;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
}

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

/* ---------- Top nav ---------- */
.topnav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4vw;
    background: linear-gradient(to bottom, rgba(0,0,0,0.85), rgba(0,0,0,0.4));
    backdrop-filter: blur(6px);
}
.brand {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--accent);
    letter-spacing: 0.5px;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 18px;
}
.nav-links a {
    color: var(--text);
    font-size: 0.95rem;
    opacity: 0.85;
}
.nav-links a:hover { opacity: 1; }
.logout-form { display: inline; margin: 0; }
.link-btn {
    background: none;
    border: none;
    color: var(--text);
    cursor: pointer;
    font-size: 0.95rem;
    opacity: 0.85;
    padding: 0;
}
.link-btn:hover { opacity: 1; }

.main { min-height: 70vh; }

/* ---------- Buttons ---------- */
.btn-primary {
    display: inline-block;
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 26px;
    font-weight: 600;
    font-size: 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    display: inline-block;
    background: rgba(255,255,255,0.1);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 22px;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(255,255,255,0.18); }

.btn-danger {
    background: #6e1014;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-danger:hover { background: #8a141a; }

/* ---------- Auth / login ---------- */
.auth-body {
    background:
        linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.85)),
        radial-gradient(circle at 30% 20%, #3a0a0e, #141414 65%);
    min-height: 100vh;
}
.auth-card {
    max-width: 360px;
    margin: 12vh auto;
    background: rgba(0, 0, 0, 0.75);
    padding: 40px 36px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}
.auth-title {
    margin: 0;
    color: var(--accent);
    font-size: 2rem;
    letter-spacing: 0.5px;
}
.auth-sub {
    margin: 6px 0 26px;
    color: var(--muted);
}
.auth-error {
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid var(--accent);
    color: #ffb8bd;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label span { font-size: 0.85rem; color: var(--muted); }
.auth-form input {
    padding: 12px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
}
.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
}
.auth-form .btn-primary { margin-top: 8px; }

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: flex-end;
    padding: 0 4vw 60px;
    background-color: #000;
    overflow: hidden;
}
.hero-empty {
    background: linear-gradient(135deg, #2a0408 0%, #141414 70%);
}
.hero-bg-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}
.hero-overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, #141414 5%, transparent 60%),
        linear-gradient(to right, rgba(20,20,20,0.85) 0%, transparent 60%);
    z-index: 1;
    pointer-events: none;
}
.hero-inner {
    position: relative;
    max-width: 600px;
    z-index: 2;
}
.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    margin: 0 0 10px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.7);
}
.hero-meta {
    color: var(--muted);
    margin: 0 0 12px;
    font-size: 0.9rem;
}
.hero-desc {
    font-size: 1.05rem;
    margin: 0 0 22px;
    text-shadow: 0 1px 6px rgba(0,0,0,0.7);
}
.hero-cta { padding: 14px 32px; }

/* ---------- Rows ---------- */
.row {
    padding: 26px 4vw 10px;
}
.row-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 12px;
}
.row-track {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding: 6px 0 16px;
    -webkit-overflow-scrolling: touch;
}
.row-track::-webkit-scrollbar { height: 8px; }
.row-track::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

.card {
    flex: 0 0 auto;
    width: 260px;
    aspect-ratio: 16 / 9;
    background: var(--bg-elev);
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    scroll-snap-align: start;
    transition: transform 0.18s ease;
    cursor: pointer;
}
.card:hover { transform: scale(1.04); z-index: 2; box-shadow: var(--shadow); }
.card img { width: 100%; height: 100%; object-fit: cover; }
.card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3a0a0e, #1f1f1f);
    font-size: 4rem;
    font-weight: 800;
    color: rgba(255,255,255,0.6);
}
.card-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 10px 12px;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
}
.card-title {
    font-weight: 600;
    font-size: 0.95rem;
}

/* ---------- Admin shell ---------- */
.admin-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 4vw 60px;
}
.admin-header h1 {
    margin: 0;
    font-size: 2rem;
}
.admin-header .muted { color: var(--muted); margin-top: 4px; }
.muted { color: var(--muted); }

.admin-tiles {
    margin-top: 28px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}
.tile {
    background: var(--bg-elev);
    padding: 24px;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: transform 0.15s, border-color 0.15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.tile h2 { margin: 0 0 6px; font-size: 1.2rem; }
.tile p { margin: 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Admin tables ---------- */
.admin-section {
    margin-top: 32px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 22px;
}
.admin-section h2 {
    margin: 0 0 16px;
    font-size: 1.2rem;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
}
.admin-table th, .admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}
.admin-table th {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.admin-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 8px; }

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}
.form-row label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--muted);
}
.form-row input, .form-row textarea, .form-row select {
    padding: 8px 12px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    min-width: 220px;
    font-family: inherit;
}
.form-row textarea { min-width: 320px; min-height: 60px; resize: vertical; }
.form-row input:focus, .form-row textarea:focus, .form-row select:focus {
    outline: none;
    border-color: var(--accent);
}

.crumbs {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }

.flash {
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid var(--accent);
    color: #ffb8bd;
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.flash.ok {
    background: rgba(0, 160, 80, 0.15);
    border-color: #2a9d5f;
    color: #b8f0cd;
}

/* Sortable.js helpers */
.sortable-ghost { opacity: 0.4; }
.sortable-handle { cursor: grab; user-select: none; }
.sortable-handle:active { cursor: grabbing; }

/* ---------- Album page ---------- */
.album-header {
    padding: 30px 4vw 16px;
}
.album-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    margin: 0 0 6px;
}
.album-meta {
    color: var(--muted);
    margin: 0 0 12px;
    font-size: 0.95rem;
}
.album-desc {
    max-width: 800px;
    margin: 0 0 14px;
    color: #d8d8d8;
}
.media-grid {
    padding: 10px 4vw 60px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}
.media-tile {
    aspect-ratio: 1 / 1;
    background: var(--bg-elev);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s;
}
.media-tile:hover { transform: scale(1.02); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; }
.media-tile.video::after {
    content: "▶";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.4rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    pointer-events: none;
}

/* ---------- Lightbox ---------- */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.96);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.lightbox.open { display: flex; }
.lightbox-stage {
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-stage img,
.lightbox-stage video {
    max-width: 96vw;
    max-height: 92vh;
    object-fit: contain;
}
.lightbox-close, .lightbox-prev, .lightbox-next {
    position: absolute;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover { background: rgba(0,0,0,0.85); }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--muted);
    font-size: 0.85rem;
    background: rgba(0,0,0,0.5);
    padding: 4px 12px;
    border-radius: 12px;
}

/* ---------- Login intro (full-screen video) ---------- */
.intro-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.intro-overlay[hidden] { display: none; }

.intro-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.intro-skip {
    position: absolute;
    bottom: 26px;
    right: 26px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    z-index: 10;
    opacity: 0.7;
    transition: opacity 0.15s, background 0.15s;
}
.intro-skip:hover { opacity: 1; background: rgba(255,255,255,0.18); }

/* ---------- Upload form ---------- */
.uploader {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    background: var(--bg-elev-2);
    transition: border-color 0.15s, background 0.15s;
}
.uploader.dragover { border-color: var(--accent); background: rgba(229,9,20,0.08); }
.uploader input[type=file] { display: none; }
.upload-progress {
    margin-top: 14px;
    height: 6px;
    background: var(--bg-elev);
    border-radius: 3px;
    overflow: hidden;
    display: none;
}
.upload-progress.active { display: block; }
.upload-progress > div {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.2s;
}
