/* -------------------------------------------------------------------------------------
   Custom additions on top of DooPlay core styles
   ------------------------------------------------------------------------------------- */

/* Reserve the vertical scrollbar's gutter on BOTH edges permanently, so switching
   dir="ltr"/"rtl" (English/Arabic) never changes the page's available content width -
   without this, browsers move the scrollbar from the right edge to the left edge when
   the document becomes RTL, which very slightly reflows/shifts absolutely-positioned
   elements (like the poster quality badge) sitting near either edge of the grid. */
html{
    scrollbar-gutter: stable both-edges;
}

/* Collection archive cover banner (taxonomy.php, is_tax('dtcollection')) */
.dt-collection-cover{
    width:100%;
    height:220px;
    background-size:cover;
    background-position:center;
    border-radius:8px;
    margin-bottom:16px;
}

/* -------------------------------------------------------------------------------------
   Poster badges: quality + genre (hover-only, top corner) + tvshow latest episode.
   Fixed PHYSICAL corners - quality/genre always top-RIGHT, the episode badge always
   top-LEFT - on both the Arabic and the English interface. Deliberately plain
   right/left here rather than the inset-inline-* logical properties used elsewhere in
   this file, precisely so this one doesn't flip with the interface language; matches
   the same fixed-corner approach already used for the collection card badges further
   down (.dt-badges-quality-fixed / .dt-badges-count-fixed).
   ------------------------------------------------------------------------------------- */
.item .poster{
    position:relative;
    overflow:hidden;
}
/* DooPlay's own rtl.css (dormant until we wired it up - see doo_lang_switch.php) flips
   .item and .item .poster from float:left to float:right in Arabic. This theme's grid
   is float-based (.items{float:left}), not flex/grid, so that flip really does reorder
   how posters wrap/reflow, not just text direction. Since every poster-card badge here
   (quality, genre, episode, collection count) is a deliberately FIXED physical corner
   regardless of language, the poster grid itself needs to keep the exact same float
   direction too - otherwise a poster's own box can shift/reflow between the two
   interface languages even though the badge's position within it hasn't changed. */
.item,
.item .poster{
    float:left !important;
}
/* Poster always fills the whole grid cell, on every card type (movies,
   tvshows, collections, home modules...) - object-fit:cover crops to
   fill instead of leaving/hiding part of the box like a plain width:100%
   image can when its own aspect ratio doesn't match the grid cell's. */
.item .poster img{
    width:100%;
    height:100%;
    object-fit:cover;
}
.item .dt-poster-link{
    display:block;
    color:inherit;
    text-decoration:none;
}
.item .poster .dt-badges{
    position:absolute;
    top:6px !important;
    right:6px !important;
    left:auto !important;
    display:flex;
    flex-direction:column;
    align-items:flex-end;
    gap:4px;
    z-index:2;
    max-width:75%;
    pointer-events:none;
}
/* Latest-episode badge (tvshows): the OPPOSITE corner from quality/genre - always
   physically top-left, regardless of interface language. */
.item .poster .dt-badges.dt-badges-opposite{
    right:auto !important;
    left:6px !important;
    align-items:flex-start;
}
.item .poster .dt-badge{
    display:inline-block;
    padding:3px 8px;
    font-size:11px;
    font-weight:600;
    border-radius:3px;
    line-height:1.6;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:100%;
}
.item .poster .dt-badge-quality{
    background:#e50914;
    color:#fff;
}
.item .poster .dt-badge-episode{
    background:#1e88e5;
    color:#fff;
}
.item .poster .dt-badge-count{
    background:rgba(0,0,0,.75);
    color:#fff;
}

/* Genre badge: same spot as quality (in the .dt-badges stack), but hidden by
   default and revealed only on hover, black text on yellow background */
.item .poster .dt-badge-genre{
    background:#ffc107;
    color:#111;
    opacity:0;
    visibility:hidden;
    transition:opacity .2s ease, visibility .2s ease;
}
.item .poster:hover .dt-badge-genre{
    opacity:1;
    visibility:visible;
}

/* Fixed bottom-center badge: always visible (episode S/E number, collection count) */
.item .poster .dt-badges-bottom-fixed{
    position:absolute;
    bottom:8px;
    left:50%;
    transform:translateX(-50%);
    z-index:2;
    pointer-events:none;
}
.item .poster .dt-badges-bottom-fixed .dt-badge-episode,
.item .poster .dt-badges-bottom-fixed .dt-badge-count{
    background:rgba(0,0,0,.75);
    color:#fff;
    padding:4px 12px;
    font-size:12px;
    font-weight:700;
    border-radius:3px;
    white-space:nowrap;
}

