/* ═══════════════════════════════════════════════════════════════════
   ✦ SNAI NETFLIX-LEVEL UI — المستوى الأعلى ✦
   تجربة مشاهدة تنافس Netflix من حيث التصميم والتفاعل
═══════════════════════════════════════════════════════════════════ */

/* ── Header: scroll-aware transparency ── */
.site-header {
    transition: background 0.4s ease, box-shadow 0.4s ease, backdrop-filter 0.4s ease;
}

.site-header.scrolled {
    background: rgba(8, 6, 7, 0.97) !important;
    backdrop-filter: blur(20px) !important;
    box-shadow: 0 1px 0 rgba(255,255,255,0.06), 0 8px 32px rgba(0,0,0,0.5) !important;
}

/* ── Netflix-style Row Layout ── */
.movies-section {
    padding: 10px 0 36px;
    overflow: hidden;
}

.movies-section .snai-section-header {
    padding: 0 6%;
    margin-bottom: 16px;
}

/* أعد تخطيط الشبكة لتصبح سطر أفقي قابل للتمرير */
.movies-section .movies-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    gap: 10px;
    padding: 16px 6% 24px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* hide scrollbar */
    content-visibility: auto;
    contain-intrinsic-size: auto 320px;
}

.movies-section .movies-grid::-webkit-scrollbar {
    display: none;
}

/* كل كارت بعرض ثابت مثل Netflix */
.movies-section .movie-card-link {
    flex: 0 0 200px;
    min-width: 200px;
    scroll-snap-align: start;
}

@media (max-width: 768px) {
    .movies-section .movie-card-link {
        flex: 0 0 150px;
        min-width: 150px;
    }

    .movies-section .movies-grid {
        gap: 8px;
        padding: 12px 16px 20px;
    }

    .movies-section .snai-section-header {
        padding: 0 16px;
    }
}

/* ── Netflix Card Expand Tooltip ── */
.movie-card-link {
    position: relative;
}

/* Expanded hover card — Netflix style */
.movie-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: 14px;
    background: #1a1516;
    transition: none;
}

/* ── Cinematic Section Header ── */
.snai-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.snai-section-title {
    border-bottom: none;
    padding-bottom: 0;
}

.snai-section-title::after {
    display: none;
}

.snai-section-index {
    display: none; /* إخفاء رقم السكشن */
}

.snai-section-label {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-color);
    position: relative;
    padding-right: 14px;
}

.snai-section-label::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 80%;
    background: linear-gradient(to bottom, var(--gold-mid), var(--gold-dark));
    border-radius: 2px;
}

/* "شاهد الكل" button removed */

/* ── Hero: Netflix Cinematic Grade ── */
.hero-section {
    height: 92vh;
    min-height: 600px;
    background-attachment: fixed; /* Parallax subtle */
}

@media (max-width: 768px) {
    .hero-section {
        background-attachment: scroll;
    }
}

/* Cinematic lens-flare effect */
.hero-section::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 50%;
    height: 80%;
    background: radial-gradient(
        ellipse at center,
        rgba(223, 177, 91, 0.06) 0%,
        transparent 65%
    );
    pointer-events: none;
    z-index: 1;
    animation: lensFlare 8s ease-in-out infinite alternate;
}

@keyframes lensFlare {
    from { opacity: 0.4; transform: scale(0.95) rotate(-5deg); }
    to   { opacity: 1;   transform: scale(1.05) rotate(5deg); }
}

/* ── Netflix Hero Stats Bar ── */
.hero-stats {
    display: flex;
    gap: 24px;
    margin: 18px 0;
    animation: heroSlideUp 0.9s 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.hero-stat-value {
    font-size: 22px;
    font-weight: 900;
    font-family: 'Cinzel', serif;
    color: var(--gold-light);
    line-height: 1;
}

.hero-stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-top: 3px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* ── Netflix Top 10 Badge ── */
.card-top10 {
    position: absolute;
    bottom: 0;
    left: 0;
    font-family: 'Cinzel', serif;
    font-size: 72px;
    font-weight: 900;
    line-height: 0.8;
    color: transparent;
    -webkit-text-stroke: 3px rgba(255,255,255,0.85);
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.8));
}

