/* -------------------------------------------------- */
/* 1. شريط التنقل وتأثير اللمعان (Navbar & Shimmer)     */
/* -------------------------------------------------- */
.navbar {
    /* التموضع */
    position: sticky;
    top: 0;
    z-index: 10000;
    
    /* الحجم والتخطيط */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    height: auto;
    min-height: 80px;
    padding: 10px 2rem;
    
    /* التصميم والظلال */
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.08);
    background: linear-gradient(90deg, 
        #f8e6c8 0%, 
        #fdfbf9 45%, 
        #ffffff 50%, 
        #fdfbf9 55%, 
        #f8e6c8 100%
    );
    background-size: 200% 100%;
    
    /* الحركات */
    animation: shimmer 4s infinite linear; 
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -------------------------------------------------- */
/* 2. قسم الشعار (Logo Section)                       */
/* -------------------------------------------------- */
.navbar .logo {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
}

.logo-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #66774a;
    box-shadow: 0 0 0 4px #f9f3ee;
    transition: transform 0.3s ease;
}

.logo-img:hover {
    animation: spinOnce 1s ease-in-out;
}

@keyframes spinOnce {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: #66774a;
}

/* -------------------------------------------------- */
/* 3. روابط التنقل (Navigation Links)                 */
/* -------------------------------------------------- */
.nav-links {
    display: flex;
    gap: 40px;
    align-items: center;
    transition: all 0.3s ease;
}

.nav-links a,
.dropdown-btn {
    /* الخطوط والتصميم */
    font-family: inherit;
    font-size: 18px;
    font-weight: 500;
    color: #66774a;
    text-decoration: none;
    
    /* المساحات والتفاعل */
    display: flex;
    align-items: center;
    padding: 10px 0;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    
    /* الحركة */
    transition: all 0.2s ease;
}

.nav-links a:hover,
.dropdown:hover .dropdown-btn {
    color: #000;
    transform: translateY(-2px);
}

/* -------------------------------------------------- */
/* 4. القائمة المنسدلة (Dropdown Logic)               */
/* -------------------------------------------------- */
.dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.dropdown-menu {
    /* التموضع */
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    
    /* الحجم والتصميم */
    min-width: 200px;
    padding: 8px 0;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(102, 119, 74, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    
    /* حالة الظهور (مخفية) */
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* تمنع التفاعل والضغط وهي مخفية */
    
    /* الحركات */
    transform: translateY(10px); 
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* تفعيل الضغط عند الظهور */
    transform: translateY(0); 
}

.dropdown-menu a {
    display: block;
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    color: #333;
}

.dropdown-menu a:hover {
    background-color: #f2f5ef;
    color: #66774a;
}

/* -------------------------------------------------- */
/* 5. البحث والأدوات (Search & Actions)               */
/* -------------------------------------------------- */
.navbar-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.search-input {
    /* التموضع والحالة */
    width: 0;
    opacity: 0;
    visibility: hidden;
    
    /* التصميم */
    background: transparent;
    border: none;
    outline: none;
    border-bottom: 2px solid #66774a;
    font-size: 16px;
    
    /* الحركة */
    transition: all 0.4s ease;
}

.search-wrapper:hover .search-input,
.search-input:focus {
    width: 180px;
    padding: 5px;
    margin-right: 10px;
    opacity: 1;
    visibility: visible;
}

.navbar-actions button {
    display: flex;
    align-items: center;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.navbar-actions button:hover {
    background-color: rgba(102, 119, 74, 0.1);
}

.action-icon {
    width: 24px;
    height: 24px;
}


/* ---------------------------------- */
/* 6. زر تبديل الوضع (فاتح / داكن)  */
/* ---------------------------------- */
.theme-switch {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(102, 119, 74, 0.2);
    background-color: rgba(102, 119, 74, 0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}



/* -------------------------------------------------- */
/* 7. إعدادات الوضع الداكن (Dark Mode)                 */
/* -------------------------------------------------- */
body.dark-mode .navbar {
    background: linear-gradient(90deg, #2b1d12 0%, #664935 50%, #2b1d12 100%);
    background-size: 200% 100%;
    box-shadow: 0px 4px 20px rgba(0, 0, 0, 0.4);
    animation: shimmer 7s infinite linear;
}

/* تنسيقات الشعار والروابط في الوضع الداكن */
body.dark-mode .logo-text, 
body.dark-mode .nav-links a, 
body.dark-mode .dropdown-btn { 
    color: #efe7d9; 
}

/* تنسيق صورة الشعار (اللوجو) في الوضع الداكن */
body.dark-mode .logo-img { 
    box-shadow: 0 0 0 4px #4f3a2ab3; 
    border-color: #a3b899; 
}

body.dark-mode .dropdown-menu {
    background-color: #3d2b1f;
    border: 1px solid #4d3a2b;
}

body.dark-mode .dropdown-menu a { 
    color: #efe7d9; 
}

body.dark-mode .dropdown-menu a:hover { 
    background-color: #4d3a2b; 
    color: #d4e0c0; 
}

body.dark-mode .search-input { 
    border-bottom: 2px solid #d4e0c0; 
    color: #efe7d9; 
}
body.dark-mode .theme-switch {
    border-color: rgba(212, 224, 192, 0.3);
}

/* -------------------------------------------------- */
/* 8. التصميم المتجاوب (Responsive Design)             */
/* -------------------------------------------------- */
@media (max-width: 768px) {
    .navbar { 
        padding: 10px 1.5rem; 
        justify-content: space-between; 
    }
    
    .nav-links {
        order: 3; 
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(102, 119, 74, 0.08);
        gap: 20px;
    }
    
    .dropdown-menu {
        left: 50%;
        right: auto;
        /* دمج التوسيط الأفقي مع الإزاحة الرأسية */
        transform: translateX(-50%) translateY(10px);
    }
    
    .dropdown:hover .dropdown-menu {
        transform: translateX(-50%) translateY(0);
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 8px 1rem; 
        min-height: 65px; 
    }

    .logo-img {
        width: 50px; 
        height: 50px;
        box-shadow: 0 0 0 3px #f9f3ee; 
    }

    .logo-text {
        font-size: 18px; 
    }

    .navbar .logo {
        gap: 8px; 
    }

    .nav-links {
        gap: 12px;
        padding-top: 8px;
    }

    .nav-links a, 
    .dropdown-btn {
        font-size: 15px; 
    }

    
    .theme-switch {
        width: 40px;
        height: 40px;
    }

    .action-icon {
        width: 20px;
        height: 20px;
    }

    
    .dropdown-menu {
        min-width: 200px; 
    }
}