/* Title reveal: hidden by default, appears on hover only, centered over the poster
   (episode title / collection name). pointer-events:none is critical here - without
   it this full-cover layer sits on top of the real poster link and swallows clicks. */
.item .poster .dt-title-hover{
    position:absolute;
    inset:0;
    display:flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    padding:10px;
    background:rgba(0,0,0,.55);
    z-index:4;
    opacity:0;
    visibility:hidden;
    transition:opacity .2s ease, visibility .2s ease;
    pointer-events:none;
}
.item .poster:hover .dt-title-hover{
    opacity:1;
    visibility:visible;
}
.item .poster .dt-title-hover span{
    color:#fff;
    font-weight:700;
    font-size:14px;
    line-height:1.4;
}

/* -------------------------------------------------------------------------------------
   Collection ("movie series") cards - doo_child_render_collection_card() in
   inc/doo_taxonomies_custom.php, used by the homepage Collections module AND the
   "DT - Collections Grid" page, so both look identical.
   - No name below the poster (that block simply isn't printed any more).
   - Poster fills the whole grid cell, same aspect/crop as every other poster.
   - Quality (top-right) + count (top-left) badges: fixed physical corners, not
     mirrored by interface language - see the comment just below.
   - The name (+ its genre pills) only appears on hover, as a bar that hugs
     the bottom of the poster and is only as tall as its own text - not a
     full-poster overlay.
   ------------------------------------------------------------------------------------- */
.item.collections .poster img{
    object-fit:cover;
    height:100%;
}
.item.collections .data{
    display:none;
}
/* Fixed physical corners (NOT mirrored by language direction, unlike the
   normal movies/tvshows quality badge above): quality always top-RIGHT,
   movie count always top-LEFT (the opposite corner), regardless of
   whether the interface is Arabic or English. */
.item.collections .poster .dt-badges-quality-fixed{
    position:absolute;
    top:6px !important;
    right:6px !important;
    left:auto !important;
    inset-inline-end:auto !important;
    inset-inline-start:auto !important;
    z-index:2;
}
.item.collections .poster .dt-badges-count-fixed{
    position:absolute;
    top:6px !important;
    left:6px !important;
    right:auto !important;
    inset-inline-end:auto !important;
    inset-inline-start:auto !important;
    z-index:2;
}
.item.collections .poster .dt-collection-hover{
    position:absolute;
    left:0;
    right:0;
    bottom:0;
    z-index:4;
    display:flex;
    flex-direction:column;
    align-items:center;
    gap:4px;
    padding:10px 8px 8px;
    text-align:center;
    background:linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0));
    opacity:0;
    visibility:hidden;
    transform:translateY(6px);
    transition:opacity .2s ease, visibility .2s ease, transform .2s ease;
    pointer-events:none;
}
.item.collections .poster:hover .dt-collection-hover{
    opacity:1;
    visibility:visible;
    transform:translateY(0);
}
/* Genre pills above the name, inside the hover bar - reuses the exact same
   .dt-badge.dt-badge-genre look as every other poster's genre badge (yellow
   background, black text - see the base rule above), one pill per genre with a
   visible gap between them instead of one comma-joined line. */
.item.collections .poster .dt-collection-hover-genres{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    gap:4px;
}
.item.collections .poster .dt-collection-hover-name{
    color:#fff;
    font-weight:600;
    font-size:13px;
    line-height:1.3;
    text-overflow:ellipsis;
    white-space:nowrap;
    overflow:hidden;
    max-width:100%;
}
@media (hover:none){
    .item.collections .poster .dt-collection-hover{
        opacity:1;
        visibility:visible;
        transform:none;
    }
}

/* Rating badge: force the yellow/black IMDb-style treatment everywhere in the grid */
.item .poster .rating{
    background:#ffc107 !important;
    color:#111 !important;
    text-shadow:none !important;
    font-weight:700 !important;
}

/* Touch devices have no real ":hover" - show the hover-only elements
   permanently there instead of hiding this info from mobile visitors */
@media (hover:none){
    .item .poster .dt-badge-genre,
    .item .poster .dt-title-hover{
        opacity:1;
        visibility:visible;
    }
}

