/* ============================================================
   RDFILM — Main Stylesheet  (matches RDFILM.html artifact)
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

a { text-decoration: none; color: inherit; }

/* ── Design tokens ──────────────────────────────────────── */
:root {
    /* Core palette */
    --black:        #000000;
    --black-deep:   #050505;
    --black-card:   #0c0c0c;
    --black-hover:  #141414;
    --black-border: #1e1e1e;
    --yellow:       #FED104;
    --yellow-glow:  rgba(254, 209, 4, 0.18);
    --yellow-dim:   rgba(254, 209, 4, 0.06);
    --white:        #ffffff;
    --white-80:     rgba(255, 255, 255, 0.80);
    --white-40:     rgba(255, 255, 255, 0.40);
    --white-15:     rgba(255, 255, 255, 0.08);

    /* Typography */
    --font-display: 'Orbitron', 'Segoe UI', sans-serif;
    --font-body:    'Inter', 'Segoe UI', sans-serif;

    /* Layout */
    --sidebar-w: 220px;

    /* Semantic aliases */
    --bg:      var(--black);
    --surface: var(--black-card);
    --border:  var(--black-border);
    --text:    var(--white-80);
    --muted:   var(--white-40);
    --accent:  var(--yellow);

    color-scheme: dark;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    min-height: 100%;
    overflow-x: hidden;
}

/* ── Ambient background ─────────────────────────────────── */
.ambient {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.ambient-orb {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--yellow-dim) 0%, transparent 68%);
}

.ambient-orb-1 {
    width: 640px;
    height: 640px;
    top: -160px;
    right: -80px;
    animation: orb-drift 14s ease-in-out infinite alternate;
}

.ambient-orb-2 {
    width: 380px;
    height: 380px;
    bottom: 60px;
    left: 40px;
    opacity: 0.5;
    animation: orb-drift 20s ease-in-out infinite alternate-reverse;
}

@keyframes orb-drift {
    from { transform: translate(0, 0); }
    to   { transform: translate(24px, 18px); }
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--black);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0 0 20px;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar { display: none; }

/* Logo */
.sidebar-logo {
    display: flex;
    align-items: center;
    padding: 26px 22px 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}

.logo-text {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1;
}

.logo-rd {
    color: var(--yellow);
    text-shadow: 0 0 18px rgba(254, 209, 4, 0.55);
}

.logo-film {
    background: var(--yellow);
    color: #0a0800;
    padding: 1px 6px 2px;
    border-radius: 3px;
    margin-left: 2px;
    font-size: 18px;
    box-shadow: 0 0 14px rgba(254, 209, 4, 0.35);
    -webkit-text-stroke: 0.5px rgba(0, 0, 0, 0.2);
}

/* Nav section wrapper */
.sidebar-section {
    padding: 0 10px;
    margin-bottom: 4px;
}

.sidebar-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(254, 209, 4, 0.28);
    padding: 10px 12px 6px;
}

/* Nav links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--white-40);
    transition: background 0.15s, color 0.15s;
}

.nav-link i {
    font-size: 12.5px;
    width: 15px;
    text-align: center;
    color: rgba(254, 209, 4, 0.25);
    transition: color 0.15s;
}

.nav-link:hover {
    background: var(--white-15);
    color: rgba(255, 255, 255, 0.72);
}

.nav-link:hover i { color: rgba(254, 209, 4, 0.55); }

.nav-link.active {
    background: rgba(254, 209, 4, 0.08);
    color: var(--white);
    font-weight: 600;
}

.nav-link.active i { color: var(--yellow); }

/* Divider */
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 10px;
}

/* Footer mark */
.sidebar-mark {
    margin-top: auto;
    padding: 20px 22px 6px;
    display: flex;
    justify-content: center;
}

.hourglass-icon {
    width: 22px;
    height: 22px;
    background: rgba(254, 209, 4, 0.12);
    clip-path: polygon(0 0, 100% 0, 50% 50%, 100% 100%, 0 100%, 50% 50%);
}

/* ── Hamburger (mobile) ──────────────────────────────────── */
.hamburger {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 300;
    background: var(--black);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 8px 10px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--white-40);
    border-radius: 2px;
    transition: background 0.2s;
}

