/* الأكواد الأساسية للصفحة والتصميم الاحترافي الجديد - "Galactic Noir v3.3 - Transparent Overlay" */
:root {
    /* لوحة ألوان "Galactic Noir" النهائية - احترافية وفخمة للغاية */
    --dark-color: #03060B; /* Deep Space Black - أسود كوني عميق جداً */
    --light-dark-color: #0B111A; /* Stellar Dust Grey - رمادي أزرق داكن ناعم */
    --primary-color: #7B1FA2; /* Galactic Violet - بنفسجي مجرة غني وساطع */
    --secondary-color: #FF5252; /* Comet Red - أحمر ناري جذاب ومميز */
    --accent-color: #00E5FF; /* Plasma Teal - أزرق مخضر نيون متلألئ للبروز */
    --text-color: #EBF2F8; /* Zenith White - أبيض مضيء ونقي */
    --text-muted: #6C7A89; /* Cosmic Whisper Grey - رمادي هادئ للنصوص الثانوية */

    --gradient-start-bg: #020306;
    --gradient-end-bg: #080D15;
    --gradient-hero-overlay: linear-gradient(to bottom, rgba(3, 6, 11, 0.99) 0%, rgba(3, 6, 11, 0.7) 50%, transparent 100%);
    --gradient-button: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);

    --font-family-arabic: 'Cairo', sans-serif;
    --font-family-headings: 'Orbitron', sans-serif;
    --transition-speed: 0.3s; /* سرعة انتقال محسنة جداً وأكثر استجابة */
    --border-radius-base: 8px; /* زوايا مستديرة ناعمة وعصرية */

    /* ظلال وتوهجات احترافية ومتحكمة للغاية */
    --shadow-deep: 0 10px 25px rgba(0, 0, 0, 0.75); /* ظل عميق وواضح */
    --shadow-subtle-glow: 0 0 15px var(--accent-color), 0 0 30px rgba(0, 229, 255, 0.3); /* توهج نيون متوهج لكن متحكم به */
    --shadow-inset-dark: inset 0 0 10px rgba(0, 0, 0, 0.8); /* ظل داخلي للعمق النجمي */
    --shadow-button: 0 6px 15px rgba(255, 82, 82, 0.4); /* ظل زر ينبض بالطاقة */
    --shadow-focus-pulse: 0 0 10px var(--primary-color); /* نبض تركيز بنفسجي جذاب */
}

/* استيراد خطوط جوجل الجديدة */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;900&family=Orbitron:wght@700;900&display=swap');

/* إعادة ضبط أساسي ومُحسّن */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, opacity, box-shadow, background, color; 
    outline: none; 
}

html {
    font-size: 16px; 
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale; 
}

body {
    font-family: var(--font-family-arabic);
    background: radial-gradient(at 20% 80%, var(--gradient-start-bg) 0%, var(--gradient-end-bg) 70%),
                radial-gradient(at 80% 20%, var(--gradient-end-bg) 0%, var(--dark-color) 70%);
    background-attachment: fixed; 
    color: var(--text-color);
    line-height: 1.5; 
    direction: rtl; 
    text-align: right; 
    overflow-x: hidden; 
    min-height: 100vh; 
    font-size: 1rem; 
    position: relative;
}

/* شريط التمرير المخصص - تصميم احترافي وناعم */
body::-webkit-scrollbar {
    width: 8px; 
}

body::-webkit-scrollbar-track {
    background: var(--dark-color); 
    border-radius: 5px;
}

body::-webkit-scrollbar-thumb {
    background: var(--primary-color); 
    border-radius: 5px;
    border: 1px solid var(--dark-color);
}

body::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
    box-shadow: 0 0 3px var(--secondary-color);
}

/* تأثير نجوم خلفي متحرك خفيف ومحترف */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--text-color) 0.4px, transparent 0.4px),
                      radial-gradient(var(--text-muted) 0.2px, transparent 0.2px);
    background-size: 160px 160px, 90px 90px; 
    opacity: 0.025; 
    z-index: -1; 
    animation: star-field 80s linear infinite; 
}
@keyframes star-field {
    from { background-position: 0 0; }
    to { background-position: 800px 800px; }
}

.container {
    width: 95vw;
    max-width: 1250px;
    margin: auto;
    overflow: hidden; 
    padding: 0 0.7rem;
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: all var(--transition-speed) ease-in-out;
}

a:hover {
    color: var(--accent-color);
    transform: translateY(-1px);
    text-shadow: 0 0 6px var(--accent-color);
}

