/* Page background */
body.series-page {
    --page-main-bg-size: 100% auto;
    --page-main-bg-position: center 7%;
    --page-main-bg-mobile-size: contain;
    --page-main-bg-mobile-position: top center;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

/* ========== HERO ========== */
/* Match home hero size (home.css) and tuck ~20px under the fixed header */
.series-page .hero-section {
    position: relative;
    overflow: hidden;
    background: #0a0a0a;
    margin-top: calc(var(--navbar-h, 50px) - 20px);
}

.hero-section .carousel-indicators {
    display: none;
}

/* Mute button: above the genres bar (bottom-right) */
.series-page .hero-mute-btn {
    bottom: 6rem;
    top: auto;
    right: 1.25rem;
}

/* ========== GENRES ========== */
.genres-shell--hero-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 4;
    padding: 1rem 1rem 0.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75) 0%, transparent 100%);
    pointer-events: none;
}

.genres-shell--hero-bottom .genres-shell__inner {
    max-width: 100%;
    margin: 0 auto;
    text-align: left;
    pointer-events: auto;
    padding: 0;
}

.genres-shell--hero-bottom .genres-head {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.45rem;
}

.genres-shell--hero-bottom .genres-section__title {
    margin: 0rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    text-align: left;
}

.genres-shell--hero-bottom .genres-view-all-link {
    margin: 0;
    flex: 0 0 auto;
    font-size: 0.92rem;
    white-space: nowrap;
}

.genres-shell--hero-bottom .genres-slider {
    position: relative;
    max-width: 100%;
}

/* Same shell treatment as home hero `.hero-section .movie-detail-thumbs` (no thumbnails). */
.genres-carousel-shell {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    background: rgba(0, 0, 0, .35);
    border-radius: 10px;
    padding: 5px 28px;
    backdrop-filter: blur(6px);
}

.genres-shell--hero-bottom .genres-track {
    position: relative;
    flex: 1;
    min-width: 0;
    /* `overflow-x: hidden` + `visible` on the other axis forces vertical clipping in browsers. */
    overflow: visible;
    max-width: 100%;
    width: 100%;
    scrollbar-width: none !important;
    /* Widen clip vertically so dock hover (scale from bottom) paints above the bar; horizontal stays tight. */
    -webkit-clip-path: inset(-76px 0 -36px 0);
    clip-path: inset(-76px 0 -36px 0);
}

.genres-shell--hero-bottom .genres-track::-webkit-scrollbar {
    display: none;
}

.genres-shell--hero-bottom .genres-track__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    width: 100%;
    /* top padding gives buttons room to grow upward without clipping */
    padding: 0.5rem;
    align-items: flex-end;
    /* allow scaled children to overflow the track visually */
    overflow: visible;
}

/* ─── Genre button base ──────────────────────────────────────────── */
.genre-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.15rem;
    border-radius: var(--border-radius, 8px);
    background: linear-gradient(180deg, #6b4b9e 0%, #8b5a8e 35%, #c96b5c 70%, var(--infuse-orange, #ff8d1c) 100%);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: capitalize;
    text-decoration: none;
    white-space: nowrap;
    border: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);

    /* transform anchor: grow from the bottom (dock behaviour) */
    transform-origin: bottom center;
    transform: scale(1);

    /* default transition — JS overrides this inline during hover,
       then restores it once the spring-back animation completes  */
    transition:
        transform 0.18s cubic-bezier(0.34, 1.4, 0.64, 1),
        box-shadow 0.18s ease,
        filter 0.18s ease;

    user-select: none;
    -webkit-user-drag: none;
    will-change: transform, filter;
    position: relative;
    z-index: 1;
}

/* ─── macOS Dock CSS fallback states (set via [data-dock] attribute) ─
   These are used as a CSS-only fallback / by any existing series.js
   logic that sets data-dock-d attributes.  The smooth JS animation
   in the blade script uses inline styles which always win over these,
   so there is zero conflict.
   ─────────────────────────────────────────────────────────────────── */

/* all buttons dim when the dock container is active */
.genres-track__inner[data-dock] .genre-btn {
    transform: scale(0.9);
    filter: brightness(0.7);
}

/* d0 = the button directly under the cursor */
.genres-track__inner[data-dock] .genre-btn[data-dock-d="0"] {
    transform: scale(1.5);
    filter: brightness(1.1);
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.6);
    z-index: 10;
}

/* d1 = immediate neighbours */
.genres-track__inner[data-dock] .genre-btn[data-dock-d="1"] {
    transform: scale(1.25);
    filter: brightness(0.95);
    z-index: 9;
}

