/* ── Netflix-style global theme ── */
:root {
    --nf-red: #e50914;
    --nf-red-hover: #f40612;
    --nf-bg: #141414;
    --nf-surface: #1f1f1f;
    --nf-surface2: #2a2a2a;
    --nf-border: #333;
    --nf-text: #e5e5e5;
    --nf-muted: #a3a3a3;
    --nf-white: #ffffff;
}

* { box-sizing: border-box; }

body {
    background: var(--nf-bg);
    color: var(--nf-text);
    font-family: 'Netflix Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
}

/* ── Navbar ── */
.nf-navbar {
    background: linear-gradient(to bottom, rgba(0,0,0,0.9) 0%, transparent 100%);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.nf-brand {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--nf-red) !important;
    text-decoration: none;
    letter-spacing: -1px;
    text-transform: uppercase;
}

.nf-nav-links { display: flex; gap: 0.5rem; align-items: center; }

/* ── Buttons ── */
.btn-nf-primary {
    background: var(--nf-red);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    display: inline-block;
}
.btn-nf-primary:hover { background: var(--nf-red-hover); color: #fff; }

.btn-nf-ghost {
    background: transparent;
    color: var(--nf-text);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 4px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    text-decoration: none;
    display: inline-block;
}
.btn-nf-ghost:hover { border-color: #fff; color: #fff; }

.btn-nf-active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 4px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.btn-nf-icon {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s;
    flex-shrink: 0;
}
.btn-nf-icon:hover { background: rgba(255,255,255,0.3); }

/* ── Page container ── */
.nf-container { max-width: 1400px; margin: 0 auto; padding: 2rem 2rem 4rem; }

/* ── Section heading ── */
.nf-section-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--nf-white);
    margin-bottom: 1.25rem;
}

/* ── Cards grid ── */
.nf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
}

/* ── Card ── */
.nf-card {
    position: relative;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background: var(--nf-surface);
    transition: transform 0.2s ease, z-index 0s;
    aspect-ratio: 2/3;
}
.nf-card:hover { transform: scale(1.05); z-index: 10; }
.nf-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.nf-card-no-poster {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nf-surface2);
    color: var(--nf-muted);
    font-size: 0.8rem;
    text-align: center;
    padding: 1rem;
}

/* Overlay shown on hover */
.nf-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.75rem;
}
.nf-card:hover .nf-card-overlay { opacity: 1; }