/* الأزرار الأساسية - تصميم "Aurora Button" جديد وأكثر احترافية */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-button);
    color: var(--text-color);
    padding: 0.7rem 1.6rem;
    border: none;
    cursor: pointer;
    font-family: var(--font-family-arabic);
    font-size: clamp(0.8rem, 0.9vw, 0.9rem);
    border-radius: var(--border-radius-base);
    transition: all var(--transition-speed) ease-in-out;
    box-shadow: var(--shadow-button);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    position: relative;
    overflow: hidden;
    font-weight: 700;
    border: 1px solid transparent;
    backdrop-filter: blur(3px); 
}

.btn:hover {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--primary-color) 100%);
    transform: translateY(-2px) scale(1.01);
    box-shadow: var(--shadow-subtle-glow), 0 0 10px var(--primary-color);
    border-color: var(--accent-color);
    color: var(--dark-color);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-10deg);
    transition: left calc(var(--transition-speed) * 0.4) ease-out;
}

.btn:hover::before {
    left: 100%;
}

/* Header - تصميم "Celestial Frame Header" - أنيق ومحترف للغاية */
.main-header {
    background: rgba(3, 6, 11, 0.97);
    backdrop-filter: blur(15px) saturate(1.5);
    color: var(--text-color);
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-deep);
    transition: background var(--transition-speed) ease, padding var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.main-header .container {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center; 
    gap: 0.7rem;
}

/* اللوجو الجديد والنهائي - تصميم "Quantum Glyph Logo" - احترافي ومميز جدًا */
.main-header .logo {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-family-headings);
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 900;
    letter-spacing: 2px;
    flex-shrink: 0;
    text-transform: uppercase;
    transition: all var(--transition-speed) ease-in-out;
    position: relative;
    background: none; 
    -webkit-background-clip: unset; 
    background-clip: unset; 
    color: var(--text-color); 
    -webkit-text-fill-color: var(--text-color); 

    text-shadow:
        0 0 8px rgba(0, 229, 255, 0.3),
        0 0 15px rgba(255, 82, 82, 0.15);
    animation: logo-glow-pulse 1.8s infinite alternate ease-in-out;
}

/* تأثير النقطة المميزة في اللوجو */
.main-header .logo .logo-dot {
    color: var(--secondary-color);
    font-size: 1.1em;
    line-height: 1;
    margin-right: -0.08em;
    position: relative;
    top: 0.03em;
    transition: all var(--transition-speed) ease-in-out;
    text-shadow:
        0 0 10px var(--secondary-color),
        0 0 20px rgba(255, 82, 82, 0.5);
    animation: dot-pulse 1.3s infinite alternate ease-in-out 0.1s;
}

@keyframes logo-glow-pulse {
    0% {
        text-shadow:
            0 0 6px rgba(0, 229, 255, 0.2),
            0 0 10px rgba(255, 82, 82, 0.1);
    }
    100% {
        text-shadow:
            0 0 12px rgba(0, 229, 255, 0.4),
            0 0 20px rgba(255, 82, 82, 0.25);
    }
}
@keyframes dot-pulse {
    0% { transform: scale(1); text-shadow: 0 0 8px var(--secondary-color), 0 0 15px rgba(255, 82, 82, 0.3); }
    100% { transform: scale(1.03); text-shadow: 0 0 15px var(--secondary-color), 0 0 25px rgba(255, 82, 82, 0.5); }
}


.main-header .logo:hover {
    transform: scale(1.02);
    text-shadow: var(--shadow-subtle-glow);
    animation: none;
}
.main-header .logo:hover .logo-dot {
    transform: scale(1.08);
    animation: none;
}


/* تحديثات الـ Nav - أنيقة ومضغوطة */
.main-nav {
    flex-grow: 1;
    display: flex; /* دائماً flex */
    justify-content: flex-end;
    align-items: center; 
    max-height: none; 
    overflow: visible;
    opacity: 1;
    pointer-events: auto;
    transition: none;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-direction: row; /* دائماً صف واحد */
    align-items: center; 
    padding: 0;
    margin: 0;
}

.main-nav ul li {
    margin-right: 1.2rem;
    position: relative;
}

.main-nav ul li:last-child {
    margin-right: 0;
}

.main-nav ul li a {
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    padding: 0.6rem 1.1rem;
    border-radius: var(--border-radius-base);
    transition: all var(--transition-speed) ease-in-out;
    position: relative;
    overflow: hidden;
    font-weight: 600;
    text-shadow: 0 0 3px rgba(0,0,0,0.4);
    letter-spacing: 0.3px;

    background: rgba(123, 31, 162, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--text-color);
    backdrop-filter: blur(5px);
    box-shadow: 0 0 8px rgba(123, 31, 162, 0.2);
}

