/* =============================================================
   AnimeX — Component Styles
   Search Bar · Pagination · Search Result Header · Scroll
   ============================================================= */

/* ── Search Bar (Header + Mobile Panel) ─────────────────────── */
#searchBarContainer {
    position: relative;
    width: 100%;
}

/* Shared search icon wrap for both desktop & mobile panel */
#searchBarContainer .search-icon-wrap,
#mobileSearchPanel    .search-icon-wrap {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
    display: flex;
    align-items: center;
}

#searchBarContainer .search-icon-wrap svg,
#mobileSearchPanel    .search-icon-wrap svg {
    width: 16px;
    height: 16px;
}

/* Desktop search input */
#searchInput,
#mobileSearchInput {
    width: 100% !important;
    background-color: #13141c !important;
    color: #e5e7eb !important;
    padding: 9px 60px 9px 38px !important;
    border-radius: 9999px !important;
    border: 1px solid #1f2133 !important;
    font-size: 0.8125rem !important;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color 0.2s ease !important;
    line-height: 1.5 !important;
}

#searchInput::placeholder,
#mobileSearchInput::placeholder { color: #4b5570 !important; }

#searchInput:focus,
#mobileSearchInput:focus {
    border-color: #2d2f45 !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Mobile panel form must be position:relative for absolute children */
#mobileSearchPanel form {
    position: relative !important;
    width: 100% !important;
}

#searchSubmitBtn,
#mobileSearchSubmitBtn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #b9090b, #E50914);
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 32px;
    padding: 0 14px;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 10px rgba(229, 9, 20, 0.35);
}

#searchSubmitBtn:hover,
#mobileSearchSubmitBtn:hover {
    background: linear-gradient(135deg, #990000, #b9090b);
    box-shadow: 0 4px 16px rgba(229, 9, 20, 0.55);
    transform: translateY(-50%) scale(1.04);
}

#searchSubmitBtn:active,
#mobileSearchSubmitBtn:active {
    transform: translateY(-50%) scale(0.97);
    box-shadow: 0 1px 6px rgba(229, 9, 20, 0.3);
}

/* ── Mobile Search Panel ─────────────────────────────────── */
#mobileSearchPanel {
    animation: mobileSearchSlideDown 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes mobileSearchSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}



/* ── Pagination ─────────────────────────────────────────────── */
.animex-pagination {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE/Edge */
    max-width: 100%;
    min-width: 0;
    /* Card-style wrapper */
    background-color: #131522;
    border: 1px solid #1f2133;
    padding: 0.625rem;            /* 10px */
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
}

.animex-pagination::-webkit-scrollbar { display: none; } /* Chrome/Safari */

.animex-pagination .page-numbers {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    background-color: var(--bg-card);
    color: #9ca3af;
    border: 1px solid var(--border-base);
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}

.animex-pagination a.page-numbers:hover,
.animex-pagination a.page-numbers:active,
.animex-pagination .page-numbers.current {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    text-decoration: none;
}

.animex-pagination .next.page-numbers,
.animex-pagination .prev.page-numbers { padding: 0 1rem; }

/* Disabled prev/next (first page or last page) */
.animex-pagination .prev.page-numbers[aria-disabled="true"],
.animex-pagination .next.page-numbers[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.animex-pagination .dots.page-numbers {
    background: transparent;
    border: none;
    color: #6b7280;
}

/* ── Pagination: wrapper visibility (Desktop vs Mobile) ─────── */
.animex-pagination--desktop {
    display: flex;
    justify-content: center;
    padding: 0 1rem;
    margin-top: 3.5rem;
}

.animex-pagination--mobile {
    display: none;
    justify-content: center;
    padding: 0 1rem;
    margin-top: 3.5rem;
}

@media (max-width: 768px) {
    .animex-pagination--desktop {
        display: none;
    }

    .animex-pagination--mobile {
        display: flex;
    }
}

/* ── Pagination: mobile info (e.g. 5/7) ─────────────────────── */
.animex-pagination__info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    padding: 0 0.5rem;
    pointer-events: none;
    background: transparent;
    border: none;
    flex-shrink: 0;
}

.animex-pagination__info-sep {
    color: #6b7280;
    margin: 0 2px;
    font-weight: 500;
}

.animex-pagination__info-total {
    color: #9ca3af;
}

