/* إعادة تعيين العناصر */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* إعدادات النص والخلفية العامة */
body {
    font-family: 'Cairo', sans-serif;
    background-color: #0f0f0f;
    color: #fff;
    overflow-x: hidden;
}

/* حاوية المحتوى */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* الهيدر (Cairo) */
.site-header {
    background-color: #1a1a1a;
    padding: 15px 0;
    border-bottom: 2px solid #e50914;
}

.logo {
    font-size: 28px;
    color: #e50914;
    font-weight: bold;
    margin-bottom: 10px;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
    flex-wrap: wrap;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background 0.3s;
}

.main-nav a:hover {
    background-color: #e50914;
}

/* الشبكة */
.movies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.movie-card {
    background-color: #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s;
}

.movie-card:hover {
    transform: translateY(-5px);
}

.movie-poster {
    width: 100%;
    height: 240px;
    object-fit: cover;
    background-color: #333;
}

.movie-title {
    padding: 10px;
    font-size: 14px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.movie-meta {
    padding: 0 10px 10px;
    font-size: 12px;
    color: #aaa;
    text-align: center;
}

/* عام */
.section-title {
    margin: 25px 0 15px;
    font-size: 22px;
    color: #e50914;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

/* حقل البحث */
.search-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.search-form {
    display: flex;
    width: 100%;
    max-width: 400px;
}

.search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #444;
    border-radius: 4px 0 0 4px;
    background-color: #222;
    color: white;
    font-size: 14px;
}

.search-button {
    padding: 10px 15px;
    border: 1px solid #444;
    border-left: none;
    border-radius: 0 4px 4px 0;
    background-color: #e50914;
    color: white;
    cursor: pointer;
    font-size: 16px;
}

.search-button:hover {
    background-color: #ff0a1a;
}

/* فوتر الموقع */
.site-footer {
    background-color: #222;
    color: white;
    padding: 40px 0 20px;
    margin-top: 60px;
    border-top: 3px solid #e50914;
    border-bottom: 3px solid #e50914;
}

.footer-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 15px;
    color: #e50914;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li a {
    color: #ddd;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-section ul li a:hover {
    color: #e50914;
    text-decoration: underline;
}

.contact-link {
    color: #e50914;
    font-weight: bold;
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    margin-top: 30px;
    border-top: 1px solid rgba(229, 9, 20, 0.3);
    font-size: 0.9em;
    color: #aaa;
}

.footer-bottom p {
    margin: 5px 0;
}

/* أيقونات السوشيال ميديا */
.social-icons {
    display: flex;
    gap: 15px;
    justify-content: flex-start;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #333;
    color: white;
    font-size: 1.2em;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-icon:hover {
    background-color: #e50914;
    transform: scale(1.1);
}

/* تنسيق حاوية الهيدر الرئيسية */
.main-header {
    background-color: #1a1e22;
    padding: 10px 20px;
    border-bottom: 1px solid #3a3a3a;
    position: relative;
}

/* 1. الشريط العلوي (اللوجو، البحث، الروابط) */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

/* تنسيق اللوجو */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo img {
    height: 40px;
    width: auto;
    border-radius: 4px;
}

.logo a {
    text-decoration: none;
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.logo a span {
    color: red;
}

/* تنسيق الروابط */
.nav-links {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-link {
    color: #ffffff;
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid transparent;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background-color: #2b3035;
    border-color: #4a4a4a;
}

.nav-link.active {
    background-color: #2b3035;
    border-color: #ffc400;
    color: #ffc400;
}

@keyframes rotateClock {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-15deg); }
    100% { transform: rotate(0deg); }
}

.nav-link.active .fa-clock {
    animation: rotateClock 2s infinite ease-in-out;
}

/* تنسيق حاوية البحث */
.search-container {
    flex-grow: 1;
    max-width: 450px;
}

.search-form {
    display: flex;
    align-items: center;
    background-color: #2b3035;
    border-radius: 25px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
}

.search-filter {
    background-color: #383d44;
    color: #ffffff;
    padding: 9px 15px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    border-left: 1px solid #4a4a4a;
}

.search-filter i {
    font-size: 10px;
    color: #999;
}

.search-form input[type="text"] {
    flex-grow: 1;
    background-color: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    padding: 9px 15px;
    font-size: 14px;
    width: 100%;
}

.search-form input::placeholder {
    color: #888;
}

/* 2. الشريط السفلي (الأقسام) */
.bottom-nav {
    background-color: #1a1e22;
    padding: 10px 20px;
}

.category-links {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
}

.category-links > li {
    position: relative;
}

.category-links li a {
    color: #b0b0b0;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: color 0.3s ease;
}

.category-links li a:hover {
    color: #ffffff;
}

.category-links li a i {
    font-size: 18px;
    color: #777;
}

.category-links li:first-child a i {
    font-size: 20px;
    color: #ffc400;
}

.category-links li:last-child a i {
    color: #777;
    font-size: 20px;
}

/* تنسيق القائمة المنسدلة */
.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #2b3035;
    min-width: 200px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    padding: 10px 0;
}