/* ── Netflix "New Episode" / "HD" Labels ── */
.card-badge {
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-size: 11px;
    backdrop-filter: blur(8px);
    padding: 4px 9px;
}

.card-badge-new {
    background: linear-gradient(135deg, rgba(223,177,91,0.85), rgba(184,137,46,0.85));
    border: 1px solid rgba(223,177,91,0.5);
    color: #0d0a0b;
    text-shadow: none;
    font-weight: 900;
}

/* ── Horizontal Row Scroll Arrows (Desktop) ── */
.movies-section {
    position: relative;
}

.row-arrow {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 48px;
    height: 48px;
    background: rgba(13, 10, 11, 0.85);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
    backdrop-filter: blur(6px);
}

@media (min-width: 769px) {
    .row-arrow { display: flex; }
}

.row-arrow:hover {
    background: rgba(223,177,91,0.2);
    border-color: rgba(223,177,91,0.5);
    transform: translateY(-50%) scale(1.08);
}

.row-arrow svg {
    width: 20px;
    height: 20px;
}

.row-arrow-right { right: 12px; }
.row-arrow-left  { left: 12px; }

/* ── Watch Page: Netflix-level redesign ── */
.watch-container {
    padding: 0 0 60px;
    max-width: 100%;
    background: #030202;
}

.player-section {
    max-width: 1340px;
    margin: 0 auto;
    padding: 100px 32px 32px;
}

@media (max-width: 768px) {
    .player-section {
        padding: 88px 0 24px;
    }
}

.watch-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 14px;
}

.snai-player-wrapper {
    border-radius: 12px;
    background: #000;
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.06),
        0 32px 80px rgba(0,0,0,0.95),
        0 0 120px rgba(223,177,91,0.04);
}

/* ── Server Switch: Netflix Quality Selector ── */
.player-server-switch {
    gap: 10px;
    padding: 16px 0 4px;
    justify-content: flex-start;
}

.player-server-label {
    color: rgba(255,255,255,0.4);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    align-self: center;
    margin-left: 4px;
}

/* ── Episode Grid: Netflix Season Layout ── */
.episode-nav {
    background: rgba(10,8,9,0.6);
    border-radius: 14px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.06);
    margin-top: 28px;
    backdrop-filter: blur(10px);
}

.episode-nav .section-title {
    font-size: 16px;
    margin-bottom: 16px;
    color: rgba(255,255,255,0.8);
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
}

.episode-nav-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 8px;
}

@media (max-width: 768px) {
    .episode-nav-list {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
}

.episode-nav-item {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(26,21,22,0.8);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 0;
    min-width: unset;
    transition: all 0.22s ease;
}

.episode-nav-item:hover {
    background: rgba(40,33,36,0.9);
    border-color: rgba(223,177,91,0.4);
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.episode-nav-item.active {
    background: linear-gradient(135deg, rgba(223,177,91,0.25), rgba(223,177,91,0.12));
    border-color: var(--gold-mid);
    box-shadow:
        0 0 0 1px rgba(223,177,91,0.2),
        0 6px 20px rgba(223,177,91,0.15);
}

.ep-num {
    font-size: 17px;
    font-weight: 900;
}

.ep-name {
    display: none; /* في الـ grid لا نحتاجها */
}

/* ── Movie Detail: Netflix Cinematic ── */
.detail-hero {
    background-size: cover;
    background-position: center 20%;
}

.detail-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        ellipse at 80% 50%,
        rgba(223,177,91,0.04) 0%,
        transparent 60%
    );
    pointer-events: none;
    z-index: 1;
}

.detail-content {
    position: relative;
    z-index: 2;
}

/* Poster glow effect */
.detail-poster {
    position: relative;
}

.detail-poster::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 40px;
    background: radial-gradient(ellipse, rgba(223,177,91,0.25), transparent 70%);
    filter: blur(10px);
    pointer-events: none;
}

/* ── Toast Notifications ── */
.snai-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20,16,18,0.95);
    border: 1px solid rgba(223,177,91,0.3);
    border-radius: 12px;
    padding: 14px 24px;
    color: #fff;
    font-size: 14px;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    z-index: 99999;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(223,177,91,0.1);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16,1,0.3,1);
    pointer-events: none;
    white-space: nowrap;
}

