/* New Best Cinema — responsive (mobile & tablet) */

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.body {
    overflow-x: hidden;
}

/* Safe area (encoches iPhone) */
@supports (padding: env(safe-area-inset-top)) {
    .nbc-header {
        padding-top: env(safe-area-inset-top);
    }
    body.body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* ========== HEADER ========== */
.nbc-header__inner {
    position: relative;
}

.nbc-header .nbc-mobile-toggle {
    display: none;
    position: relative;
    top: auto;
    right: auto;
    margin: 0 0 0 8px;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    opacity: 1;
}

.nbc-nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--nbc-header-h);
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s;
}

.nbc-nav-backdrop.is-visible {
    display: block;
    opacity: 1;
}

body.nbc-menu-open {
    overflow: hidden;
}

/* Cartes : hover desktop uniquement */
@media (hover: hover) and (pointer: fine) {
    .nbc-card:hover { transform: scale(1.08); z-index: 10; }
    .nbc-card:hover .nbc-card__overlay { opacity: 1; }
}

@media (hover: none) {
    .nbc-card__overlay {
        opacity: 1;
        background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 0%, transparent 55%);
    }
    .nbc-card:active { transform: scale(0.97); }
}

.nbc-row__track {
    -webkit-overflow-scrolling: touch;
    scroll-padding-left: 4%;
    padding-right: 4%;
}

/* ========== TABLET (≤ 1199px) ========== */
@media (max-width: 1199px) {
    .nbc-header__inner { gap: 16px; }
    .nbc-nav { gap: 14px; }
    .nbc-nav-link { font-size: 13px; }
}

@media (min-width: 992px) {
    .nbc-header .nbc-mobile-toggle { display: none !important; }
}