.nf-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.2rem;
    line-height: 1.2;
}
.nf-card-meta {
    font-size: 0.72rem;
    color: var(--nf-muted);
    margin-bottom: 0.5rem;
}
.nf-card-genres {
    font-size: 0.7rem;
    color: #aaa;
    margin-bottom: 0.5rem;
}
.nf-card-plot {
    font-size: 0.72rem;
    color: #ccc;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nf-card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.nf-card-actions .btn-nf-primary,
.nf-card-actions .btn-nf-ghost { padding: 0.25rem 0.6rem; font-size: 0.72rem; }

/* Badge */
.nf-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    color: #ccc;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}
.nf-badge-red { background: var(--nf-red); color: #fff; }

/* ── Search bar ── */
.nf-search-wrap { margin-bottom: 2rem; }
.nf-search-input {
    width: 100%;
    background: var(--nf-surface2);
    border: 1px solid var(--nf-border);
    color: var(--nf-white);
    padding: 0.75rem 1rem;
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s;
}
.nf-search-input:focus { border-color: var(--nf-white); }
.nf-search-input::placeholder { color: var(--nf-muted); }
.nf-search-group { display: flex; }
.nf-search-group .btn-nf-primary { border-radius: 0 4px 4px 0; padding: 0.75rem 1.5rem; font-size: 1rem; }

/* ── Empty state ── */
.nf-empty { text-align: center; padding: 5rem 2rem; color: var(--nf-muted); }
.nf-empty h4 { color: var(--nf-text); font-size: 1.3rem; }

/* ── Alert ── */
.nf-alert {
    background: var(--nf-surface2);
    border: 1px solid #e5a000;
    color: #e5c84a;
    border-radius: 4px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}
.nf-alert a { color: #e5c84a; font-weight: 600; }

/* ── Accordion (episodes) ── */
.nf-accordion { display: flex; flex-direction: column; gap: 0.5rem; }
.nf-accordion-item { background: var(--nf-surface); border-radius: 4px; overflow: hidden; }

.nf-accordion-header {
    width: 100%;
    background: var(--nf-surface2);
    border: none;
    color: var(--nf-text);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    transition: background 0.15s;
}
.nf-accordion-header:hover { background: #383838; }
.nf-accordion-header .nf-season-label { flex: 1; }
.nf-accordion-header .nf-season-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: #2d6a2d;
    color: #7be87b;
}
.nf-accordion-header .nf-chevron { margin-left: auto; transition: transform 0.2s; font-size: 0.8rem; color: var(--nf-muted); }
.nf-accordion-header[aria-expanded="true"] .nf-chevron { transform: rotate(180deg); }

.nf-accordion-body { display: none; }
.nf-accordion-body.open { display: block; }

/* Episode rows */
.nf-episode {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--nf-border);
    gap: 1rem;
    transition: background 0.15s;
}
.nf-episode:hover { background: rgba(255,255,255,0.04); }
.nf-episode.watched { opacity: 0.55; }
.nf-episode-num { color: var(--nf-muted); font-size: 0.9rem; min-width: 2rem; text-align: right; }
.nf-episode-info { flex: 1; }
.nf-episode-title { font-weight: 600; font-size: 0.9rem; color: var(--nf-white); }
.nf-episode-plot { font-size: 0.78rem; color: var(--nf-muted); margin-top: 0.2rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.nf-episode-action { flex-shrink: 0; }
.nf-check-btn {
    background: none;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: border-color 0.15s, background 0.15s;
}
.nf-check-btn:hover { border-color: #fff; }
.nf-check-btn.checked { border-color: #46d369; background: #46d369; color: #fff; }

/* ── Back link ── */
.nf-back { color: var(--nf-muted); text-decoration: none; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 1.5rem; }
.nf-back:hover { color: var(--nf-white); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #0a0a0a; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

/* ── Mobile & Responsive ── */
@media (max-width: 600px) {
    .nf-navbar {
        padding: 0.6rem 1rem;
        background: rgba(0,0,0,0.95);
    }

    .nf-brand { font-size: 1.2rem; }

    .nf-nav-links { gap: 0.35rem; }

    .btn-nf-primary,
    .btn-nf-ghost,
    .btn-nf-active {
        padding: 0.3rem 0.6rem;
        font-size: 0.78rem;
    }

    .nf-container { padding: 1rem 0.75rem 3rem; }

    .nf-section-title { font-size: 1.1rem; }

    /* Smaller cards on mobile — 2 per row */
    .nf-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    /* Always show overlay on mobile (no hover) */
    .nf-card-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.2) 55%, transparent 100%);
    }

    .nf-card:hover { transform: none; }

    .nf-card-title { font-size: 0.78rem; }
    .nf-card-meta  { font-size: 0.68rem; margin-bottom: 0.3rem; }
    .nf-card-genres { display: none; }

    .nf-card-actions { gap: 0.3rem; }
    .nf-card-actions .btn-nf-primary,
    .nf-card-actions .btn-nf-ghost { padding: 0.2rem 0.45rem; font-size: 0.68rem; }

    .btn-nf-icon { width: 26px; height: 26px; font-size: 0.8rem; }

    /* Search */
    .nf-search-group { flex-direction: column; gap: 0.5rem; }
    .nf-search-input { border-radius: 4px; }
    .nf-search-group .btn-nf-primary { border-radius: 4px; width: 100%; padding: 0.7rem 1rem; }

    /* Episodes accordion */
    .nf-accordion-header { padding: 0.75rem 1rem; font-size: 0.9rem; }
    .nf-episode { padding: 0.65rem 1rem; gap: 0.6rem; }
    .nf-episode-num { min-width: 1.5rem; font-size: 0.82rem; }
    .nf-episode-title { font-size: 0.82rem; }
    .nf-episode-plot { display: none; }

    /* Empty state */
    .nf-empty { padding: 3rem 1rem; }
    .nf-empty h4 { font-size: 1.1rem; }
}

@media (min-width: 601px) and (max-width: 900px) {
    .nf-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .nf-container { padding: 1.5rem 1.25rem 4rem; }
}

/* Touch devices — always show overlay */
@media (max-width: 380px) {
    .nf-nav-links .btn-nf-ghost span,
    .nf-nav-links .btn-nf-primary span { display: none; }

    .nf-grid { grid-template-columns: repeat(2, 1fr); gap: 0.3rem; }

    .nf-navbar { padding: 0.5rem 0.75rem; }
    .nf-brand { font-size: 1rem; }
}

/* Touch devices — always show overlay */
@media (hover: none) {
    .nf-card-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.2) 55%, transparent 100%);
    }
    .nf-card:hover { transform: none; }
}

