/* ═══════════════════════════════════════════════════════════════
   HOME MODULES — Liquid Glass Design System
   Brand accent: amber-orange (#f59e0b → #f97316 gradient)
   Shared by all home page content modules
   ═══════════════════════════════════════════════════════════════ */

:root {
    --hm-accent:        #f59e0b;          /* amber */
    --hm-accent-warm:   #f97316;          /* orange */
    --hm-accent-glow:   rgba(245,158,11,0.35);
    --hm-accent-faint:  rgba(245,158,11,0.12);
    --hm-glass-bg:      rgba(18, 12, 28, 0.55);
    --hm-glass-border:  rgba(255,255,255,0.13);
    --hm-glass-shine:   rgba(255,255,255,0.22);
    --hm-text-primary:  #f5f5f5;
    --hm-text-muted:    #8b8b9a;
    --hm-radius:        16px;
    --hm-padding:       16px;             /* safe side padding on mobile */
}

/* ────────────────── MODULE WRAPPER ────────────────── */
.hm-module {
    margin-bottom: 56px;
    padding: 0 var(--hm-padding);   /* ← side padding so content never touches edges */
    contain: layout style;          /* ← limits repaint scope to this module */
}
@media (min-width: 769px) {
    .hm-module { padding: 0; }     /* desktop: let parent handle spacing */
}

/* ────────────────── SECTION HEADER ────────────────── */
.hm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    direction: rtl;
}

.hm-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.015em;
}

/* Icon wrapper — renders the SVG with a soft amber glow */
.hm-title-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(245,158,11,0.18) 0%, rgba(249,115,22,0.18) 100%);
    border: 1px solid rgba(245,158,11,0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 14px rgba(245,158,11,0.18);
}
.hm-title-icon svg {
    width: 18px;
    height: 18px;
    color: var(--hm-accent);
    fill: var(--hm-accent);
}

.hm-title-text {
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 45%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* "View All" button — RTL: text on right, arrow on left pointing left */
.hm-view-all {
    display: inline-flex;
    align-items: center;
    flex-direction: row-reverse;   /* arrow comes after text in DOM but visually on the left */
    gap: 5px;
    padding: 7px 14px 7px 12px;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.28);
    border-radius: 50px;
    color: #fde68a;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    direction: rtl;
    transition: background 0.22s, border-color 0.22s, transform 0.22s, box-shadow 0.22s;
    white-space: nowrap;
}
.hm-view-all:hover {
    background: rgba(245,158,11,0.2);
    border-color: rgba(245,158,11,0.55);
    box-shadow: 0 4px 16px rgba(245,158,11,0.22);
    transform: translateY(-2px);
    text-decoration: none;
    color: #fff;
}
/* rotate chevron 180° so it points left (← for RTL "go back / see all") */
.hm-view-all svg {
    fill: currentColor;
    transform: rotate(180deg);
}

/* ────────────────── SCROLL CONTAINER ────────────────── */
.hm-container {
    position: relative;
}

/* Edge fade — shows scroll gradient on mobile */
.hm-container::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; right: -var(--hm-padding);
    width: 40px;
    pointer-events: none;
    background: linear-gradient(to left, var(--bg-color, #0e0e12) 0%, transparent 100%);
    z-index: 3;
    display: none;
}
@media (max-width: 768px) {
    .hm-container::after { display: block; right: -16px; }
}

/* Desktop grid — 5 columns always.
   5 divides evenly into both module limits (5 items = 1 full row, 10 items = 2 full rows).
   Any other count (6, 7, 8…) leaves orphan cards. */
.hm-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
}

/* ────────────────── POSTER CARD ────────────────── */
.hm-card {
    cursor: pointer;
    contain: layout style;          /* ← isolates repaints per-card */
    transition: transform 0.3s cubic-bezier(.25,.46,.45,.94);
}
/* will-change only when needed — avoids always-on compositing layers */
.hm-card:hover { transform: translateY(-7px); will-change: transform; }