.main-nav ul li a::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(to right, var(--accent-color), var(--secondary-color));
    box-shadow: 0 0 10px var(--accent-color), 0 0 20px rgba(0, 229, 255, 0.4);
    transition: width calc(var(--transition-speed) * 1.5) cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transform-origin: left;
}

.main-nav ul li a:hover::before {
    width: 100%;
    right: 0;
}

.main-nav ul li a:hover {
    background-color: var(--light-dark-color);
    color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-color), 0 0 25px rgba(0, 229, 255, 0.3);
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

/* Search Container - تصميم "Stealth Search" */
.search-container {
    display: flex;
    align-items: center;
    background: var(--light-dark-color);
    border-radius: var(--border-radius-base);
    padding: 0.25rem 0.6rem;
    box-shadow: var(--shadow-inset-dark);
    border: 1px solid var(--primary-color);
    flex-shrink: 0;
    transition: all var(--transition-speed) ease-in-out;
    position: relative;
}
.search-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 6px var(--accent-color), var(--shadow-inset-dark);
}

.search-container input {
    padding: 0.35rem 0.6rem;
    border: none;
    border-radius: var(--border-radius-base);
    background: transparent;
    color: var(--text-color);
    margin-right: 0.4rem;
    outline: none;
    width: clamp(130px, 13vw, 180px);
    font-size: clamp(0.7rem, 0.8vw, 0.85rem);
    transition: all var(--transition-speed);
}

.search-container input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.search-container input:focus {
    color: var(--accent-color);
    transform: scale(1.001);
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.3);
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.1);
}

.search-container button {
    padding: 0.35rem 1rem;
    background: var(--accent-color);
    color: var(--dark-color);
    border: none;
    border-radius: var(--border-radius-base);
    cursor: pointer;
    transition: all var(--transition-speed) ease-in-out;
    font-size: clamp(0.7rem, 0.8vw, 0.85rem);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 3px 6px rgba(0, 229, 255, 0.2);
}

.search-container button:hover {
    background: var(--secondary-color);
    transform: translateY(-1px) scale(1.01);
    box-shadow: var(--shadow-button);
    color: var(--text-color);
}

/* Mobile Menu Toggle - REMOVED (will be removed from HTML too) */
.menu-toggle {
    display: none !important; /* ضمان إخفاء تام */
}


/* Hero Section - تصميم "Cosmic Panorama" - واسع ومؤثر */
.hero {
    background: var(--gradient-hero-overlay),
                url('https://images.unsplash.com/photo-1542204165-f938d2279b33?q=80&w=2670&auto=format&fit=cover') no-repeat center center/cover;
    height: 60vh;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    text-align: right;
    color: var(--text-color);
    position: relative;
    z-index: 1;
    padding: 0 2.5vw;
    box-shadow: var(--shadow-deep);
    border-bottom: 2px solid var(--primary-color);
    overflow: hidden;
}

/* إضافة تأثير جزيئات خفيفة في الهيرو */
.hero::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--accent-color) 0.4px, transparent 0.4px);
    background-size: 50px 50px;
    opacity: 0.06;
    animation: particle-float 20s linear infinite alternate;
    z-index: -1;
}

@keyframes particle-float {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

.hero h1 {
    font-family: var(--font-family-headings);
    font-size: clamp(2.4rem, 4.2vw, 3.6rem);
    margin-bottom: 1.5vh;
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.4), 0 0 25px rgba(123, 31, 162, 0.3);
    line-height: 1.05;
    font-weight: 900;
    letter-spacing: 1.2px;
    max-width: 550px;
    animation: fadeInScale 0.9s ease-out forwards;
}
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.hero p {
    font-family: var(--font-family-arabic);
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    margin-bottom: 2.2vh;
    max-width: 550px;
    opacity: 0.8;
    background: rgba(3, 6, 11, 0.4);
    padding: 0.7rem 1.4rem;
    border-radius: var(--border-radius-base);
    backdrop-filter: blur(5px);
    box-shadow: var(--shadow-inset-dark), 0 0 5px rgba(123, 31, 162, 0.2);
    border: 1px solid var(--primary-color);
    animation: fadeInSlideUp 0.9s ease-out forwards 0.1s;
}
@keyframes fadeInSlideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* Movie Grid Section - تصميم "Stellar Gallery" */
.movie-grid-section, .movie-details-section, .suggested-movies-section {
    padding: 3vw 0;
    background: radial-gradient(circle at center, var(--dark-color) 0%, var(--gradient-end-bg) 100%);
    border-bottom: 1px solid var(--light-dark-color);
}