/* d2 = second neighbours */
.genres-track__inner[data-dock] .genre-btn[data-dock-d="2"] {
    transform: scale(1.1);
    filter: brightness(0.85);
    z-index: 8;
}

/* Genre prev/next — sit in side padding, vertically centered on the chip row */
.series-page .genres-carousel-shell .hero-thumb-nav {
    position: absolute;
    top: 50%;
    bottom: auto;
    width: 24px;
    height: auto;
    z-index: 6;
    color: #fff;
    font-size: 1rem;
    line-height: 1;
    opacity: 1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    padding: 0;
}

.series-page .genres-carousel-shell .hero-thumb-nav i {
    display: block;
    line-height: 1;
    margin: 0;
}

.series-page .genres-carousel-shell .hero-thumb-nav--prev {
    left: 0;
}

.series-page .genres-carousel-shell .hero-thumb-nav--next {
    right: 0;
}

.series-page .genres-carousel-shell .hero-thumb-nav:hover {
    color: var(--infuse-orange, #ff8d1c);
}

.series-page .genres-carousel-shell .hero-thumb-nav:disabled {
    opacity: 0.45;
    cursor: default;
    color: rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

.series-page .genres-carousel-shell .hero-thumb-nav:disabled:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* ── Tablet / mobile: compact genres (MUST follow base .genre-btn) ── */
@media (max-width: 991.98px) {
    .series-page .hero-mute-btn {
        bottom: 3.85rem;
        top: auto;
        right: 0.75rem;
        width: 1.85rem;
        height: 1.85rem;
        font-size: 0.8rem;
    }

    .genres-shell--hero-bottom {
        padding: 0.4rem 0.7rem 0.4rem;
    }

    .genres-shell--hero-bottom .genres-head {
        gap: 0.45rem;
        margin-bottom: 0.22rem;
    }

    .genres-shell--hero-bottom .genres-section__title {
        font-size: 0.95rem;
        font-weight: 700;
        letter-spacing: -.01em;
    }

    .genres-shell--hero-bottom .genres-view-all-link {
        font-size: 0.68rem;
    }

    .genres-carousel-shell {
        padding: 2px 26px;
        border-radius: 7px;
        max-width: 100%;
        box-sizing: border-box;
    }

    .series-page .genres-carousel-shell .hero-thumb-nav {
        width: 24px;
        font-size: 1rem;
    }

    .genres-shell--hero-bottom .genres-track {
        display: flex;
        align-items: center;
        -webkit-clip-path: inset(-12px 0 -8px 0);
        clip-path: inset(-12px 0 -8px 0);
    }

    .genres-shell--hero-bottom .genres-track__inner {
        padding: 0.15rem 0.2rem;
        gap: 0.35rem;
        align-items: center;
    }

    .genre-btn {
        padding: 0.3rem 0.68rem;
        font-size: 0.76rem;
        border-radius: 5px;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.28);
        transform: none;
        will-change: auto;
    }
}

@media (max-width: 767.98px) {
    .series-page .hero-mute-btn {
        bottom: 3.55rem;
        right: 0.55rem;
        width: 1.55rem;
        height: 1.55rem;
        font-size: 0.7rem;
        border-width: 1.5px;
    }

    .genres-shell--hero-bottom {
        padding: 0.32rem 0.55rem 0.32rem;
    }

    .genres-shell--hero-bottom .genres-head {
        gap: 0.35rem;
        margin-bottom: 0.16rem;
    }

    .genres-shell--hero-bottom .genres-section__title {
        font-size: 0.88rem;
        margin-bottom: 0;
    }

    .genres-shell--hero-bottom .genres-view-all-link {
        font-size: 0.62rem;
    }

    .genres-carousel-shell {
        padding: 2px 24px;
        border-radius: 6px;
    }

    .series-page .genres-carousel-shell .hero-thumb-nav {
        width: 22px;
        font-size: 0.95rem;
    }

    .genres-shell--hero-bottom .genres-track__inner {
        padding: 0.12rem 0.18rem;
        gap: 0.32rem;
    }

    .genre-btn {
        padding: 0.26rem 0.58rem;
        font-size: 0.7rem;
        border-radius: 4px;
        line-height: 1.2;
    }
}

@media (max-width: 575.98px) {
    .series-page .hero-mute-btn {
        bottom: 3.35rem;
        right: 0.45rem;
        width: 1.4rem;
        height: 1.4rem;
        font-size: 0.65rem;
    }

    .genres-shell--hero-bottom {
        padding: 0.28rem 0.45rem 0.28rem;
    }

    .genres-shell--hero-bottom .genres-section__title {
        font-size: 0.82rem;
    }

    .genres-shell--hero-bottom .genres-view-all-link {
        font-size: 0.58rem;
    }

    .genres-carousel-shell {
        padding: 2px 22px;
    }

    .series-page .genres-carousel-shell .hero-thumb-nav {
        width: 20px;
        font-size: 0.9rem;
    }

    .genres-shell--hero-bottom .genres-track__inner {
        gap: 0.26rem;
    }

    .genre-btn {
        padding: 0.22rem 0.5rem;
        font-size: 0.66rem;
        border-radius: 4px;
    }
}

/* ========== FILM DETAIL PANEL — scrollbar hidden ========== */
/* hero-detail-panel styles come from home.css; just ensure scrollbar is hidden */
#heroDetailPanel .hero-detail-panel__body::-webkit-scrollbar {
    display: none;
}