.dropdown a {
    color: #b0b0b0;
    padding: 8px 20px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    font-weight: 400;
}

.dropdown a:hover {
    background-color: #3a3f44;
    color: #ffffff;
}

.category-links > li:hover .dropdown {
    display: block;
}

/* تنسيق زر القائمة (يظهر على الجوال) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 21px;
    cursor: pointer;
    z-index: 1001;
}

.menu-toggle span {
    height: 3px;
    width: 100%;
    background-color: #ffffff;
    border-radius: 3px;
    transition: 0.3s;
}

/* تأثير X عند فتح القائمة */
.menu-toggle.active span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

/* Overlay الخلفية عند فتح القائمة */
.menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-overlay.show {
    display: block;
    opacity: 1;
}

/* تنسيق القائمة المنسدلة على الجوال */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background-color: #1a1e22;
    z-index: 999;
    padding: 20px 0;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
}

.mobile-menu.show {
    right: 0;
}

/* زر إغلاق القائمة */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 15px;
    border-bottom: 1px solid #2b3035;
    margin-bottom: 15px;
}

.mobile-menu-header h3 {
    color: #ffffff;
    font-size: 18px;
    margin: 0;
}

.close-menu {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* البحث في القائمة المحمولة */
.search-mobile {
    display: block;
    padding: 10px 20px 20px;
    background-color: #1a1e22;
}

.search-mobile .search-form {
    max-width: 100%;
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu > ul > li {
    width: 100%;
    border-bottom: 1px solid #2b3035;
}

.mobile-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    color: #b0b0b0;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.mobile-menu a:hover {
    color: #ffffff;
    background-color: #2b3035;
}

.mobile-menu a i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

/* القائمة الفرعية في الموبايل */
.mobile-menu .dropdown {
    position: static;
    display: none;
    background-color: #0f1215;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.mobile-menu .dropdown a {
    padding-right: 50px;
    font-size: 14px;
    font-weight: 400;
    border-bottom: 1px solid #1a1e22;
}

.mobile-menu .dropdown a:last-child {
    border-bottom: none;
}

/* سهم القائمة الفرعية */
.mobile-menu li.has-children > a {
    position: relative;
}

.mobile-menu li.has-children > a::after {
    content: '\f078';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    left: 20px;
    transition: transform 0.3s ease;
}

.mobile-menu li.has-children.open > a::after {
    transform: rotate(180deg);
}

.mobile-menu li.has-children.open .dropdown {
    display: block;
    max-height: 500px;
}

/* عند الجوال */
@media (max-width: 768px) {
    .nav-links, 
    .search-container, 
    .bottom-nav {
        display: none !important;
    }

    .menu-toggle {
        display: flex;
    }

    .top-nav {
        justify-content: space-between;
        margin-bottom: 0;
    }

    .main-header {
        padding: 10px 15px;
    }

    .logo a {
        font-size: 20px;
    }

    .logo img {
        height: 35px;
    }

    /* إخفاء الـ hr على الموبايل */
    .main-header hr {
        display: none;
    }
}

/* للشاشات الصغيرة جداً */
@media (max-width: 380px) {
    .mobile-menu {
        width: 100%;
        right: -100%;
    }

    .mobile-menu.show {
        right: 0;
    }
}