/*
 * Lurox 5.1.1 detail, player, episode and actor fixes.
 * Loaded after all legacy/reference styles to keep the cascade predictable.
 */

/* Shared detail spacing */
body.single-film .lx-detail-body,
body.single-dizi .lx-detail-body,
body.single-bolum .lx-detail-body {
    overflow: hidden;
}

body.single-film .lx-detail-body > .lx-container,
body.single-dizi .lx-detail-body > .lx-container,
body.single-bolum .lx-detail-body > .lx-container {
    min-width: 0;
}

.lx-detail-section {
    margin-top: 48px !important;
    padding-top: 0 !important;
    min-width: 0;
}

.lx-season-panels,
.lx-season-panel,
.lx-episode-grid,
.lx-cast-grid {
    min-width: 0;
}

/* Player: the old stylesheet applied 16:9 to both the shell and frame. */
.lx-player {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    overflow: hidden !important;
}

.lx-player-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 16px !important;
}

.lx-player-title {
    min-width: 0;
}

.lx-player-title h2 {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lx-source-tabs {
    max-width: min(58vw, 720px);
    min-width: 0;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: thin;
    overscroll-behavior-inline: contain;
    padding-bottom: 2px;
}

.lx-source-tabs a {
    flex: 0 0 auto;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lx-source-tabs a[data-kind="trailer"]:before {
    content: "\f008";
    margin-right: 6px;
    font-family: FontAwesome;
}

.lx-player-frame {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 16 / 9 !important;
    overflow: hidden !important;
    background: #000 !important;
}

.lx-player-frame > iframe,
.lx-player-frame > video,
.lx-player-frame > embed,
.lx-player-frame > object,
.lx-player-frame > div,
.lx-player-frame iframe,
.lx-player-frame video,
.lx-player-frame embed,
.lx-player-frame object {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border: 0 !important;
}

/* Season and episode layout */
.lx-season-tabs {
    align-items: stretch !important;
    margin-bottom: 18px !important;
    padding-bottom: 3px;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    scrollbar-width: thin;
}

.lx-season-tabs button {
    flex: 0 0 auto;
    min-width: 132px !important;
    height: 52px !important;
    justify-content: center !important;
    line-height: 1.1 !important;
}

.lx-season-tabs button small {
    margin-left: 2px;
    white-space: nowrap;
}

.lx-episode-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 410px), 1fr)) !important;
    gap: 16px !important;
    align-items: stretch;
}

.lx-episode {
    position: relative !important;
    display: grid !important;
    grid-template-columns: minmax(145px, 42%) minmax(0, 1fr) !important;
    min-width: 0 !important;
    min-height: 132px !important;
    padding: 0 !important;
    overflow: hidden !important;
    isolation: isolate;
}

.lx-episode-image {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 132px !important;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    z-index: 1;
}

.lx-episode-image:after {
    content: "";
    position: absolute;
    inset: 0 -1px 0 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(90deg, transparent 42%, rgba(16, 20, 27, .45) 73%, #10141b 100%) !important;
}

.lx-episode-image > img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.lx-episode-image > span {
    z-index: 2 !important;
}

.lx-episode-info {
    position: relative !important;
    z-index: 3 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-width: 0 !important;
    overflow: hidden !important;
    padding: 16px 17px !important;
}

.lx-episode-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--lu-accent, var(--lx-accent));
    font-size: 9px;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.lx-episode-info h3 {
    width: 100%;
    margin: 0 0 7px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.lx-episode-info p {
    width: 100%;
    margin: 0 0 8px !important;
    color: #aeb5c0 !important;
    font-size: 10px !important;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lx-episode-info small {
    margin-top: auto;
    color: #747d8a !important;
    font-size: 9px !important;
}

/* Cast cards */
.lx-cast-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 15px !important;
}

.lx-cast-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--lu-border, var(--lx-border)) !important;
    border-radius: 14px !important;
    background: #10141b !important;
    transition: transform .22s ease, border-color .22s ease;
}

.lx-cast-card:hover {
    transform: translateY(-3px);
    border-color: rgba(239, 23, 35, .45) !important;
}

.lx-cast {
    display: block !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    text-align: left !important;
    transform: none !important;
}

.lx-cast-media {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #171c24;
}

.lx-cast-media img,
.lx-cast img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
    object-fit: cover !important;
    object-position: center 18% !important;
    transition: transform .3s ease;
}