.hm-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ── Liquid Glass Poster Shell ── */
.hm-poster {
    position: relative;
    border-radius: var(--hm-radius);
    overflow: hidden;
    aspect-ratio: 2 / 3;
    margin-bottom: 10px;

    /* frosted glass base — NO backdrop-filter here:
       the poster image covers 100% of the card so blur is invisible
       but forces a separate GPU compositor layer on every card → scroll jank */
    background: rgba(15, 10, 25, 0.85);
    border: 1px solid var(--hm-glass-border);

    /* multi-layer glass shadow system */
    box-shadow:
        0 1px 0 var(--hm-glass-shine) inset,
        0 -1px 0 rgba(0,0,0,0.4) inset,
        0 8px 30px rgba(0,0,0,0.55),
        0 2px 6px rgba(0,0,0,0.3);

    transition: box-shadow 0.3s, border-color 0.3s;
}

.hm-card:hover .hm-poster {
    border-color: rgba(245,158,11,0.55);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.28) inset,
        0 -1px 0 rgba(0,0,0,0.4) inset,
        0 16px 45px rgba(245,158,11,0.28),
        0 4px 12px rgba(0,0,0,0.4);
}

/* Poster image */
.hm-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
    border-radius: var(--hm-radius);
}
.hm-card:hover .hm-poster img { transform: scale(1.06); }

/* ── Liquid glass shimmer sweep on hover ── */
.hm-poster::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        118deg,
        transparent 20%,
        rgba(255,255,255,0.09) 38%,
        rgba(255,255,255,0.18) 50%,
        rgba(255,255,255,0.09) 62%,
        transparent 80%
    );
    background-size: 200% 100%;
    background-position: -100% 0;
    border-radius: var(--hm-radius);
    z-index: 4;
    pointer-events: none;
    opacity: 0;
    transition: background-position 0.55s ease, opacity 0.3s;
}
.hm-card:hover .hm-poster::before {
    opacity: 1;
    background-position: 200% 0;
}

/* ── Top-edge glass reflection line ── */
.hm-poster::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255,255,255,0.45) 30%,
        rgba(255,220,130,0.55) 55%,
        rgba(255,255,255,0.45) 75%,
        transparent 100%
    );
    border-radius: var(--hm-radius) var(--hm-radius) 0 0;
    z-index: 5;
    pointer-events: none;
}

/* ── Badges ── */
.hm-badges {
    position: absolute;
    top: 9px;
    left: 9px;
    right: 9px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 6;
    pointer-events: none;
}

/* Quality badge — amber gradient glass pill */
.hm-badge-quality {
    background: linear-gradient(135deg, rgba(245,158,11,0.92) 0%, rgba(249,115,22,0.92) 100%);
    color: #1a0a00;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow: 0 2px 8px rgba(245,158,11,0.45), 0 1px 0 rgba(255,255,255,0.3) inset;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* IMDB badge — dark glass pill with amber star */
.hm-badge-imdb {
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(245,158,11,0.4);
    border-radius: 7px;
    padding: 3px 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #fde68a;
    box-shadow: 0 1px 0 rgba(255,255,255,0.1) inset;
}
.hm-badge-imdb svg { fill: var(--hm-accent); flex-shrink: 0; }

/* "New" episode badge */
.hm-badge-new {
    background: linear-gradient(135deg, rgba(52,211,153,0.92), rgba(16,185,129,0.92));
    color: #052e16;
    padding: 3px 9px;
    border-radius: 7px;
    font-size: 0.67rem;
    font-weight: 800;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 8px rgba(52,211,153,0.35);
}

/* ── Play Overlay ── */
.hm-play-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,0.55) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s;
    z-index: 3;
    border-radius: var(--hm-radius);
}
.hm-card:hover .hm-play-overlay { opacity: 1; }