/* ========== VIEW MORE MODAL — initial load spinner ========== */
.view-more-modal__initial-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    width: 100%;
}

.view-more-modal__initial-loader.is-hidden {
    display: none;
}

.view-more-modal__initial-spinner {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--infuse-orange, #ff8d1c);
    animation: catalog-spin 0.8s linear infinite;
    display: block;
}



/* Keep skeleton cards fully visible and shimmering during initial AJAX load */
.catalog-slider.is-loading-initial .catalog-item--skeleton {
    opacity: 1;
    transform: none;
    animation: none;
}

/* Shimmer keeps running on the pseudo-elements — just ensure the blocks stay visible */
.catalog-slider.is-loading-initial .catalog-item--skeleton .poster-wrap,
.catalog-slider.is-loading-initial .catalog-item--skeleton .media-title {
    opacity: 1;
}

/* "Load more" state: dim the track slightly so the tail loader stands out */
.catalog-slider.is-loading-more .catalog-track {
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

/* Stagger the fade-in of real cards as they replace skeletons */
.catalog-item--animate:nth-child(1) {
    transition-delay: 0.00s;
}

.catalog-item--animate:nth-child(2) {
    transition-delay: 0.04s;
}

.catalog-item--animate:nth-child(3) {
    transition-delay: 0.08s;
}

.catalog-item--animate:nth-child(4) {
    transition-delay: 0.12s;
}

.catalog-item--animate:nth-child(5) {
    transition-delay: 0.16s;
}

.catalog-item--animate:nth-child(6) {
    transition-delay: 0.20s;
}

.catalog-item--animate:nth-child(7) {
    transition-delay: 0.24s;
}

.catalog-item--animate:nth-child(8) {
    transition-delay: 0.28s;
}

.catalog-item--animate:nth-child(9) {
    transition-delay: 0.32s;
}

.catalog-item--animate:nth-child(10) {
    transition-delay: 0.36s;
}

.catalog-item--animate:nth-child(n+11) {
    transition-delay: 0.40s;
}

.genre-page {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

.genre-section {
    /* Clear the fixed header so titles sit fully below the navbar on all viewports */
    padding-top: calc(var(--navbar-h, 64px) + 1.75rem);
    padding-bottom: 3rem;
    position: relative;
}

.genre-section__title {
    margin: 0 0 1.5rem;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
}

/* Initial page load: centered spinner */
.genre-initial-loader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.5);
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.genre-initial-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.genre-initial-loader__spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.25);
    border-top-color: var(--infuse-orange, #ff8d1c);
    animation: catalog-spin 0.8s linear infinite;
}

.genre-initial-loader__text {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.genre-catalog {
    position: relative;
}

.genre-catalog.is-loading .genre-catalog__body {
    opacity: 0;
    pointer-events: none;
}

.genre-catalog__body {
    overflow: visible;
    max-height: none;
    padding: 0;
    transition: opacity 0.2s ease;
}

.genre-catalog__grid {
    display: grid;
    grid-template-columns: repeat(
        auto-fill,
        minmax(min(100%, 178px), 1fr)
    );
    gap: 14px;
    align-content: start;
    justify-content: start;
    justify-items: stretch;
    width: 100%;
}

.genre-catalog__grid .catalog-item {
    width: auto;
    max-width: none;
    min-width: 0;
}

.genre-catalog__load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    padding: 1rem 0 1.5rem;
    min-height: 4rem;
}

.genre-catalog__loader,
.genre-catalog__end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    font-weight: 600;
}

.genre-catalog__loader.is-hidden,
.genre-catalog__end.is-hidden {
    display: none;
}

.genre-catalog__spinner {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.28);
    border-top-color: var(--infuse-orange, #ff8d1c);
    animation: catalog-spin 0.8s linear infinite;
}

.genre-catalog__end {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 767.98px) {
    .genre-catalog__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        justify-content: start;
    }

    .genre-catalog__load-more {
        margin-top: 1rem;
    }
}