/* ── Search Result Header ────────────────────────────────────── */
.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1.25rem 1.5rem;
    background-color: #0e0f1a;
    border: 1px solid #1a1c2e;
    border-radius: 0.75rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.search-result-header__left {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.search-result-header__title-wrap {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.search-result-header__bar {
    width: 4px;
    height: 2.2rem;
    background: var(--primary);
    border-radius: 9999px;
    flex-shrink: 0;
}

.search-result-header__title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 0.01em;
    margin: 0;
    line-height: 1.3;
}

.search-result-header__title span { color: var(--primary); }

.search-result-header__count {
    font-size: 0.8125rem;
    color: #6b7280;
    font-weight: 400;
    margin: 0;
}

.search-result-header__count strong {
    color: #a0aec0;
    font-weight: 600;
}

/* ── Seasons Horizontal Scroll — Hide Scrollbar ─────────────── */
#seasonsContainer::-webkit-scrollbar { display: none; }

/* ── Video Player — Play Button ─────────────────────────────── */
.video-player__play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    /* transform একবারই সেট — hover-এ override করা হবে না */
    transform: translate(-50%, -50%);
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
    cursor: pointer;
    z-index: 10;
    /* position-স্থির রেখে শুধু SVG scale হবে */
    will-change: auto;
}

/* হোভারেও translate ঠিক রাখা — scale SVG-তে, button-এ না */
.video-player__play-btn:hover,
.video-player__play-btn:focus,
.video-player__play-btn:active {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: inherit !important;
    /* position একটুও সরবে না */
    transform: translate(-50%, -50%) !important;
}

/* হোভারে শুধু SVG বড় হবে — button নড়বে না */
.video-player__play-btn:hover .video-player__play-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 28px rgba(229, 9, 20, 0.75));
}

.video-player__play-icon {
    width: 80px;
    height: 80px;
    display: block;
    transition: transform 0.2s ease, filter 0.2s ease;
    filter: drop-shadow(0 0 20px rgba(229, 9, 20, 0.6));
}

/* Outer static ring — theme red tint */
.video-player__play-icon circle:first-child {
    stroke: rgba(229, 9, 20, 0.35) !important;
}

/* Animated spinning ring — theme red */
.video-player__play-ring {
    stroke: var(--primary);
    stroke-width: 2;
    stroke-dasharray: 245;
    stroke-dashoffset: 80;
    stroke-linecap: round;
    transform-origin: center;
    animation: playRingSpin 2s linear infinite;
}

/* Play triangle — white with red glow */
.video-player__play-icon path {
    fill: #fff !important;
    filter: drop-shadow(0 0 6px rgba(229, 9, 20, 0.8));
}

@keyframes playRingSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ── Episode Buttons (Rule #1 — CSS handles state, not JS) ─── */
.episode-btn {
    background: var(--bg-card);
    color: var(--text-muted);
    border-color: var(--border-base);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.episode-btn:hover:not(.is-active) {
    background: #23263f;
    color: #fff;
    border-color: #374151;
}

.episode-btn.is-active {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.45);
}

/* ── Watched Episode State (Rule #1 — CSS only, JS toggles class) ── */
.episode-btn.is-watched {
    background: rgba(16, 185, 129, 0.12);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
    position: relative;
}

/* Small checkmark dot at top-right corner */
.episode-btn.is-watched::after {
    content: '';
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.7);
}

/* Active + Watched: active state wins visually, but keep dot */
.episode-btn.is-active.is-watched {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(229, 9, 20, 0.45);
}

.episode-btn.is-active.is-watched::after {
    background: #a7f3d0;
    box-shadow: 0 0 4px rgba(167, 243, 208, 0.8);
}

.episode-btn.is-watched:hover:not(.is-active) {
    background: rgba(16, 185, 129, 0.22);
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.5);
}

/* ── Server Buttons (Rule #1 — CSS handles state, not JS) ────── */
.server-btn {
    background: var(--bg-card);
    color: var(--text-muted);
    border-color: var(--border-base);
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.server-btn:hover:not(.is-active) {
    background: #23263f;
    color: #fff;
    border-color: #374151;
}

.server-btn.is-active {
    background: var(--primary-dark);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

/* ── Mobile Drawer Nav Links (Rule #7 — CSS :hover, no JS events) */
.animex-drawer-link {
    display: block;
    padding: 10px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    color: #9ca3af;
    transition: background-color 0.2s, color 0.2s;
}

.animex-drawer-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    text-decoration: none;
}

.animex-drawer-link--active {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-left: 3px solid #7c3aed;
    font-weight: 600;
}

.animex-drawer-link--active:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
}