/* -------------------------------------------------------------------------------------
   Watch/download servers: side by side instead of stacked
   ------------------------------------------------------------------------------------- */
.options ul#playeroptionsul{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    margin:25px 0;
}
.options ul#playeroptionsul li.dooplay_player_option{
    float:none;
    width:auto;
    flex:1 1 160px;
    max-width:240px;
    padding:12px 15px;
    border-radius:4px;
    /* Light separator so each server reads as its own row/box instead of
       running into the next one with no visual break between them. */
    border-bottom:2px solid rgba(255,255,255,.12);
}
.options ul#playeroptionsul li.dooplay_player_option:hover,
.options ul#playeroptionsul li.dooplay_player_option.on{
    border-bottom-color:#e50914;
}
.options ul#playeroptionsul li.dooplay_player_option span.title{
    float:none;
    display:block;
}
.options ul#playeroptionsul li.dooplay_player_option span.server{
    float:none;
    display:block;
    margin-left:0;
}
.options ul#playeroptionsul li.dooplay_player_option span.loader{
    float:none;
    position:absolute;
    top:10px;
    inset-inline-end:10px;
    margin:0;
}
.options ul#playeroptionsul li.dooplay_player_option{
    position:relative;
}
.options ul#playeroptionsul li.dooplay_player_option{
    transition:background-color .2s ease, box-shadow .2s ease;
}
.options ul#playeroptionsul li.dooplay_player_option:hover{
    background-color:rgba(255,255,255,.10);
    box-shadow:0 0 14px rgba(255,255,255,.18);
}
@media (max-width:600px){
    .options ul#playeroptionsul li.dooplay_player_option{
        flex:1 1 45%;
        max-width:none;
    }
}

/* -------------------------------------------------------------------------------------
   Season tabs: headers side by side in one row instead of stacked, whichever
   season is expanded shows its episodes full-width below the tab row.
   Uses display:contents on .se-c so its two children (.se-q the header,
   .se-a the episode panel) become direct flex items of #seasons - "order"
   then keeps every header together first, and the (one, visible) open
   panel is a full-width row underneath, regardless of source order.
   ------------------------------------------------------------------------------------- */
#seasons{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}
#seasons .se-c{
    display:contents;
}
#seasons .se-c .se-q{
    order:1;
    flex:0 0 auto;
    width:auto !important;
    padding:10px 18px !important;
    margin:0 !important;
    background:rgba(255,255,255,.06);
    border-radius:4px;
    display:flex;
    align-items:center;
    gap:8px;
    transition:background-color .2s ease, color .2s ease;
}
/* Active season tab: red highlight, moves to whichever season is open */
#seasons .se-c.dt-season-open .se-q{
    background:#e50914;
    color:#fff;
}
#seasons .se-c.dt-season-open .se-q .se-t{
    color:#fff;
}
#seasons .se-c .se-q .se-t{
    position:static !important;
    width:auto !important;
    padding:0 !important;
    font-size:16px !important;
}
#seasons .se-c .se-q .title{
    white-space:nowrap;
}
#seasons .se-c .se-q .title i{
    display:none; /* air date - only room for the season label in a compact tab */
}
#seasons .se-c .se-a{
    order:2;
    flex:0 0 100%;
    width:100% !important;
    margin-top:14px;
}

/* -------------------------------------------------------------------------------------
   "Seasons and episodes" list on the TV show page: side by side cards instead of
   stacked rows, clear thumbnail with the episode number overlaid on it.
   NOTE: the parent theme's own selector is "#seasons .se-c .se-a ul.episodios ..."
   (with .se-c) - the override below must match that exact chain or it loses on
   CSS specificity and silently does nothing.
   ------------------------------------------------------------------------------------- */