.hamburger:hover span { background: var(--yellow); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 190;
}

.sidebar-overlay.active { display: block; }

/* ── Page wrapper ───────────────────────────────────────── */
.page-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 100;
    background: rgba(0, 0, 0, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.search-toggle {
    background: none;
    border: none;
    color: rgba(254, 209, 4, 0.45);
    font-size: 15px;
    cursor: pointer;
    padding: 7px 9px;
    border-radius: 7px;
    transition: color 0.15s, background 0.15s;
    display: flex;
    align-items: center;
}

.search-toggle:hover {
    color: var(--yellow);
    background: rgba(254, 209, 4, 0.08);
}

.topbar-search {
    display: flex;
    align-items: center;
    background: #0d0d0d;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 10px 7px 14px;
    gap: 8px;
    width: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: width 0.26s ease, opacity 0.2s ease, border-color 0.2s;
}

.topbar-search.open {
    width: 300px;
    opacity: 1;
    pointer-events: all;
}

.topbar-search:focus-within {
    border-color: rgba(254, 209, 4, 0.35);
    box-shadow: 0 0 0 3px rgba(254, 209, 4, 0.06);
}

.topbar-search input {
    background: transparent;
    border: none;
    outline: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    font-family: var(--font-body);
    width: 100%;
    min-width: 0;
}

.topbar-search input::placeholder { color: rgba(254, 209, 4, 0.22); }

.search-close {
    background: none;
    border: none;
    color: rgba(254, 209, 4, 0.3);
    font-size: 13px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.search-close:hover { color: var(--yellow); }

/* ── Main content ───────────────────────────────────────── */
.content-container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 36px 28px 60px;
    padding-left: max(28px, env(safe-area-inset-left, 0px));
    padding-right: max(28px, env(safe-area-inset-right, 0px));
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.section-bar {
    width: 3px;
    height: 22px;
    background: var(--yellow);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(254, 209, 4, 0.5);
    flex-shrink: 0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
    letter-spacing: 0.2px;
}

/* ── Media grid ─────────────────────────────────────────── */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 22px;
}

/* Card */
.media-card {
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    display: block;
    position: relative;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.media-card:hover {
    border-color: rgba(254, 209, 4, 0.35);
    box-shadow: 0 0 0 1px rgba(254, 209, 4, 0.12), 0 8px 32px rgba(0, 0, 0, 0.55);
    transform: translateY(-2px);
}

.media-card:focus-visible {
    outline: 2px solid var(--yellow);
    outline-offset: 2px;
}

/* Poster */
.card-poster {
    position: relative;
    height: 172px;
    background-size: cover;
    background-position: center top;
    background-color: #101010;
    overflow: hidden;
}

.card-poster::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.45) 0%, transparent 55%);
    pointer-events: none;
}

/* Play overlay */
.play-overlay {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    transition: background 0.22s;
}

.play-overlay i {
    font-size: 44px;
    color: transparent;
    filter: drop-shadow(0 2px 12px rgba(254, 209, 4, 0.8));
    transition: color 0.22s, transform 0.22s;
}

.media-card:hover .play-overlay { background: rgba(0, 0, 0, 0.4); }

.media-card:hover .play-overlay i {
    color: rgba(255, 255, 255, 0.94);
    transform: scale(1.08);
}

/* No-image fallback */
.card-poster.no-img {
    background: linear-gradient(145deg, #111 0%, #080808 100%);
}

.poster-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.12;
}

.poster-placeholder i {
    font-size: 40px;
    color: var(--yellow);
}

/* Badge */
.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 4;
    background: var(--yellow);
    color: #0a0800;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.6px;
    padding: 3px 7px;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(254, 209, 4, 0.45);
    text-transform: uppercase;
}

/* Rating */
.rating {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    background: rgba(0, 0, 0, 0.78);
    color: #FFD700;
    font-size: 11.5px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid rgba(255, 215, 0, 0.22);
    backdrop-filter: blur(4px);
}

.rating i { font-size: 9px; }

/* Episode count */
.ep-count {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 4;
    background: rgba(0, 0, 0, 0.72);
    color: rgba(255, 220, 80, 0.95);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(254, 209, 4, 0.18);
    backdrop-filter: blur(4px);
}