/* ── Custom Select Dropdown ─────────────────────────────────── */
/* Use explicit hex values — CSS vars are unreliable on native <select> elements */
.animex-select {
    background-color: #1a1c2d !important;
    color: #9ca3af !important;
    border: 1px solid #1f2937 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.animex-select:hover {
    color: #ffffff !important;
    border-color: #E50914 !important;
}

.animex-select:focus {
    border-color: #E50914 !important;
    box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.25) !important;
    outline: none !important;
}

/* Option items — explicit dark colors for cross-browser consistency */
.animex-select option {
    background-color: #131522 !important;
    color: #e5e7eb !important;
}

/* Selected option highlight — explicit primary red */
.animex-select option:checked {
    background-color: #b9090b !important;
    color: #ffffff !important;
}

/* ── Season Number Overlay (More Seasons cards) ─────────────── */
.season-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        rgba(12, 13, 20, 0.72) 0%,
        rgba(124, 58, 237, 0.12) 100%
    );
    transition: background 0.35s ease;
}

/* The big glitch number */
.season-overlay__number {
    position: relative;
    font-size: clamp(3.5rem, 10vw, 6rem);
    font-weight: 900;
    line-height: 1;
    color: transparent;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 60%, var(--primary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    letter-spacing: -0.04em;
    filter: drop-shadow(0 0 18px rgba(229, 9, 20, 0.55));
    transition: filter 0.35s ease, transform 0.35s ease;
}
.season-overlay__number::before {
    content: attr(data-sn);
    position: absolute;
    top: 0;
    left: 3px;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    z-index: -1;
    animation: sn-glitch-1 3s infinite linear alternate-reverse;
}

/* Ghost glitch layer 2 */
.season-overlay__number::after {
    content: attr(data-sn);
    position: absolute;
    top: 0;
    left: -3px;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    z-index: -1;
    animation: sn-glitch-2 3.8s infinite linear alternate-reverse;
}

@keyframes sn-glitch-1 {
    0%   { clip-path: inset(25% 0 60% 0); transform: translate(-3px, 0); }
    25%  { clip-path: inset(55% 0 15% 0); transform: translate(3px, 0); }
    50%  { clip-path: inset(35% 0 45% 0); transform: translate(-2px, 0); }
    75%  { clip-path: inset(70% 0 10% 0); transform: translate(3px, 0); }
    100% { clip-path: inset(15% 0 65% 0); transform: translate(-3px, 0); }
}

@keyframes sn-glitch-2 {
    0%   { clip-path: inset(10% 0 55% 0); transform: translate(3px, 0); }
    25%  { clip-path: inset(40% 0 25% 0); transform: translate(-3px, 0); }
    50%  { clip-path: inset(65% 0 20% 0); transform: translate(2px, 0); }
    75%  { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 0); }
    100% { clip-path: inset(50% 0 15% 0); transform: translate(3px, 0); }
}

/* ── Video Player (Click-to-Play Pattern) ───────────────────── */
.video-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #000;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #1f2937;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-player__thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.video-player__play-btn {
    position: absolute;
    z-index: 20;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    transition: transform 0.2s ease, opacity 0.3s ease;
}

.video-player__play-btn:hover {
    transform: scale(1.1);
}

.video-player__play-icon {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
}

.video-player__play-ring {
    fill: rgba(0, 0, 0, 0.5);
    transition: fill 0.2s ease;
}

.video-player__play-btn:hover .video-player__play-ring {
    fill: rgba(124, 58, 237, 0.8); /* Primary color */
}

.video-player__iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    z-index: 30;
    background-color: #000;
}

/* Hide elements when playing */
.video-player.is-playing .video-player__thumbnail,
.video-player.is-playing .video-player__play-btn {
    display: none;
}

/* ── Screenshots Gallery ────────────────────────────────────── */
.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (min-width: 768px) {
    .screenshots-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}



.screenshots-grid__item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background-color: #1a1c2d;
    border: 1px solid #1f2937;
}

.screenshots-grid__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.screenshots-grid__item:hover img {
    transform: scale(1.05);
}

