/* ============================================
   NAVIGATION & IMAGE FIXES
   إصلاحات شريط التنقل والصور
============================================ */

/* 1. إصلاح الصور المخفية */
img {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* إصلاح صور الخلفية */
.hero-background,
.about-hero,
.game-hero,
.app-hero,
.project-hero,
[class*="-hero"] {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    opacity: 1 !important;
}

/* إصلاح صور البطاقات */
.project-card img,
.game-card img,
.app-card img,
.feature-card img {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    width: 100%;
    height: auto;
}

/* إصلاح اللوجو */
.logo,
.footer-logo {
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-block !important;
}

/* 2. إصلاح شريط التنقل */
.header {
    position: sticky;
    top: 0;
    width: 100%;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    gap: 2rem;
}

/* شعار الموقع */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-charcoal, #333);
}

.nav-brand .logo {
    width: 45px;
    height: 45px;
    object-fit: contain;
}

.brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-leaf-green, #76AD3F);
    white-space: nowrap;
}

/* قائمة التنقل */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    justify-content: center;
}

.nav-link {
    color: var(--color-charcoal, #333);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: block;
}

.nav-link:hover {
    color: var(--color-leaf-green, #76AD3F);
    background: rgba(118, 173, 63, 0.1);
}

.nav-link.active {
    color: var(--color-leaf-green, #76AD3F);
    background: rgba(118, 173, 63, 0.15);
    font-weight: 600;
}

/* القائمة المنسدلة */
.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    padding: 0.75rem 0;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    list-style: none;
}

.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: var(--color-charcoal, #333);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.dropdown-menu a:hover {
    background: rgba(118, 173, 63, 0.1);
    color: var(--color-leaf-green, #76AD3F);
    padding-right: 2rem;
}

/* مبدل اللغة */
.lang-switcher {
    position: relative;
    flex-shrink: 0;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(118, 173, 63, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: var(--color-charcoal, #333);
}

.lang-btn:hover {
    background: rgba(118, 173, 63, 0.2);
    border-color: var(--color-leaf-green, #76AD3F);
}

.lang-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.lang-switcher:hover .lang-dropdown,
.lang-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.3s ease;
    text-align: right;
}

.lang-option:hover {
    background: rgba(118, 173, 63, 0.1);
}

.lang-flag {
    font-size: 1.25rem;
}

/* زر القائمة للموبايل */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    width: 28px;
    height: 3px;
    background: var(--color-leaf-green, #76AD3F);
    border-radius: 3px;
    transition: all 0.3s ease;
}

.hamburger {
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    right: 0;
}

.hamburger::before {
    top: -8px;
}

.hamburger::after {
    top: 8px;
}

/* تأثير الفتح للهامبرغر */
.nav-toggle.active .hamburger {
    background: transparent;
}

.nav-toggle.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.nav-toggle.active .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* 3. تصميم متجاوب */
@media (max-width: 1024px) {
    .navbar {
        gap: 1rem;
    }
    
    .nav-menu {
        gap: 1.5rem;
    }
    
    .brand-text {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
        order: 3;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        right: -100%;
        width: 280px;
        height: calc(100vh - 70px);
        background: white;
        flex-direction: column;
        align-items: flex-start;
        padding: 2rem;
        gap: 0.5rem;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        overflow-y: auto;
        z-index: 999;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-link {
        width: 100%;
        padding: 0.75rem 1rem;
    }
    
    .nav-dropdown {
        width: 100%;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: rgba(118, 173, 63, 0.05);
        margin: 0.5rem 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .nav-dropdown:hover .dropdown-menu,
    .nav-dropdown.active .dropdown-menu {
        max-height: 400px;
    }
    
    .lang-switcher {
        order: 2;
    }
    
    .brand-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.75rem 0;
    }
    
    .nav-brand .logo {
        width: 35px;
        height: 35px;
    }
    
    .brand-text {
        font-size: 0.9rem;
    }
    
    .nav-menu {
        width: 100%;
        right: -100%;
        top: 60px;
        height: calc(100vh - 60px);
    }
    
    .nav-menu.active {
        right: 0;
    }
}

/* 4. إصلاح مشاكل RTL */
html[dir="rtl"] .dropdown-menu {
    right: auto;
    left: 0;
}

html[dir="rtl"] .lang-dropdown {
    left: auto;
    right: 0;
}

html[dir="rtl"] .dropdown-menu a:hover {
    padding-right: 1.5rem;
    padding-left: 2rem;
}

@media (max-width: 768px) {
    html[dir="rtl"] .nav-menu {
        right: auto;
        left: -100%;
    }
    
    html[dir="rtl"] .nav-menu.active {
        left: 0;
        right: auto;
    }
}

/* 5. تحسينات إضافية */
.header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* overlay للموبايل */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* تحسين أداء الأنيميشن */
.nav-menu,
.dropdown-menu,
.lang-dropdown {
    will-change: transform, opacity;
}

/* منع التمرير عند فتح القائمة */
body.nav-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    body.nav-open {
        overflow: hidden;
    }
}

/* إصلاح z-index */
.header {
    z-index: 1000 !important;
}

.nav-menu {
    z-index: 999 !important;
}

.nav-overlay {
    z-index: 998 !important;
}