.movie-grid-section h2, .movie-details-section h1, .suggested-movies-section h2 {
    font-family: var(--font-family-headings);
    text-align: center;
    margin-bottom: 2vw;
    font-size: clamp(2rem, 3.1vw, 2.7rem);
    color: var(--accent-color);
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.3), 0 0 20px rgba(255, 82, 82, 0.15);
    padding-bottom: 0.5rem;
    border-bottom: 1.5px solid var(--primary-color);
    display: inline-block;
    margin: 0 auto 2vw auto;
    width: fit-content;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.movie-grid {
    display: grid;
    /* ضمان 6 بوسترات على الكمبيوتر */
    grid-template-columns: repeat(6, 1fr);
    gap: 1.2vw;
    padding: 0 0.7vw;
}

/* Movie Card - تصميم "Orbital Disc" - أنيق ومرن */
.movie-card {
    background: var(--light-dark-color);
    border-radius: var(--border-radius-base);
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    transition: all var(--transition-speed) ease-in-out;
    cursor: pointer;
    text-align: center;
    position: relative;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;

    /* **جديد: تأثيرات الأشكال والأنيميشن للبوستر** */
    border: 2px solid transparent; /* بداية شفافة للحدود */
    box-shadow: 0 0 0 0 rgba(0, 229, 255, 0.0), 0 5px 15px rgba(0, 0, 0, 0.4); /* ظل مبدئي */
}

.movie-card:hover {
    transform: translateY(-8px) scale(1.03); /* زيادة تأثير الرفع والتكبير */
    box-shadow: var(--shadow-subtle-glow), 0 0 25px var(--primary-color), 0 0 40px rgba(0, 229, 255, 0.2); /* توهج أقوى */
    border-color: var(--accent-color); /* لون الحدود عند التحويم */
    z-index: 10;
}

/* **جديد: تأثير توهج الحدود عند التحويم** */
.movie-card::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color), var(--secondary-color), var(--primary-color));
    background-size: 400% 400%;
    border-radius: var(--border-radius-base);
    z-index: -1;
    opacity: 0;
    transition: opacity var(--transition-speed) ease-in-out;
    filter: blur(8px); /* تأثير توهج ضبابي */
}

.movie-card:hover::before {
    opacity: 1;
    animation: border-glow 3s linear infinite; /* أنيميشن دوران التوهج */
}

@keyframes border-glow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}


.movie-card img {
    /* **تعديل هنا** - زيادة الارتفاع لتقليل الاقتطاع */
    width: 100%;
    height: clamp(180px, 16vw, 250px); 
    object-fit: cover; /* يملأ المساحة مع القص إذا لزم الأمر */
    display: block;
    border-bottom: 1px solid var(--primary-color); 
    transition: transform var(--transition-speed) ease, filter var(--transition-speed) ease;
    flex-shrink: 0;
}

.movie-card:hover img {
    transform: scale(1.02); /* زيادة طفيفة في التكبير */
    filter: brightness(1.05) saturate(1.05); /* إضاءة وتشبع خفيف */
}

.movie-card h3 {
    /* **تعديل هنا** - زيادة min-height والسماح بالنص ليكون سطرين */
    font-size: clamp(0.9rem, 1.2vw, 1.05rem); 
    padding: 0.7rem 0.6rem; 
    color: var(--text-color);
    background-color: rgba(0, 0, 5, 0.8);
    margin-top: -1px;
    border-radius: 0 0 var(--border-radius-base) var(--border-radius-base);
    font-weight: 700;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: clamp(60px, 6.5vw, 75px); 
    text-shadow: 0 0 5px rgba(0, 229, 255, 0.2), 0 0 10px rgba(0,0,0,0.6); 
    line-height: 1.3; 

    /* **حل مشكلة النص المقطوع** */
    white-space: normal; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    display: -webkit-box; 
    -webkit-line-clamp: 2; 
    -webkit-box-orient: vertical; 
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

.movie-card:hover h3 {
    background-color: var(--primary-color); 
    color: var(--dark-color); 
    text-shadow: 0 0 5px rgba(0,0,0,0.5); 
}


/* Pagination - تصميم "Galactic Navigation" */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2.5vw;
    gap: 1vw;
}