/* Remove overlay */

/* ── Per-Language Dub Availability Progress Bars ───────────── */
/* Rule #2: BEM naming | Rule #3: CSS vars | Rule #9: opacity/transform only */
.lang-dub-section {
    max-width: 420px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(31, 41, 55, 0.6);
}

.lang-dub-section__list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}


.lang-dub-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lang-dub-row__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lang-dub-row__name {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-main);       /* Rule #3: was hardcoded #e5e7eb */
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.lang-dub-row__meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-dub-row__count {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);      /* Rule #3: was hardcoded #6b7280 */
    white-space: nowrap;
}

.lang-dub-row__badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    /* colour set inline from PHP — dynamic per-language value */
}

/* Progress track */
.lang-dub-row__track {
    position: relative;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 999px;
    overflow: hidden;
}

/* Progress fill — width & background set inline by PHP */
/* Rule #9: animate only opacity (no filter/width animation) */
.lang-dub-row__fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    border-radius: 999px;
    opacity: 1;
    animation: dub-bar-pulse 3s ease-in-out infinite; /* opacity only */
}

/* Rule #9 compliant — opacity animation, no layout trigger */
@keyframes dub-bar-pulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.75; }
    100% { opacity: 1; }
}

.lang-dub-section__label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);      /* Rule #3 */
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

/* ── Custom Tag Groups (Homepage Movies/Series) ───────────── */
.custom-btn-groups {
    width: 100%;
    margin-bottom: 1rem;
}

.btn-group-label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    gap: 0.5rem;
    text-transform: uppercase;
}

/* Gradient lines before and after the label */
.btn-group-label::before,
.btn-group-label::after {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, #E50914);
}
.btn-group-label::after {
    background: linear-gradient(270deg, transparent, #E50914);
}

.btn-group-label svg {
    color: #E50914;
}

.btn-group-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.c-tag-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #d81b1b;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.02em;
}

.c-tag-btn:hover {
    background-color: #b91515;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(229, 9, 20, 0.3);
}

.c-tag-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(229, 9, 20, 0.3);
}

/* ── Responsive: Mobile (≤480px) ─────────────────────────── */
@media (max-width: 480px) {
    .custom-btn-groups {
        margin-bottom: 0.5rem;
    }

    .btn-group-label {
        font-size: 0.78rem;
        gap: 0.35rem;
        margin-bottom: 0.6rem;
    }

    .btn-group-label::before,
    .btn-group-label::after {
        width: 24px;
    }

    .btn-group-label svg {
        width: 14px;
        height: 14px;
    }

    .btn-group-row {
        gap: 0.4rem;
    }

    .c-tag-btn {
        font-size: 0.7rem;
        padding: 0.35rem 0.65rem;
        border-radius: 4px;
        letter-spacing: 0.01em;
    }
}

/* ── Responsive: Tablet (481px – 768px) ──────────────────── */
@media (min-width: 481px) and (max-width: 768px) {
    .btn-group-label {
        font-size: 0.88rem;
        gap: 0.4rem;
        margin-bottom: 0.75rem;
    }

    .btn-group-label::before,
    .btn-group-label::after {
        width: 30px;
    }

    .btn-group-label svg {
        width: 15px;
        height: 15px;
    }

    .btn-group-row {
        gap: 0.55rem;
    }

    .c-tag-btn {
        font-size: 0.78rem;
        padding: 0.42rem 0.85rem;
    }
}

/* ── Anime Card Below-Image Title ───────────────────────────
   Rule: CSS-only truncation (no JS). Animate only opacity/transform.
   BEM: .anime-card__title
   ─────────────────────────────────────────────────────────── */
.anime-card__title {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0.45rem 0.25rem 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #d1d5db;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
    transition: color 0.2s ease;
}

.anime-card:hover .anime-card__title {
    color: #ffffff;
}

/* ── Navigation Submenus (Desktop & Mobile) ──────────────────── */