/* ── Detail page ── */
.nf-detail-hero {
    position: relative;
    min-height: 520px;
    display: flex;
    align-items: flex-end;
    padding: 3rem 2rem 2.5rem;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
}
.nf-detail-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0,0,0,0.85) 40%, transparent 100%),
                linear-gradient(to top, rgba(20,20,20,1) 0%, transparent 30%);
}
.nf-detail-hero-content {
    position: relative;
    max-width: 600px;
}
.nf-detail-title {
    font-size: clamp(1.8rem, 5vw, 3.2rem);
    font-weight: 900;
    color: #fff;
    line-height: 1.1;
    margin-bottom: 0.75rem;
}
.nf-detail-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--nf-muted);
}
.nf-detail-rating {
    color: #f5c518;
    font-weight: 700;
    font-size: 1rem;
}
.nf-detail-plot {
    font-size: 1rem;
    color: #d4d4d4;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    max-width: 560px;
}
.nf-detail-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.nf-detail-actions .btn-nf-primary { padding: 0.6rem 1.5rem; font-size: 0.95rem; }
.nf-detail-actions .btn-nf-ghost  { padding: 0.6rem 1.5rem; font-size: 0.95rem; }

.nf-detail-body {
    padding: 2rem 2rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
}
.nf-detail-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 3rem;
    align-items: start;
}
.nf-detail-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--nf-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.4rem;
}
.nf-detail-section-value {
    font-size: 0.95rem;
    color: var(--nf-text);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.nf-detail-section-value a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.nf-pill {
    display: inline-block;
    border: 1px solid var(--nf-border);
    border-radius: 20px;
    padding: 0.2rem 0.7rem;
    font-size: 0.8rem;
    color: var(--nf-muted);
    margin: 0.15rem;
}
.nf-detail-poster {
    border-radius: 6px;
    width: 100%;
    aspect-ratio: 2/3;
    object-fit: cover;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.nf-detail-poster-placeholder {
    border-radius: 6px;
    width: 100%;
    aspect-ratio: 2/3;
    background: var(--nf-surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nf-muted);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .nf-detail-hero { min-height: 340px; padding: 2rem 1rem 1.5rem; }
    .nf-detail-body { padding: 1.5rem 1rem 3rem; }
    .nf-detail-grid { grid-template-columns: 1fr; gap: 1.5rem; }
    .nf-detail-grid .nf-detail-sidebar { display: none; }
    .nf-detail-plot { font-size: 0.9rem; }
    .nf-detail-actions .btn-nf-primary,
    .nf-detail-actions .btn-nf-ghost { padding: 0.5rem 1rem; font-size: 0.85rem; }
}