/* ========== MOBILE MENU (≤ 991px) ========== */
@media (max-width: 991px) {
    :root { --nbc-header-h: 56px; }

    .nbc-logo { font-size: 1.35rem; letter-spacing: 1px; }

    .nbc-header__inner {
        gap: 8px;
        padding: 0 16px;
    }

    .nbc-header .nbc-mobile-toggle { display: flex; align-items: center; justify-content: center; }

    .nbc-nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        position: fixed;
        top: var(--nbc-header-h);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--nbc-nav-mobile-bg, var(--nbc-bg));
        padding: 24px 16px;
        gap: 0;
        z-index: 999;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nbc-nav.nbc-nav--open { display: flex !important; }

    .nbc-nav-link {
        font-size: 16px;
        padding: 16px 0;
        border-bottom: 1px solid var(--nbc-border);
        opacity: 1;
    }

    .nbc-nav-link:last-child { border-bottom: none; }

    .nbc-header__right { gap: 4px; }

    .nbc-icon-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nbc-btn-signin {
        padding: 8px 14px;
        font-size: 13px;
    }

    .nbc-avatar-caret { display: none; }

    .nbc-dropdown {
        position: fixed;
        top: calc(var(--nbc-header-h) + 8px);
        left: 16px;
        right: 16px;
        min-width: 0;
    }

    .nbc-search-panel { padding: 12px 16px; }

    .nbc-search-form input { font-size: 16px; }

    /* Hero */
    .nbc-hero {
        height: 65vh;
        min-height: 340px;
        margin-bottom: -40px;
    }

    .nbc-hero__content {
        left: 16px;
        right: 16px;
        max-width: none;
        bottom: 18%;
    }

    .nbc-hero__desc {
        font-size: 0.95rem;
        -webkit-line-clamp: 2;
        margin-bottom: 16px;
    }

    .nbc-hero__actions { gap: 8px; }

    .nbc-btn-play,
    .nbc-btn-info {
        font-size: 15px;
        padding: 10px 20px;
        min-height: 44px;
    }

    /* Rows */
    .nbc-row { padding-left: 16px; margin-bottom: 28px; }
    .nbc-row__title { font-size: 1.1rem; }
    .nbc-rows { padding-bottom: 40px; }

    /* Detail */
    .nbc-detail-hero {
        min-height: 38vh;
        padding-top: calc(var(--nbc-header-h) + 12px);
        padding-bottom: 12px;
    }

    .nbc-detail-page {
        padding-top: 4px;
    }

    .nbc-detail-title { font-size: clamp(1.5rem, 6vw, 2rem); }

    .nbc-detail-meta span {
        display: inline-block;
        margin: 0 10px 0 0;
        font-size: 14px;
    }

    .nbc-episode {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nbc-episode__num { font-size: 18px; }

    /* Profile */
    .nbc-profile {
        padding: 24px 16px 60px;
    }

    .nbc-profile__title { font-size: 1.5rem; margin-bottom: 20px; }

    .nbc-profile__card { padding: 20px 16px; }

    .nbc-profile__row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 14px 0;
    }

    .nbc-auth {
        align-items: flex-start;
        padding-top: calc(var(--nbc-header-h) + 16px);
        padding-bottom: calc(var(--nbc-bottom-nav-h) + 24px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nbc-auth-card.sign__form {
        padding: 24px 18px;
    }

    /* Footer */
    /* Bootstrap containers in SPA views — géré par nbc-netflix.css (--nbc-gutter-x) */
}

/* ========== SMALL PHONES (≤ 575px) ========== */
@media (max-width: 575px) {
    .nbc-auth {
        padding-left: 12px;
        padding-right: 12px;
    }

    .nbc-auth-title {
        font-size: 1.35rem;
    }

    .nbc-hero { height: 58vh; min-height: 300px; }

    .nbc-hero__title { font-size: 1.75rem; }

    .nbc-hero__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .nbc-hero__actions .nbc-btn-play,
    .nbc-hero__actions .nbc-btn-info {
        justify-content: center;
        width: 100%;
    }

    .nbc-card { width: 130px; }
    .nbc-card--wide { width: 200px; }

    .nbc-detail-hero .nbc-hero__actions {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ========== LANDSCAPE PHONE ========== */
@media (max-width: 991px) and (orientation: landscape) {
    .nbc-hero {
        height: 100vh;
        min-height: 280px;
        max-height: none;
    }

    .nbc-hero__content { bottom: 12%; }
}

/* ========== DETAIL PAGES — MOBILE FIRST ========== */
@media (max-width: 991px) {
    .nbc-detail-hero {
        align-items: flex-end;
        padding-bottom: 28px;
    }

    .nbc-detail-hero::before {
        background: rgba(0, 0, 0, 0.38);
    }

    .nbc-detail-hero::after {
        background: var(--nbc-grad-detail-mobile);
    }

    .nbc-detail-hero--series,
    .nbc-detail-hero--short {
        min-height: 42vh;
    }

    .nbc-detail-meta--series {
        display: flex;
        flex-wrap: wrap;
        gap: 6px 10px;
        line-height: 1.4;
    }

    .nbc-detail-meta--series span {
        margin-right: 0;
    }

    .nbc-hero__actions--detail {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        max-width: 100%;
    }

    .nbc-hero__actions--detail .nbc-btn-play,
    .nbc-hero__actions--detail .nbc-btn-info {
        width: 100%;
        justify-content: center;
        font-size: 16px;
        padding: 12px 20px;
    }

    .nbc-hero__actions--detail .nbc-price--hero {
        align-self: flex-start;
        text-align: center;
        width: auto;
    }

    .nbc-detail-block {
        padding: 10px 0;
    }

    .nbc-section-title {
        font-size: 1.15rem;
    }

    .nbc-series-episodes__head {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 2px !important;
    }

    .nbc-series-stats {
        font-size: 13px;
    }

    .nbc-season-tabs.nbc-tabs-scroll {
        padding-right: 4px;
        margin-bottom: 6px;
    }

    .nbc-season-tab {
        padding: 10px 18px;
        font-size: 15px;
    }

    /* Épisodes — liste horizontale type Netflix */
    .nbc-ep-grid {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .nbc-ep-card {
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
        background: transparent;
        border-radius: 0;
        border-bottom: 1px solid #2a2a2a;
        padding: 10px 0;
        min-height: 44px;
    }

    .nbc-ep-card:last-child { border-bottom: none; }

    .nbc-ep-card:hover {
        transform: none;
        box-shadow: none;
    }

    .nbc-ep-card__thumb-wrap {
        width: 112px;
        min-width: 112px;
        aspect-ratio: 16 / 9;
        border-radius: 4px;
        overflow: hidden;
    }

    .nbc-ep-card__body {
        padding: 0;
        flex: 1;
        min-width: 0;
    }

    .nbc-ep-card__head {
        flex-wrap: wrap;
        gap: 6px;
    }

    .nbc-ep-card__title {
        font-size: 14px;
        flex: 1;
        min-width: 0;
    }

    .nbc-ep-card__meta {
        font-size: 12px;
        margin-top: 4px;
    }

    .nbc-ep-card__desc {
        font-size: 12px;
        -webkit-line-clamp: 2;
        margin-top: 6px;
    }

    .nbc-ep-badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Catalogue */
    .nbc-catalog-tabs.nbc-tabs-scroll {
        mask-image: linear-gradient(90deg, #000 90%, transparent 100%);
    }

    .nbc-catalog-tab {
        padding: 10px 18px;
        font-size: 15px;
    }

    .nbc-catalog-head {
        padding: 6px 0 4px;
    }

    .nbc-catalog-head__row {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: baseline;
        gap: 6px 10px;
        margin-bottom: 8px;
    }

    .nbc-catalog-head__title {
        font-size: 1.25rem;
        margin: 0;
        width: 100%;
    }

    .nbc-catalog-head__sub {
        font-size: 13px;
        flex: 1;
        min-width: 0;
    }

    .nbc-catalog-count {
        margin: 0;
        font-size: 12px;
    }

    .nbc-catalog-toolbar {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 6px;
        margin-bottom: 8px;
    }

    .nbc-catalog-search {
        flex: 1;
        min-width: 0;
        min-height: 38px;
        padding: 0 8px;
    }

    .nbc-catalog-search .icon {
        font-size: 16px;
    }

    .nbc-catalog-search input {
        padding: 7px 0;
        font-size: 16px;
    }

    .nbc-view-toggle {
        width: auto;
        flex-shrink: 0;
        padding: 2px;
    }

    .nbc-view-toggle__btn {
        flex: unset;
        min-width: 36px;
        padding: 6px 8px;
        min-height: 32px;
    }

    .nbc-view-toggle__label {
        display: none !important;
    }

    .nbc-catalog-grid:not(.nbc-catalog-grid--list) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nbc-synopsis-section .nbc-detail-synopsis {
        font-size: 15px;
        line-height: 1.55;
    }

    .nbc-credit-card {
        padding: 12px 10px;
    }

    .nbc-credit-card__name {
        font-size: 13px;
    }
}

@media (hover: none) {
    .nbc-ep-card__play {
        opacity: 1;
        font-size: 32px;
        background: rgba(0, 0, 0, 0.3);
    }

    .nbc-ep-card:active {
        opacity: 0.85;
    }

    .nbc-season-tab:active,
    .nbc-catalog-tab:active {
        transform: scale(0.97);
    }
}

@media (max-width: 575px) {
    .nbc-detail-title {
        font-size: clamp(1.35rem, 7vw, 1.75rem);
        margin-bottom: 8px;
    }

    .nbc-detail-hero {
        padding-top: calc(var(--nbc-header-h) + 12px);
        padding-bottom: 16px;
    }

    .nbc-ep-card__thumb-wrap {
        width: 100px;
        min-width: 100px;
    }

    .nbc-catalog-grid:not(.nbc-catalog-grid--list) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .nbc-catalog-list-item__thumb {
        width: 64px;
        min-width: 64px;
    }

    .nbc-purchase-row {
        gap: 12px;
    }

    .nbc-purchase-row__media {
        width: 56px;
    }

    .nbc-purchase-row__watch {
        padding: 7px 10px;
        font-size: 12px;
    }
}

/* ========== BOTTOM NAV (téléphone / tablette) ========== */
.nbc-bottom-nav {
    display: none;
}

@media (max-width: 991px) {
    :root { --nbc-bottom-nav-h: 64px; }

    .nbc-header .nbc-mobile-toggle {
        display: none !important;
    }

    .nbc-header #search-toggle {
        display: none;
    }

    .nbc-nav {
        display: none !important;
    }

    .nbc-nav-backdrop {
        display: none !important;
    }

    body.body:not(.nbc-page-watch) {
        padding-bottom: calc(var(--nbc-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    }

    .nbc-bottom-nav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1100;
        align-items: stretch;
        justify-content: space-around;
        height: calc(var(--nbc-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
        padding: 4px 4px env(safe-area-inset-bottom, 0px);
        background: rgba(18, 18, 18, 0.94);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-top: 1px solid #2a2a2a;
    }

    body.nbc-page-watch .nbc-bottom-nav {
        display: none;
    }

    .nbc-bottom-nav__item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 48px;
        padding: 6px 2px;
        color: #9a9a9a;
        text-decoration: none;
        background: none;
        border: 0;
        font: inherit;
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.02em;
        -webkit-tap-highlight-color: transparent;
    }

    .nbc-bottom-nav__item .icon {
        font-size: 22px;
        line-height: 1;
    }

    .nbc-bottom-nav__item.is-active {
        color: #fff;
    }

    .nbc-bottom-nav__item.is-active .icon {
        color: var(--nbc-red);
    }

    .nbc-search-panel {
        z-index: 1200;
        bottom: auto;
    }

    .nbc-rows,
    .nbc-catalog-page,
    .nbc-purchases-page,
    .nbc-profile,
    .nbc-detail-page {
        padding-bottom: 24px;
    }

    .nbc-hero {
        height: 58vh;
        min-height: 320px;
    }

    .nbc-hero__content {
        bottom: 16%;
    }

    .nbc-catalog-grid:not(.nbc-catalog-grid--list) {
        gap: 10px;
    }

    .nbc-purchase-row {
        align-items: center;
    }

    .nbc-purchase-row__watch {
        align-self: center;
    }
}

@media (max-width: 991px) and (orientation: landscape) {
    .nbc-hero {
        height: 78vh;
        max-height: 520px;
    }
}

@media (max-width: 575px) {
    .nbc-btn-signin {
        padding: 8px 10px;
        font-size: 12px;
    }

    .nbc-card {
        width: 42vw;
        max-width: 160px;
    }

    .nbc-card--wide {
        width: 62vw;
        max-width: 240px;
    }
}