.pagination .btn-page {
    background: var(--light-dark-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    padding: 0.6rem 1.3rem;
    border-radius: var(--border-radius-base);
    cursor: pointer;
    transition: all var(--transition-speed) ease-in-out;
    font-family: var(--font-family-arabic);
    font-size: clamp(0.75rem, 0.85vw, 0.85rem);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pagination .btn-page:hover:not(:disabled) {
    background: var(--primary-color);
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-button);
    color: var(--accent-color);
}

.pagination .btn-page:disabled {
    opacity: 0.2;
    cursor: not-allowed;
    background-color: var(--light-dark-color);
    border-color: var(--text-muted);
    box-shadow: var(--shadow-inset-dark);
}

/* Movie Details Section - تصميم "Infini-View" */
.movie-details-section {
    display: none;
    padding: 4vw 2vw;
    background: linear-gradient(to top, var(--dark-color) 0%, var(--gradient-end-bg) 100%);
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 0 18px rgba(0,0,0,0.6) inset;
    animation: fadeIn 0.4s ease-out;
}

.movie-details-section .back-btn {
    background: var(--light-dark-color);
    color: var(--text-color);
    border: 1px solid var(--primary-color);
    padding: 0.65rem 1.5rem;
    border-radius: var(--border-radius-base);
    cursor: pointer;
    transition: all var(--transition-speed) ease-in-out;
    margin-bottom: 2.5vw;
    font-family: var(--font-family-arabic);
    display: inline-block;
    font-size: clamp(0.75rem, 0.85vw, 0.85rem);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
    font-weight: 700;
    text-transform: uppercase;
}

.movie-details-section .back-btn:hover {
    background: var(--primary-color);
    transform: translateY(-1.5px);
    box-shadow: var(--shadow-button);
    color: var(--accent-color);
}

/* Video Player Wrapper - للتحكم في الحجم */
.video-player-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px; 
    height: 450px; 
    margin: 0 auto 2.5vw auto; 
    background-color: #000;
    border-radius: var(--border-radius-base);
    overflow: hidden;
    box-shadow: var(--shadow-deep);
    border: 1.5px solid var(--secondary-color);
}

/* الحاوية الداخلية التي سيتم إنشاء عنصر الفيديو فيها */
#movie-player-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* قواعد Video.js لضمان التكيف داخل الـ container */
.video-js {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important; 
    margin: 0 !important;
    padding: 0 !important;
    object-fit: cover; 
}

/* شريط التحكم لضمان دخوله داخل الفيديو وظهوره في الأسفل */
.video-js .vjs-control-bar {
    position: absolute !important; 
    bottom: 0 !important; 
    left: 0 !important; 
    width: 100% !important;
    height: 40px !important; 
    margin-bottom: 0 !important; 
    background-color: rgba(0, 0, 0, 0.7); 
    border-radius: 0 0 var(--border-radius-base) var(--border-radius-base); 
    z-index: 10; 
    opacity: 1; 
    visibility: visible; 
    transform: translateY(0) !important; 
    box-sizing: border-box; 
}

/* شريط التقدم والعناصر الطرفية داخل شريط التحكم */
.video-js .vjs-progress-control,
.video-js .vjs-remaining-time,
.video-js .vjs-current-time,
.video-js .vjs-time-divider {
    align-items: center !important; 
    display: flex !important; 
}


/* للتأكد من أن زر التشغيل الكبير في المنتصف */
.video-js .vjs-big-play-button { 
    top: 50% !important; 
    left: 50% !important; 
    transform: translate(-50%, -50%) !important; 
    margin: 0 !important;
}


/* أكواد الإعلانات المتعلقة بالـ overlay في الفيديو (تم تعديلها لتكون شفافة) */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.05); /* جعل الخلفية شبه شفافة جداً */
    opacity: 0.05; /* شفافة جداً */
    display: flex; 
    justify-content: center;
    align-items: center;
    cursor: pointer; 
    z-index: 50;
    visibility: visible;
    transition: opacity 0.3s ease, background-color 0.3s ease; 
}

.video-overlay.hidden { 
    opacity: 0;
    pointer-events: none; 
}