.snai-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Continue Watching: Netflix Tray ── */
.continue-watching-section {
    overflow: visible;
}

.continue-watching-section .continue-watching-row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    padding: 12px 6% 24px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.continue-watching-section .continue-watching-row::-webkit-scrollbar {
    display: none;
}

.continue-card {
    flex: 0 0 180px;
    min-width: 180px;
}

.continue-card:hover {
    transform: translateY(-5px) scale(1.02);
}

/* ── Progress Bar Tooltip ── */
.continue-progress {
    position: relative;
}

.continue-progress-bar::after {
    content: attr(data-percent);
    position: absolute;
    top: -26px;
    right: 0;
    font-size: 11px;
    color: var(--gold-light);
    font-weight: 700;
    background: rgba(0,0,0,0.8);
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.continue-card:hover .continue-progress-bar::after {
    opacity: 1;
}

/* ── Genre Tags: Gold Identity ── */
.genres {
    gap: 8px;
}

.genre-tag {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: default;
    letter-spacing: 0.3px;
    background: rgba(223,177,91,0.1);
    border: 1px solid rgba(223,177,91,0.3);
    color: var(--gold-light);
    transition: all 0.25s ease;
}

.genre-tag:hover {
    background: rgba(223,177,91,0.18);
    border-color: rgba(223,177,91,0.5);
    color: #fff;
    transform: translateY(-1px);
}

/* ── Fade-in on scroll (IntersectionObserver support) ── */
.movies-section {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.movies-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Active nav link indicator ── */
nav a.active {
    position: relative;
}

nav a.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--gold-mid), var(--gold-light));
    border-radius: 2px;
}

/* ── Section Lead Text ── */
.snai-section-lead {
    display: none; /* تقليص للنظافة */
}

/* ── Premium hover state for search dropdown items ── */
.search-dropdown-item {
    transition: background 0.2s ease, padding-right 0.2s ease;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    border-radius: 8px;
    margin: 2px 6px;
}

.search-dropdown-item:hover {
    background: rgba(223,177,91,0.08);
    padding-right: 20px;
    border-color: rgba(223,177,91,0.1);
}

.search-dropdown-title {
    font-weight: 700;
    font-size: 14px;
}

.search-dropdown-year {
    font-size: 12px;
    color: var(--gold-mid);
    font-weight: 700;
}

/* ── Smooth image loading ── */
img {
    transition: opacity 0.4s ease;
}

img[data-loaded="false"] {
    opacity: 0;
}

img[data-loaded="true"] {
    opacity: 1;
}

/* ── Watch Page Episode Current Info ── */
.episode-current-info {
    background: rgba(20,16,18,0.6);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.episode-current-info h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--gold-light);
    margin-bottom: 8px;
}

.episode-current-info p {
    font-size: 14px;
    line-height: 1.7;
    color: rgba(255,255,255,0.65);
    margin: 0;
}

/* ── Footer: Netflix-style ── */
.site-footer {
    padding: 48px 6%;
    background: rgba(5,3,4,0.98) !important;
    border-top: 1px solid rgba(255,255,255,0.05) !important;
}

.footer-copy {
    font-size: 13px;
    color: rgba(255,255,255,0.3);
    margin-bottom: 20px;
}

/* ── Back to Top Button ── */
#snai-back-top {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 44px;
    height: 44px;
    background: rgba(20,16,18,0.9);
    border: 1px solid rgba(223,177,91,0.3);
    border-radius: 50%;
    color: var(--gold-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
    backdrop-filter: blur(10px);
    pointer-events: none;
}

#snai-back-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#snai-back-top:hover {
    background: rgba(223,177,91,0.15);
    border-color: var(--gold-mid);
}

#snai-back-top svg {
    width: 18px;
    height: 18px;
}


/* ═══════════════════════════════════════════════════
   ✦ SNAI GOLD IDENTITY POLISH — الهوية الذهبية ✦
═══════════════════════════════════════════════════ */

/* ── Metadata Chips: الموسم / الحلقة / السنة / المدة ── */
.detail-meta {
    gap: 10px;
    flex-wrap: wrap;
}