.hm-play-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(245,158,11,0.88) 0%, rgba(249,115,22,0.88) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255,255,255,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a0800;
    transform: scale(0.7);
    transition: transform 0.25s cubic-bezier(.25,.46,.45,.94), box-shadow 0.25s;
    box-shadow:
        0 4px 20px rgba(245,158,11,0.55),
        0 1px 0 rgba(255,255,255,0.3) inset;
}
.hm-card:hover .hm-play-btn { transform: scale(1); }
.hm-play-btn svg { fill: #1a0800; }

/* ── Text info below poster ── */
.hm-info {
    direction: rtl;
    text-align: center;
    padding: 0 2px;
}

.hm-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.73rem;
    color: var(--hm-text-muted);
    margin-bottom: 5px;
    flex-wrap: wrap;
}

.hm-genre {
    color: var(--hm-accent);
    font-weight: 600;
}

.hm-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--hm-text-primary);
    margin: 0 0 3px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.22s;
}
.hm-card:hover .hm-card-title { color: #fde68a; }

.hm-card-subtitle {
    font-size: 0.77rem;
    color: #555568;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ═══════════════════ EPISODE / LANDSCAPE CARD ═══════════════════ */
.hm-ep-card {
    /* NO backdrop-filter: the thumbnail image covers the card.
       Keeping blur here forces a GPU compositor layer on every episode card → jank. */
    background: linear-gradient(
        145deg,
        rgba(25,15,5,0.92) 0%,
        rgba(15,10,5,0.88) 100%
    );
    border: 1px solid var(--hm-glass-border);
    border-top: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--hm-radius);
    overflow: hidden;
    direction: rtl;
    cursor: pointer;
    contain: layout style;

    box-shadow:
        0 1px 0 rgba(255,255,255,0.14) inset,
        0 8px 28px rgba(0,0,0,0.5),
        0 2px 6px rgba(0,0,0,0.3);

    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.hm-ep-card:hover {
    transform: translateY(-5px);
    will-change: transform;
    border-color: rgba(245,158,11,0.48);
    box-shadow:
        0 1px 0 rgba(255,255,255,0.2) inset,
        0 14px 38px rgba(245,158,11,0.22),
        0 4px 12px rgba(0,0,0,0.4);
}

.hm-ep-thumb {
    position: relative;
    width: 100%;
    height: 110px;
    overflow: hidden;
}
.hm-ep-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.32s;
}
.hm-ep-card:hover .hm-ep-thumb img { transform: scale(1.06); }

.hm-ep-play-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.38);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.22s;
}
.hm-ep-card:hover .hm-ep-play-overlay { opacity: 1; }