.video-loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    border-top: 4px solid var(--accent-color);
    width: 40px;
    height: 40px;
    animation: spin 0.4s linear infinite;
    display: none; 
    z-index: 60;
    filter: drop-shadow(0 0 6px var(--accent-color));
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.movie-info p {
    margin-bottom: 0.8rem;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.5;
    font-weight: 500;
    opacity: 0.8;
    text-shadow: 0 0 2px rgba(0,0,0,0.4);
    background: rgba(11, 17, 26, 0.5);
    padding: 0.7rem 1.4rem;
    border-radius: var(--border-radius-base);
    border: 1px solid var(--primary-color);
    margin-top: 0.6rem;
}
.movie-info p:first-of-type {
    margin-top: 0;
}

/* Poster in movie details */
#movie-details-poster {
    max-width: clamp(165px, 19vw, 260px);
    height: auto;
    border-radius: var(--border-radius-base);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
    display: block;
    margin: 0 auto 2.5vw auto;
    border: 2px solid var(--primary-color);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
#movie-details-poster:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-subtle-glow), 0 0 20px var(--secondary-color);
}

/* Suggested Movies Section */
.suggested-movies-section {
    display: none;
    margin-top: 3vw;
    padding-top: 3vw;
    border-top: 1px solid var(--light-dark-color);
}

/* Footer - تصميم "Cosmic Foundation" */
.main-footer {
    background-color: var(--light-dark-color);
    color: var(--text-muted);
    padding: 2.5vw 0;
    text-align: center;
    font-family: var(--font-family-arabic);
    border-top: 4px solid var(--primary-color);
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* تأثير جسيمات خافتة متحركة في الفوتر */
.main-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(var(--accent-color) 0.1px, transparent 0.1px);
    background-size: 60px 60px;
    background-position: 0 0;
    opacity: 0.03;
    animation: particle-move 25s linear infinite;
    z-index: 0;
}

@keyframes particle-move {
    from { background-position: 0 0; }
    to { background-position: 200px 200px; }
}

.main-footer .container {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 0.8vw;
    position: relative;
    z-index: 1;
}

.main-footer p {
    margin-bottom: 1.8vw;
    font-size: clamp(0.85rem, 1.05vw, 0.95rem);
    line-height: 1.5;
    opacity: 0.8;
    text-shadow: 0 0 1px rgba(0,0,0,0.3);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.8vw;
    margin-top: 1vw;
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    font-weight: 700;
    padding: 0.7rem 1.4rem;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius-base);
    transition: all var(--transition-speed) ease-in-out;
    white-space: nowrap;
    box-shadow: 0 3px 8px rgba(0, 229, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.footer-links a:hover {
    background-color: var(--accent-color);
    color: var(--dark-color);
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-subtle-glow);
    border-color: var(--primary-color);
}

/* Media Queries for Responsive Design */