.detail-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(223,177,91,0.08);
    border: 1px solid rgba(223,177,91,0.22);
    border-radius: 20px;
    padding: 5px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold-light);
    backdrop-filter: blur(6px);
    transition: all 0.25s ease;
}

.detail-meta span:hover {
    background: rgba(223,177,91,0.14);
    border-color: rgba(223,177,91,0.4);
    transform: translateY(-1px);
}

/* Rating badge أقوى */
.rating-badge {
    background: rgba(223,177,91,0.15) !important;
    border-color: rgba(223,177,91,0.45) !important;
    color: var(--gold-light) !important;
    font-weight: 900 !important;
    font-size: 14px !important;
    box-shadow: 0 0 12px rgba(223,177,91,0.15);
}

/* ── Episode Meta: الحلقة / المدة / التاريخ ── */
.episode-meta {
    gap: 8px;
    flex-wrap: wrap;
}

.episode-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    color: var(--gold-mid);
    background: rgba(223,177,91,0.07);
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid rgba(223,177,91,0.15);
}

/* ── Episode Cards: Premium ── */
.episode-card {
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.3s ease;
}

.episode-card:hover {
    border-color: rgba(223,177,91,0.25);
    background: rgba(26,21,22,0.95);
    transform: translateX(-4px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.4), 0 0 0 1px rgba(223,177,91,0.1);
}

.episode-info h3 {
    color: var(--gold-light);
    font-weight: 800;
    font-size: 15px;
}

.episode-play-icon {
    background: rgba(223,177,91,0.92);
    color: #0d0a0b;
    font-size: 16px;
    font-weight: 900;
    box-shadow: 0 4px 16px rgba(223,177,91,0.5);
}

.episode-card:hover .episode-play-icon {
    opacity: 1;
    transform: translate(-50%,-50%) scale(1.1);
}

/* ── Season Page Headers ── */
.season-header h1 {
    background: linear-gradient(135deg, #fff 65%, var(--gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 34px;
    font-weight: 800;
}

.season-header h2 {
    color: var(--gold-mid);
    font-weight: 700;
}

.season-info h3 {
    color: var(--gold-light);
    font-weight: 800;
}

/* ── Consistent Card Badge ── */
.card-badge {
    background: rgba(13,10,11,0.88);
    border: 1px solid rgba(223,177,91,0.4);
    color: var(--gold-light);
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 0.5px;
    border-radius: 8px;
    padding: 4px 9px;
    backdrop-filter: blur(8px);
}

/* ── Tagline: Gold ── */
.tagline {
    color: var(--gold-mid);
    font-style: italic;
    font-weight: 600;
    opacity: 1;
}

/* ── Director Info: Gold ── */
.director {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
}

.director strong {
    color: var(--gold-light);
    font-weight: 800;
}

/* ── Section Titles: Gold ── */
.section-title {
    color: var(--gold-light);
    font-weight: 800;
}

.section-title::after {
    background: linear-gradient(90deg, var(--gold-mid), var(--gold-light));
}

/* ── Vintage Badge: Gold Refined ── */
.vintage-badge {
    color: var(--gold-light);
    border-color: rgba(223,177,91,0.5);
    font-weight: 700;
    letter-spacing: 2px;
}

/* ── Season Card Hover: Gold ── */
.season-card:hover {
    border-color: rgba(223,177,91,0.4);
    box-shadow: 0 12px 32px rgba(223,177,91,0.1), 0 0 0 1px rgba(223,177,91,0.15);
}

/* ── Error Page: Gold Gradient ── */
.error-code {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
}

/* ── Loading Spinner: Gold ── */
@keyframes snai-spin { to { transform: rotate(360deg); } }

.snai-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(223,177,91,0.12);
    border-top-color: var(--gold-mid);
    border-radius: 50%;
    animation: snai-spin 0.8s linear infinite;
}

/* ── Mobile Adjustments ── */
@media (max-width: 768px) {
    .detail-meta span {
        font-size: 12px;
        padding: 4px 10px;
    }

    .episode-meta span {
        font-size: 11px;
        padding: 2px 8px;
    }

    .episode-card:hover {
        transform: none;
    }

    .season-header h1 {
        font-size: 24px;
    }
}