.hm-ep-play-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, rgba(245,158,11,0.9), rgba(249,115,22,0.9));
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.28);
    display: flex; align-items: center; justify-content: center;
    color: #1a0800;
    transform: scale(0.7); transition: transform 0.22s;
    box-shadow: 0 3px 14px rgba(245,158,11,0.5);
}
.hm-ep-card:hover .hm-ep-play-btn { transform: scale(1); }
.hm-ep-play-btn svg { fill: #1a0800; }

.hm-ep-badge-new {
    position: absolute; top: 7px; right: 7px;
    background: linear-gradient(135deg, rgba(52,211,153,0.92), rgba(16,185,129,0.92));
    color: #052e16; padding: 2px 7px; border-radius: 5px;
    font-size: 0.63rem; font-weight: 800; z-index: 2;
    border: 1px solid rgba(255,255,255,0.2);
}

.hm-ep-date {
    position: absolute; bottom: 7px; left: 7px;
    background: rgba(0,0,0,0.78);
    backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    color: #9ca3af; padding: 2px 7px; border-radius: 5px;
    font-size: 0.6rem; display: flex; align-items: center; gap: 3px;
    z-index: 2; border: 1px solid rgba(255,255,255,0.08);
}
.hm-ep-date svg { fill: var(--hm-accent); }

.hm-ep-info { padding: 10px 12px 13px; }

.hm-ep-title {
    font-size: 0.86rem; font-weight: 700;
    color: var(--hm-text-primary); margin: 0 0 6px;
    text-align: right;
    display: -webkit-box;
    -webkit-line-clamp: 1; line-clamp: 1;
    -webkit-box-orient: vertical; overflow: hidden;
    transition: color 0.22s;
}
.hm-ep-card:hover .hm-ep-title { color: #fde68a; }

.hm-ep-season {
    font-size: 0.7rem; color: var(--hm-text-muted);
    display: flex; align-items: center; gap: 5px;
}
.hm-ep-season svg { fill: var(--hm-accent); flex-shrink: 0; }

/* ═══════════════════ RESPONSIVE — MOBILE ═══════════════════ */
@media (max-width: 768px) {
    .hm-module { margin-bottom: 38px; }
    .hm-title  { font-size: 1.15rem; }
    .hm-title-icon { width: 30px; height: 30px; border-radius: 8px; }
    .hm-title-icon svg { width: 15px; height: 15px; }
    .hm-view-all { padding: 5px 12px; font-size: 0.78rem; }

    /* Horizontal scroll strip */
    .hm-grid {
        display: flex;
        flex-wrap: nowrap;
        gap: 12px;
        overflow-x: auto;
        scroll-behavior: smooth;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;             /* room for shadow */
        scrollbar-width: none;
        -ms-overflow-style: none;
        /* extend to fill full width past module padding */
        margin: 0 calc(-1 * var(--hm-padding));
        padding-left: var(--hm-padding);
        padding-right: var(--hm-padding);
    }
    .hm-grid::-webkit-scrollbar { display: none; }

    .hm-card {
        flex: 0 0 145px;
        scroll-snap-align: start;
    }
    .hm-ep-card {
        flex: 0 0 165px;
        scroll-snap-align: start;
    }
    .hm-ep-thumb { height: 92px; }
    .hm-play-btn { width: 40px; height: 40px; }
    .hm-badge-quality,
    .hm-badge-imdb { font-size: 0.62rem; }
    .hm-card-title { font-size: 0.8rem; }
    .hm-header { margin-bottom: 16px; }
}

@media (max-width: 480px) {
    .hm-module { padding: 0 12px; }
    .hm-card   { flex: 0 0 130px; }
    .hm-ep-card{ flex: 0 0 150px; }
    .hm-title  { font-size: 1rem; }
    .hm-grid {
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
}

/* =========================================================================
   Continue Watching Specific Supplements
   ========================================================================= */
.continue-watching-progress-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px; /* Thicker for better visibility */
    background: rgba(0, 0, 0, 0.6);
    z-index: 4;
}

.continue-watching-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b 0%, #f97316 100%);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(249, 115, 22, 0.5);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

.hm-badge-resume {
    position: absolute;
    bottom: 15px; /* Position above progress bar */
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(245,158,11,0.95) 0%, rgba(249,115,22,0.95) 100%);
    color: #1a0800;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 5;
    box-shadow: 0 4px 15px rgba(249,115,22,0.4), 0 1px 0 rgba(255,255,255,0.2) inset;
    backdrop-filter: blur(4px);
    width: max-content;
    border: 1px solid rgba(255,255,255,0.18);
}

.hm-badge-resume svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* =========================================================================
   Domains / Partners List Specific Supplements
   ========================================================================= */
.hm-domains-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 0;
}

@media (min-width: 768px) {
    .hm-domains-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.hm-domain-card {
    background: rgba(17, 17, 19, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px 20px;
    text-align: center;
    color: #f1f1f1;
    font-size: 1.1rem;
    font-weight: 700;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s, background-color 0.3s;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.hm-domain-card:hover {
    transform: translateY(-4px);
    border-color: rgba(247,200,0,0.45);
    box-shadow: 0 10px 25px rgba(247,200,0,0.15);
    background: rgba(247,200,0,0.1);
    color: #fde68a;
}