/* Tablet and Larger Mobile Devices */
@media (max-width: 992px) {
    .main-header {
        padding: 0.8rem 0; 
        border-bottom: 1px solid var(--primary-color);
    }

    .main-header .container {
        flex-direction: row; 
        flex-wrap: wrap; 
        justify-content: center; 
        align-items: center;
        gap: 0.8rem; 
        padding: 0 0.8rem;
    }

    .main-header .logo {
        font-size: clamp(1.8rem, 4.2vw, 2.2rem);
        letter-spacing: 1.2px;
        order: 1; 
        margin-left: auto; 
    }
    .main-header .logo .logo-dot {
        font-size: clamp(2rem, 5vw, 2.5rem);
    }

    .search-container {
        order: 3; 
        flex-grow: 1; 
        width: 100%; 
        max-width: 400px; 
        margin-right: auto; 
        margin-left: auto; 
        padding: 0.4rem 0.8rem; 
        border: 1px solid var(--secondary-color);
    }
    .search-container input {
        width: 100%;
        margin-right: 0.5rem;
        font-size: clamp(0.7rem, 1.8vw, 0.9rem);
        padding: 0.4rem 0.8rem;
    }
    .search-container button {
        font-size: clamp(0.7rem, 1.8vw, 0.9rem);
        padding: 0.4rem 1rem;
    }

    /* Nav على التابلت والموبايل - الآن يعرض دائمًا */
    .main-nav {
        flex-basis: auto; 
        flex-grow: 0; 
        justify-content: center; 
        order: 2; 
        margin-top: 0;
        background: none; 
        border-radius: 0;
        padding: 0;
        backdrop-filter: none;
        box-shadow: none;
        width: auto; 
        margin-left: 0;
        margin-right: 0;
    }
    .main-nav ul {
        flex-wrap: wrap; 
        justify-content: center;
        gap: 0.8rem; 
    }
    .main-nav ul li {
        margin: 0; 
    }
    .main-nav ul li a {
        font-size: clamp(0.8rem, 1.6vw, 0.95rem);
        padding: 0.7rem 1.4rem;
        background: rgba(123, 31, 162, 0.08); 
        border: 1px solid rgba(123, 31, 162, 0.1);
        box-shadow: 0 0 3px rgba(0,0,0,0.15);
        color: var(--text-color);
    }
    .main-nav ul li a:hover {
        transform: none; 
        background-color: var(--primary-color);
        box-shadow: 0 0 6px var(--primary-color);
        color: var(--dark-color);
        border-color: var(--accent-color);
    }
    .main-nav ul li a::before {
        display: none; 
    }

    .hero {
        height: 60vh;
        min-height: 400px;
        padding: 0 4vw;
        justify-content: center;
        text-align: center;
        flex-direction: column;
    }
    .hero .container {
        align-items: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        height: 100%;
    }
    .hero h1 {
        font-size: clamp(2.2rem, 6vw, 3.2rem);
        margin-bottom: 1.8vh;
        max-width: 95%;
    }
    .hero p {
        font-size: clamp(0.95rem, 2.2vw, 1.2rem);
        margin-bottom: 2.8vh;
        max-width: 95%;
        padding: 0.75rem 1.6rem;
    }
    .hero .btn {
        font-size: clamp(0.95rem, 2vw, 1.1rem);
        padding: 0.8rem 1.6rem;
    }

    .movie-grid-section, .movie-details-section, .suggested-movies-section {
        padding: 5vw 0;
    }
    .movie-grid-section h2, .movie-details-section h1, .suggested-movies-section h2 {
        font-size: clamp(1.9rem, 4.5vw, 2.5rem);
        margin-bottom: 4vw;
        padding-bottom: 0.7rem;
    }

    /* 2 بوستر على التابلت */
    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 3vw; 
        padding: 0 3vw;
    }

    .movie-card img {
        /* **تعديل هنا** - زيادة الارتفاع على التابلت */
        height: clamp(170px, 44vw, 230px); 
    }

    .movie-card h3 {
        /* **تعديل هنا** - زيادة الارتفاع على التابلت وتطبيق سلوك السطرين */
        min-height: clamp(70px, 7.5vw, 85px); 
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .pagination {
        margin-top: 4vw;
        gap: 2.2vw;
    }
    .pagination .btn-page {
        padding: 0.65rem 1.3rem;
        font-size: clamp(0.8rem, 1.6vw, 0.95rem);
    }

    .movie-details-section .back-btn {
        margin-bottom: 4vw;
        padding: 0.7rem 1.4rem;
        font-size: clamp(0.8rem, 1.6vw, 0.95rem);
    }

    /* الفيديو في التابلت: نستخدم Aspect Ratio Box */
    .video-player-wrapper {
        max-width: 100%; 
        height: 0; 
        padding-bottom: 56.25%; 
        margin-bottom: 4vw;
    }
    
    .movie-info p {
        margin-bottom: 0.9rem;
        font-size: clamp(0.9rem, 1.8vw, 1.05rem);
        line-height: 1.5;
    }

    #movie-details-poster {
        max-width: clamp(160px, 40vw, 240px);
        margin: 0 auto 4vw auto;
    }

    .suggested-movies-section {
        margin-top: 5vw;
        padding-top: 5vw;
    }

    .main-footer {
        padding: 4.5vw 0;
    }
    .main-footer p {
        font-size: clamp(0.8rem, 1.6vw, 0.95rem);
        margin-bottom: 2.5vw;
    }
    .footer-links {
        gap: 1.1rem;
        flex-direction: column;
        align-items: center;
    }
    .footer-links a {
        padding: 0.8rem 1.6rem;
        font-size: clamp(0.85rem, 1.8vw, 1rem);
        max-width: 90%;
    }
}