.ep-count i { font-size: 9px; color: var(--yellow); }

/* Card info */
.card-info {
    padding: 14px 16px 16px;
    background: linear-gradient(to bottom, var(--black-card), #070707);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title {
    font-size: 14.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.88);
    letter-spacing: 0.15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-sub {
    font-size: 11.5px;
    color: rgba(254, 209, 4, 0.5);
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* No results */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(254, 209, 4, 0.3);
    padding: 64px 20px;
    font-size: 15px;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.24s ease;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 6px 0 28px rgba(0, 0, 0, 0.7);
    }

    .hamburger { display: flex; }
    .page-wrapper { margin-left: 0; }
    .topbar { padding: 8px 14px 8px 60px; }
    .topbar-search.open { width: calc(100vw - 130px); }

    .content-container {
        padding: 24px 16px 48px;
    }

    .media-grid {
        gap: 16px;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 480px) {
    .media-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .card-poster { height: 200px; }

    .card-title {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    .card-sub {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }
}

/* ── Sidebar: Show More / Less button ───────────────────── */
.sidebar-show-more {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    margin-top: 4px;
    background: none;
    border: none;
    border-radius: 7px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: rgba(254, 209, 4, 0.35);
    cursor: pointer;
    text-align: left;
    font-family: var(--font-body);
    transition: color 0.15s, background 0.15s;
}

.sidebar-show-more:hover {
    color: rgba(254, 209, 4, 0.72);
    background: var(--yellow-dim);
}

.sidebar-show-more i {
    font-size: 10px;
    transition: transform 0.22s ease;
}

/* ── Badge colour variants ──────────────────────────────── */
.badge.cam {
    background: #e53935;
    color: #fff;
    box-shadow: 0 2px 10px rgba(229, 57, 53, 0.50);
}

.badge.k4 {
    background: #1565c0;
    color: #fff;
    box-shadow: 0 2px 10px rgba(21, 101, 192, 0.50);
}

/* ── Home sections ──────────────────────────────────────── */
.home-section + .home-section {
    margin-top: 52px;
}

/* View-all / Show-more button */
.view-all-wrap {
    display: flex;
    justify-content: center;
    margin-top: 26px;
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 26px;
    border-radius: 8px;
    background: rgba(254, 209, 4, 0.04);
    border: 1px solid rgba(254, 209, 4, 0.16);
    color: rgba(255, 255, 255, 0.52);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.2px;
    text-decoration: none;
    transition: background 0.18s, color 0.18s, border-color 0.18s, transform 0.18s;
}

.view-all-btn:hover {
    background: rgba(254, 209, 4, 0.10);
    border-color: rgba(254, 209, 4, 0.36);
    color: var(--yellow);
    transform: translateY(-1px);
}

.view-all-btn > i:first-child {
    font-size: 12px;
    opacity: 0.70;
}

.view-all-arrow {
    font-size: 10px !important;
    opacity: 0.40;
    transition: transform 0.18s;
}

.view-all-btn:hover .view-all-arrow {
    transform: translateX(3px);
}

.view-all-extra {
    color: rgba(254, 209, 4, 0.42);
    font-size: 12px;
    font-weight: 500;
}

/* ── Pagination ─────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 44px;
    flex-wrap: wrap;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.42);
    background: var(--black-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
    user-select: none;
}

.page-btn:not(.disabled):not(.active):hover {
    background: var(--black-hover);
    color: rgba(255, 255, 255, 0.82);
    border-color: rgba(254, 209, 4, 0.22);
    transform: translateY(-1px);
}

.page-btn.active {
    background: rgba(254, 209, 4, 0.10);
    color: var(--yellow);
    border-color: rgba(254, 209, 4, 0.36);
    cursor: default;
    pointer-events: none;
}

.page-btn.disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.page-arrow { font-size: 11px; }

.page-ellipsis {
    color: rgba(255, 255, 255, 0.20);
    font-size: 13px;
    padding: 0 2px;
    align-self: center;
    user-select: none;
    line-height: 38px;
}

/* Responsive pagination */
@media (max-width: 480px) {
    .page-btn {
        min-width: 34px;
        height: 34px;
        font-size: 12px;
        padding: 0 9px;
    }
}
