/* Habillage CI4 adapte a Bootstrap 5, sans les anciens plugins jQuery. */

:root {
    --mm-poster-min: 150px;
    --mm-accent: #629aa9;
    --mm-sidebar-width: 230px;
    --mm-header-height: 72px;
    --bs-primary: #4b7884;
    --bs-primary-rgb: 75, 120, 132;
    --bs-link-color: #406874;
    --bs-link-color-rgb: 64, 104, 116;
    --bs-link-hover-color: #304f58;
    --bs-link-hover-color-rgb: 48, 79, 88;
    --bs-body-bg: #f1f1f1;
    --bs-body-bg-rgb: 241, 241, 241;
    --bs-body-color: #333;
    --bs-body-font-family: "PT Sans", "Segoe UI", Arial, sans-serif;
}

.mymedia-shell {
    min-height: 100vh;
}

.mm-sidebar {
    --bs-offcanvas-width: var(--mm-sidebar-width);
    background: #222d32 !important;
    color: #b8c7ce;
}

.mm-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    padding: 1.5rem 1rem;
    color: #fff;
    font-size: 1.5rem;
    text-transform: uppercase;
    text-decoration: none;
}

.mm-brand:hover {
    color: #fff;
}

.mm-brand img {
    width: 140px;
    height: auto;
}

.mm-sidebar .offcanvas-body {
    padding: 0;
}

.mm-menu {
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}

.mm-menu-heading {
    background: #1a2226;
    color: #9bb0bb;
    padding: .7rem 1.2rem;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.mm-menu a {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .85rem 1.2rem;
    border-left: 3px solid transparent;
    color: #b8c7ce;
    font-size: .9rem;
    text-decoration: none;
}

.mm-menu a:hover,
.mm-menu a:focus-visible,
.mm-menu a.active {
    background: #1e282c;
    border-left-color: var(--mm-accent);
    color: #fff;
}

.mm-header {
    position: sticky;
    top: 0;
    z-index: 1020;
    min-height: var(--mm-header-height);
    gap: 1rem;
    flex-wrap: nowrap;
    padding: .75rem 1.5rem;
    background: #fff;
    box-shadow: 1px 1px 4px rgb(0 0 0 / 21%);
}

.mm-header-title {
    color: #666;
    font-size: .9rem;
}

.mm-menu-toggle {
    background: var(--mm-accent);
    color: #fff;
    font-size: 1.3rem;
}

.mm-search {
    position: relative;
    width: min(100%, 360px);
}

.mm-search > .bi {
    position: absolute;
    top: .6rem;
    left: .8rem;
    color: #666;
}

.mm-search input {
    padding-left: 2.3rem;
    background: #fff;
    border-radius: 0;
}

.mm-profile {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #333;
}

.mm-profile > .bi {
    color: #4b7884;
    font-size: 1.8rem;
}

.mm-content {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--mm-header-height));
}

.mm-content > main {
    flex: 1;
    min-width: 0;
}

.mm-footer {
    padding: 1.25rem;
    background: #fff;
    color: #666;
    text-align: center;
    font-size: .8rem;
}

.mm-skip-link:focus {
    position: fixed;
    top: .5rem;
    left: .5rem;
    z-index: 1100;
    padding: .75rem;
    background: #fff;
}

.mm-login {
    width: min(100%, 680px);
    margin: clamp(1rem, 8vh, 6rem) auto;
}

.mm-login-panel {
    padding: clamp(1.25rem, 4vw, 3rem);
    background: #fff;
    box-shadow: 0 1px 3px rgb(0 0 0 / 18%);
}

.mm-account {
    width: min(100%, 560px);
    margin: clamp(1rem, 5vh, 4rem) auto;
}

.mm-account-panel {
    padding: clamp(1.25rem, 4vw, 2.5rem);
    border: 1px solid #dce3e6;
    border-top: 4px solid var(--mm-accent);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 12px 36px rgb(34 45 50 / 8%);
}

.mm-account-icon {
    display: grid;
    place-items: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: 1.5rem;
    border-radius: 1rem;
    background: #edf4f6;
    color: #406874;
    font-size: 1.75rem;
}

.mm-account .form-control {
    min-height: 2.75rem;
    border-radius: .5rem;
    background: #fff;
}

.mm-account .btn-primary {
    min-height: 2.75rem;
    margin-top: .5rem;
    border-radius: .5rem;
}

.mm-account-footer {
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e8edef;
    text-align: center;
}

.mm-account-notice {
    padding: 1rem;
    border-radius: .5rem;
    background: #edf4f6;
}

.mm-social-facebook {
    --bs-btn-color: #fff;
    --bs-btn-bg: #3b5998;
    --bs-btn-hover-bg: #30487c;
    --bs-btn-hover-color: #fff;
}

.mymedia-shell .btn-primary {
    --bs-btn-bg: #4b7884;
    --bs-btn-border-color: #4b7884;
    --bs-btn-hover-bg: #3c606a;
    --bs-btn-hover-border-color: #3c606a;
    --bs-btn-active-bg: #304f58;
    --bs-btn-active-border-color: #304f58;
}