#seasons .se-c .se-a ul.episodios{
    width:100% !important;
    float:none !important;
    display:flex !important;
    flex-wrap:wrap !important;
    gap:14px !important;
}
#seasons .se-c .se-a ul.episodios li{
    width:calc(20% - 12px) !important;
    float:none !important;
    border-bottom:0 !important;
    padding:0 !important;
    position:relative !important;
}
#seasons .se-c .se-a ul.episodios li .imagen{
    width:100% !important;
    float:none !important;
    margin:0 !important;
    position:relative !important;
    border-radius:4px;
    overflow:hidden;
    aspect-ratio:16/9;
    cursor:pointer;
}
#seasons .se-c .se-a ul.episodios li .imagen img{
    width:100%;
    height:100%;
    object-fit:cover;
    display:block;
}
#seasons .se-c .se-a ul.episodios li .numerando{
    position:absolute !important;
    top:6px;
    inset-inline-start:50%;
    transform:translateX(-50%);
    float:none !important;
    width:auto !important;
    margin:0 !important;
    border:none !important;
    background:rgba(0,0,0,.75);
    color:#fff;
    padding:3px 10px;
    border-radius:3px;
    font-size:12px;
    font-weight:700;
    text-align:center;
    z-index:2;
}
#seasons .se-c .se-a ul.episodios li .episodiotitle{
    position:static !important;
    float:none !important;
    width:100% !important;
    padding:8px 2px !important;
    white-space:normal !important;
}
#seasons .se-c .se-a ul.episodios li .episodiotitle a{
    font-size:13px;
}
#seasons .se-c .se-a ul.episodios li .episodiotitle span.date{
    font-size:11px;
}
@media (max-width:900px){
    #seasons .se-c .se-a ul.episodios li{
        width:calc(33.333% - 10px) !important;
    }
}
@media (max-width:600px){
    #seasons .se-c .se-a ul.episodios li{
        width:calc(50% - 7px) !important;
    }
}

/* -------------------------------------------------------------------------------------
   Hero slider close button - dismissing it hides it site-wide (persisted in
   localStorage) until the visitor clears their browser data.
   ------------------------------------------------------------------------------------- */
.dt-hero-slider-wrap{
    position:relative;
}
#dt-hero-slider-close{
    position:absolute;
    top:10px;
    inset-inline-end:10px;
    z-index:999;
    width:32px;
    height:32px;
    line-height:30px;
    text-align:center;
    padding:0;
    border:0;
    border-radius:50%;
    background:rgba(0,0,0,.55);
    color:#fff;
    font-size:20px;
    cursor:pointer;
    transition:background-color .2s ease;
}
#dt-hero-slider-close:hover{
    background:rgba(0,0,0,.8);
}
html.dt-slider-dismissed .dt-hero-slider-wrap{
    display:none !important;
}

/* -------------------------------------------------------------------------------------
   Placeholder image (doo_child_card_image() 4th fallback tier) - just dims the plain
   dark rectangle slightly so it doesn't look identical to a real loaded poster/backdrop.
   ------------------------------------------------------------------------------------- */
img.dt-noimg{
    opacity:.6;
}

/* -------------------------------------------------------------------------------------
   Language switcher (doo_child_language_switcher()) - both the floating badge and the
   [dt_lang_switch] shortcode/menu-item placement share this. Uses logical properties so
   the floating badge's corner automatically follows the current reading direction.
   ------------------------------------------------------------------------------------- */
#dt-lang-float{
    position:fixed;
    bottom:14px;
    inset-inline-end:14px;
    z-index:9999;
    background:rgba(0,0,0,.75);
    border-radius:20px;
    padding:6px 14px;
    backdrop-filter:blur(4px);
}
.dt-lang-toggle{
    display:flex;
    align-items:center;
    gap:5px;
    color:#ccc;
    text-decoration:none;
    font-size:12px;
    font-weight:600;
    line-height:1;
    transition:color .2s ease;
}
.dt-lang-toggle:hover{
    color:#e50914;
}
.dt-lang-toggle .dt-lang-icon{
    font-size:15px;
    line-height:1;
}
.dt-lang-toggle .dt-lang-current{
    letter-spacing:.5px;
}

/* Placement inside DooPlay's own header menu (desktop .main-header and
   mobile .resp share the same 'header' menu location - see
   doo_lang_switch.php). Each list's own <li>/<a> rules (float, full-width,
   large padding) are meant for real menu links, not this widget, so
   they're reset here and replaced with sizing that fits each context. */
.main-header .dt-lang-switch-item,
.resp .dt-lang-switch-item{
    list-style:none;
}
.main-header .dt-lang-switch-item{
    float:none;
    display:flex;
    align-items:center;
}
.main-header .dt-lang-switch-item .dt-lang-toggle{
    padding-inline:20px;
}
.resp .dt-lang-switch-item .dt-lang-toggle{
    padding:17px 15px;
}
.dt-lang-switch-item .dt-lang-toggle{
    float:none !important;
    width:auto !important;
}