/* Desktop Submenu (Hover Triggered) */
@media (min-width: 1024px) {
    #desktopHeader nav ul li {
        position: relative;
    }

    #desktopHeader nav ul li .sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 190px;
        background-color: #0d0d0d;
        border: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 8px;
        padding: 8px 0;
        margin-top: 4px;
        opacity: 0;
        visibility: hidden;
        transform: translateY(8px);
        transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
        z-index: 50;
        display: flex;
        flex-direction: column;
        list-style: none;
    }

    #desktopHeader nav ul li:hover > .sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    #desktopHeader nav ul li .sub-menu li {
        padding: 0 8px;
    }

    /* Submenu links style */
    #desktopHeader nav ul li .sub-menu li a {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
        color: #9ca3af;
        font-size: 0.9rem;
        font-weight: 500;
        border-radius: 6px;
        transition: background-color 0.2s ease, color 0.2s ease;
        text-decoration: none;
    }

    #desktopHeader nav ul li .sub-menu li a:hover {
        color: #ffffff;
        background-color: rgba(255, 255, 255, 0.06);
    }

    /* Deep nested submenus (Level 3+) */
    #desktopHeader nav ul li .sub-menu .sub-menu {
        top: 0;
        left: 100%;
        margin-top: 0;
        margin-left: 4px;
    }

    /* Carets for items with children */
    #desktopHeader nav ul li.menu-item-has-children > a::after {
        content: '';
        display: inline-block;
        width: 14px;
        height: 14px;
        margin-left: 2px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        vertical-align: middle;
        transition: transform 0.2s ease;
    }
    
    #desktopHeader nav ul li.menu-item-has-children:hover > a::after {
        transform: rotate(180deg);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ffffff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    }

    /* Submenu carets point right */
    #desktopHeader nav ul li .sub-menu li.menu-item-has-children > a::after {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
        margin-left: auto;
    }
    #desktopHeader nav ul li .sub-menu li.menu-item-has-children:hover > a::after {
        transform: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ffffff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M9 5l7 7-7 7'/%3E%3C/svg%3E");
    }
}

/* Mobile Submenu (Indented List) */
@media (max-width: 1023px) {
    #mobileMenu nav ul li .sub-menu {
        display: none; /* Hide by default */
        flex-direction: column;
        gap: 2px;
        padding-left: 16px;
        margin-top: 4px;
        margin-bottom: 6px;
        border-left: 1px solid rgba(255, 255, 255, 0.05);
        list-style: none;
    }

    #mobileMenu nav ul li.is-open > .sub-menu {
        display: flex; /* Show when open */
    }

    #mobileMenu nav ul li .sub-menu li a {
        display: block;
        padding: 8px 12px;
        color: #9ca3af;
        font-size: 0.85rem;
        font-weight: 500;
        border-radius: 6px;
        text-decoration: none;
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    #mobileMenu nav ul li .sub-menu li a:hover {
        color: #ffffff;
        background-color: rgba(255, 255, 255, 0.04);
    }

    /* Mobile Carets for items with children */
    #mobileMenu nav ul li.menu-item-has-children > a {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    #mobileMenu nav ul li.menu-item-has-children > a::after {
        content: '';
        display: inline-block;
        width: 14px;
        height: 14px;
        margin-left: 2px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239ca3af'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        transition: transform 0.2s ease;
    }
    
    #mobileMenu nav ul li.menu-item-has-children.is-open > a::after {
        transform: rotate(180deg);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23ffffff'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    }
}

/* ==========================================================================
   TMDB Screenshots & Cast (BEM)
   ========================================================================== */

/* TMDB Screenshots Grid */
.screenshots-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .screenshots-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .screenshots-grid--tmdb {
        grid-template-columns: repeat(4, 1fr);
    }
}

.screenshots-grid__item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background-color: #111;
}

.screenshots-grid__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.screenshots-grid__item:hover img {
    transform: scale(1.05);
}

/* Image Modal */
.image-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.image-modal__overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.9);
    cursor: zoom-out;
}

.image-modal__content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    z-index: 2;
}

.image-modal__content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.image-modal.is-open .image-modal__content img {
    transform: scale(1);
}

.image-modal__close {
    position: absolute;
    top: -40px;
    right: -10px;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 8px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.image-modal__close:hover {
    opacity: 1;
}

@media (min-width: 768px) {
    .image-modal__close {
        right: -40px;
    }
}

/* TMDB Cast Carousel */
.tmdb-cast__list {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.tmdb-cast__item:hover .tmdb-cast__avatar-wrap img {
    transform: scale(1.1);
}

.tmdb-cast__avatar-wrap img {
    transition: transform 0.3s ease;
}