/* Smaller Mobile Devices (e.g., iPhone SE) */
@media (max-width: 480px) {
    html {
        font-size: 14.5px;
    }
    body {
        font-size: 1rem;
    }

    .main-header .container {
        padding: 0 0.6rem;
        gap: 0.6rem; 
    }
    .main-header .logo {
        font-size: clamp(1.5rem, 4.8vw, 1.8rem);
        letter-spacing: 1px;
    }
    .main-header .logo .logo-dot {
        font-size: clamp(1.7rem, 5.8vw, 2.0rem);
    }
    .search-container {
        width: clamp(190px, 98vw, 280px);
        padding: 0.25rem 0.5rem;
    }
    .search-container input {
        font-size: clamp(0.7rem, 2.4vw, 0.85rem);
        padding: 0.25rem 0.5rem;
    }
    .search-container button {
        font-size: clamp(0.7rem, 2.4vw, 0.85rem);
        padding: 0.25rem 0.8rem;
    }

    /* Nav على الموبايل الصغير - الآن يعرض دائمًا */
    .main-nav {
        margin-top: 0.4rem;
        padding: 0.4rem 0;
        width: 100%; 
    }
    .main-nav ul {
        gap: 0.5rem;
    }
    .main-nav ul li a {
        font-size: clamp(0.75rem, 2.4vw, 0.9rem);
        padding: 0.5rem 1rem;
    }

    .hero {
        height: 58vh;
        min-height: 320px;
        padding: 0 3.5vw;
    }
    .hero h1 {
        font-size: clamp(1.8rem, 6.2vw, 2.4rem);
        margin-bottom: 1.5vh;
    }
    .hero p {
        font-size: clamp(0.85rem, 2.8vw, 1.05rem);
        padding: 0.65rem 1.3rem;
        margin-bottom: 2.5vh;
    }
    .hero .btn {
        font-size: clamp(0.85rem, 2.6vw, 1.05rem);
        padding: 0.75rem 1.5rem;
    }

    .movie-grid-section h2, .movie-details-section h1, .suggested-movies-section h2 {
        font-size: clamp(1.6rem, 5.8vw, 2.2rem);
        margin-bottom: 3.5vw;
        padding-bottom: 0.65rem;
    }
    .movie-grid {
        /* Always 2 columns on small mobile */
        grid-template-columns: repeat(2, 1fr);
        gap: 4vw; 
        padding: 0 3.5vw;
    }
    .movie-card img {
        /* **أهم تعديل هنا للموبايل: استخدام object-fit: contain و aspect-ratio** */
        height: auto; /* السماح بالارتفاع التلقائي */
        max-height: 55vw; /* تحديد أقصى ارتفاع نسبي لعرض الشاشة */
        object-fit: contain; /* **ضمان عدم قص الصورة** */
        aspect-ratio: 2/3; /* تحديد نسبة الأبعاد الشائعة للبوسترات (العرض:الارتفاع).
                              إذا كانت بوستراتك لها نسبة أبعاد مختلفة، قم بتعديل هذه القيمة.
                              مثل 9/16 أو 3/4 أو 1/1. إذا لم تكن متأكدًا، قم بإزالتها. */
        background-color: var(--dark-color); /* لون الخلفية للفراغات عند استخدام contain */
    }
    .movie-card h3 {
        /* **أهم تعديل هنا للموبايل: مرونة أكبر للارتفاع** */
        font-size: clamp(0.8rem, 2.6vw, 0.95rem);
        min-height: auto; /* **إزالة الحد الأدنى الثابت للارتفاع للسماح بالمرونة الكاملة** */
        height: auto; /* التأكد من أن الارتفاع تلقائي */
        padding: 0.6rem;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }
    .pagination {
        margin-top: 3.5vw;
        gap: 2.2vw;
    }
    .pagination .btn-page {
        padding: 0.6rem 1.2rem;
        font-size: clamp(0.75rem, 2.4vw, 0.9rem);
    }
    .movie-details-section .back-btn {
        margin-bottom: 3.5vw;
        padding: 0.65rem 1.3rem;
        font-size: clamp(0.75rem, 2.4vw, 0.9rem);
    }
    /* الفيديو في الموبايل الصغير: نستخدم Aspect Ratio Box */
    .video-player-wrapper {
        height: 0; 
        padding-bottom: 56.25%; 
        margin-bottom: 3.5vw;
    }
    
    .movie-info p {
        font-size: clamp(0.85rem, 2.2vw, 1rem);
        margin-bottom: 0.9rem;
        padding: 0.7rem 1.4rem;
    }
    #movie-details-poster {
        max-width: clamp(135px, 45vw, 210px);
        margin: 0 auto 3.5vw auto;
    }
    .suggested-movies-section {
        margin-top: 4.5vw;
        padding-top: 4.5vw;
    }
    .main-footer {
        padding: 4.2vw 0;
    }
    .main-footer p {
        font-size: clamp(0.8rem, 2vw, 0.95rem);
        margin-bottom: 2.2vw;
    }
    .footer-links {
        gap: 1.1rem;
        flex-direction: column;
        align-items: center;
    }
    .footer-links a {
        padding: 0.75rem 1.5rem;
        font-size: clamp(0.85rem, 2.2vw, 1rem);
    }
}