.mymedia-shell .btn-outline-primary {
    --bs-btn-color: #406874;
    --bs-btn-border-color: #629aa9;
    --bs-btn-hover-bg: #4b7884;
    --bs-btn-hover-border-color: #4b7884;
    --bs-btn-active-bg: #4b7884;
    --bs-btn-active-border-color: #4b7884;
}

.mymedia-shell .form-control,
.mymedia-shell .form-select {
    background-color: #fff;
}

.mymedia-shell .form-control:focus,
.mymedia-shell .form-select:focus {
    border-color: #629aa9;
    box-shadow: 0 0 0 .2rem rgb(98 154 169 / 25%);
}

.mymedia-shell .form-check-input:checked {
    background-color: #4b7884;
    border-color: #4b7884;
}

@media (min-width: 992px) {
    .mm-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--mm-sidebar-width);
        overflow-y: auto;
    }

    .mm-header,
    .mm-content {
        margin-left: var(--mm-sidebar-width);
    }

    .mm-content > .container-fluid {
        padding-right: 2rem;
        padding-left: 2rem;
    }
}

@media (max-width: 575.98px) {
    .mm-header {
        gap: .5rem;
        padding: .5rem .75rem;
    }

    .mm-profile span {
        display: none;
    }

    .mm-profile {
        padding: .25rem;
    }

    .mm-search {
        min-width: 0;
    }
}

/* Cartes affiche : ratio 2/3 réservé avant chargement (pas de décalage de mise en page, Lighthouse CLS) */
.poster {
    display: block;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    width: 100%;
    height: auto;
    background: var(--bs-secondary-bg);
}

.poster-placeholder {
    aspect-ratio: 2 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--bs-secondary-color);
    background: var(--bs-secondary-bg);
}

.media-card {
    position: relative;
    min-width: 0;
    transition: transform .15s ease-in-out;
    padding: .5rem;
}

.mymedia-shell .media-card {
    background: #fff !important;
    box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
}

.mm-poster-wrap {
    position: relative;
}

.mm-rating {
    position: absolute;
    bottom: .4rem;
    left: .4rem;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 3px;
    border-radius: 50%;
    background: conic-gradient(#7dcb8b var(--mm-score), #555 0);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
}

.mm-rating > span {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #222;
}

.media-card .poster,
.media-card .poster-placeholder {
    border-radius: 15px !important;
}

.media-card h3 {
    display: -webkit-box;
    min-height: 2.4em;
    overflow: hidden;
    line-height: 1.2;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.media-card:hover,
.media-card:focus-within {
    transform: translateY(-3px);
}

.media-card .badge-watched {
    position: absolute;
    bottom: .4rem;
    right: .4rem;
}

.media-card .progress {
    height: 4px;
    border-radius: 0;
}

/* Grille de liste : autant de colonnes que la largeur le permet */
.poster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--mm-poster-min), 1fr));
    gap: 1rem;
}

/* Rangée horizontale de l'accueil : remplace Owl Carousel (jQuery) par du CSS natif */
.poster-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(var(--mm-poster-min), 160px);
    gap: .75rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    padding-bottom: .5rem;
}

.poster-row > * {
    scroll-snap-align: start;
}

.mm-carousel.owl-loaded {
    display: block;
    overflow: visible;
    padding-bottom: 0;
}

.mm-carousel .owl-stage {
    display: flex;
    padding-top: 4px;
}

.mm-carousel .owl-item {
    display: flex;
}

.mm-carousel .owl-item > * {
    width: 100%;
    min-width: 0;
}

.mm-carousel.owl-theme .owl-nav button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--bs-primary);
    background: #fff;
    box-shadow: 0 1px 3px rgb(0 0 0 / 12%);
}

.mm-carousel.owl-theme .owl-nav button:hover {
    color: #fff;
    background: var(--bs-primary);
}

/* Bandeau des fiches */
.backdrop {
    background-size: cover;
    background-position: center top;
    position: relative;
}

.backdrop::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(var(--bs-body-bg-rgb), .97) 35%, rgba(var(--bs-body-bg-rgb), .7));
}

.backdrop > * {
    position: relative;
}

.trailer-button {
    border: 0;
    padding: 0;
    background: #000;
}

.trailer-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: .75;
}

.trailer-button .bi {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #fff;
}

.episode-still {
    width: 160px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.cast-photo {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

.mm-account {
    max-width: 1160px;
    margin-inline: auto;
}

.mm-account-summary,
.mm-account-panel {
    border: 1px solid #e5e9ed;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 3px 12px rgb(0 0 0 / 3%);
}

.mm-account-summary {
    overflow: hidden;
}

.mm-account-cover {
    height: 100px;
    background: linear-gradient(120deg, #354957, #708c9e);
}

.mm-account-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    margin-top: -48px;
    border: 4px solid #fff;
    border-radius: 50%;
    background: #e8eff4;
    color: #354957;
    font-size: 2.25rem;
    font-weight: 600;
}

.mm-account-avatar img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.mm-account-panel {
    padding: clamp(1rem, 3vw, 1.75rem);
}

.mm-account-heading {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-bottom: 1.5rem;
}

.mm-account-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #edf2f6;
    color: #526d80;
    font-size: 1.25rem;
}

/* Turbo : frame en cours de chargement */
turbo-frame[busy] {
    opacity: .6;
}