.lx-cast-card:hover img {
    transform: scale(1.035);
}

.lx-cast-copy {
    display: block !important;
    min-width: 0;
    padding: 12px 12px 13px !important;
}

.lx-cast-copy strong,
.lx-cast-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lx-cast-copy strong {
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
}

.lx-cast-copy small {
    margin-top: 4px;
    color: #858e9b;
    font-size: 9px;
}

/* Actor directory */
.lx-actor-directory {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)) !important;
    gap: 16px !important;
}

.lx-actor-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--lu-border, var(--lx-border));
    border-radius: 14px;
    background: #10141b;
    transition: transform .22s ease, border-color .22s ease;
}

.lx-actor-card:hover {
    transform: translateY(-3px);
    border-color: rgba(239, 23, 35, .45);
}

.lx-actor-card > a {
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

.lx-actor-media {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #171c24;
}

.lx-actor-media img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    object-fit: cover !important;
    object-position: center 18%;
}

.lx-actor-copy {
    display: block !important;
    min-width: 0;
    padding: 12px 13px 14px;
}

.lx-actor-copy strong,
.lx-actor-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lx-actor-copy strong {
    color: #fff;
    font-size: 12px;
}

.lx-actor-copy small {
    margin-top: 4px;
    color: #858e9b;
    font-size: 9px;
}

/* Actor detail page */
.lx-person-hero {
    min-height: 410px;
    display: flex;
    align-items: flex-end;
}

.lx-person-hero .lx-tax-heading {
    align-items: flex-end !important;
}

.lx-person-photo {
    width: 215px !important;
    height: auto !important;
    aspect-ratio: 2 / 3;
    flex: 0 0 auto;
    object-position: center 18%;
}

.lx-person-hero .lx-tax-heading > div {
    min-width: 0;
    padding-bottom: 8px;
}

.lx-person-hero h1 {
    overflow-wrap: anywhere;
}

@media (max-width: 820px) {
    .lx-detail-section {
        margin-top: 38px !important;
    }

    .lx-player-head {
        grid-template-columns: 1fr !important;
        align-items: start !important;
    }

    .lx-source-tabs {
        width: 100%;
        max-width: 100%;
        justify-content: flex-start !important;
    }

    .lx-source-tabs a {
        max-width: 230px;
    }

    .lx-episode-grid {
        grid-template-columns: 1fr !important;
    }

    .lx-cast-grid,
    .lx-actor-directory {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .lx-person-hero {
        min-height: 340px;
    }

    .lx-person-photo {
        width: 150px !important;
    }
}

@media (max-width: 560px) {
    .lx-detail-body {
        padding-top: 24px !important;
        padding-bottom: 92px !important;
    }

    .lx-detail-section {
        margin-top: 32px !important;
    }

    .lx-player {
        margin-bottom: 28px !important;
        border-radius: 13px !important;
    }

    .lx-player-head {
        min-height: 0 !important;
        padding: 13px 14px !important;
    }

    .lx-player-title h2 {
        font-size: 13px !important;
    }

    .lx-source-tabs a {
        max-width: 78vw;
        height: 36px !important;
        padding-inline: 11px !important;
        font-size: 9px !important;
    }

    .lx-season-tabs button {
        min-width: 124px !important;
        height: 48px !important;
        padding-inline: 12px !important;
    }

    .lx-episode {
        grid-template-columns: 126px minmax(0, 1fr) !important;
        min-height: 112px !important;
    }

    .lx-episode-image {
        min-height: 112px !important;
    }

    .lx-episode-info {
        padding: 12px 13px !important;
    }

    .lx-episode-info h3 {
        font-size: 12px !important;
        white-space: normal !important;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .lx-episode-info p {
        display: none;
    }

    .lx-cast-grid,
    .lx-actor-directory {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 11px !important;
    }

    .lx-cast-copy,
    .lx-actor-copy {
        padding: 10px !important;
    }

    .lx-person-hero {
        min-height: 0;
        padding-top: 98px !important;
    }

    .lx-person-hero .lx-tax-heading {
        align-items: flex-start !important;
        gap: 17px !important;
    }

    .lx-person-photo {
        width: 108px !important;
        height: 150px !important;
        aspect-ratio: auto;
    }

    .lx-person-hero h1 {
        font-size: clamp(30px, 9vw, 42px) !important;
    }
}
