/* header.css - النسخة النهائية والمحدثة لتناسب البنية الأصلية */

/* === أنماطك الأصلية (محفوظة بالكامل) === */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #4CAF50;
    --accent-color: #FFA000;
    --light-bg: #FFF8E1;
    --dark-text: #2E2E2E;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', sans-serif;
}

.main-header {
    background: rgba(255, 255, 255, 0.9) !important;
    color: var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5%;
    font-weight: bold;
    width: 100%;
    height: 70px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-bottom: 2px solid var(--secondary-color);
}

.logo-container { display: flex; align-items: center; gap: 15px; }
.logo { height: 40px; width: auto; }
.header-controls { display: flex; align-items: center; gap: 20px; }
.lang-switcher { background: var(--secondary-color); color: white; border: none; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-weight: bold; transition: all 0.3s ease; margin-left: 10px; text-decoration: none; }
.lang-switcher:hover { background: var(--primary-color); }
.main-header h1 { margin: 0; font-size: 24px; color: var(--primary-color); font-weight: 700; }
.welcome-message { display: flex; align-items: center; gap: 15px; }
.user-greeting { display: flex; align-items: center; gap: 8px; }
.greeting-text { font-weight: 400; color: var(--dark-text); }
.guest-greeting { display: flex; align-items: center; gap: 15px; }
.profile-btn { background: transparent; border: 2px solid var(--secondary-color); color: var(--primary-color); font-size: 22px; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; }
.profile-btn:hover { background: var(--secondary-color); color: white; }
.profile-menu { display: none; position: absolute; top: 60px; background: white; border: 1px solid var(--secondary-color); border-radius: 10px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1); width: 220px; z-index: 1001; overflow: hidden; }
body[dir="rtl"] .profile-menu { right: 5%; } /* تعديل ليكون متناسبا مع الحشوة */
body[dir="ltr"] .profile-menu { left: 5%; }
.profile-menu ul { list-style: none; }
.profile-menu ul li { padding: 12px 15px; border-bottom: 1px solid #f0f0f0; transition: all 0.3s ease; }
.profile-menu ul li:last-child { border-bottom: none; }
.profile-menu ul li:hover { background: var(--light-bg); }
.profile-menu ul li a { display: flex; align-items: center; gap: 10px; color: var(--dark-text); text-decoration: none; font-weight: 500; }
.profile-menu ul li a i { width: 20px; text-align: center; }
.login-btn { background: var(--primary-color); color: white !important; padding: 8px 15px; border-radius: 20px; text-decoration: none; display: flex; align-items: center; gap: 8px; font-weight: 500; transition: all 0.3s ease; }
.login-btn:hover { background: var(--accent-color); }
.search-bar { display: flex; flex-grow: 1; margin: 0 30px; max-width: 600px; }
.search-bar input { width: 100%; padding: 10px 15px; border: 2px solid var(--secondary-color); border-radius: 8px 0 0 8px; font-size: 16px; }
.search-bar button { background-color: var(--primary-color); color: white; border: none; padding: 0 20px; border-radius: 0 8px 8px 0; cursor: pointer; transition: 0.3s ease; font-size: 16px; }
.search-bar button:hover { background-color: #388E3C; }
.main-nav { margin-left: 20px; }
.main-nav ul { display: flex; list-style: none; gap: 20px; }
.main-nav ul li a { color: #2E7D32; text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 4px; transition: all 0.3s ease; }
.main-nav ul li a:hover { background-color: var(--light-bg); }
body[dir="rtl"] .main-nav { margin-left: 0; margin-right: 20px; }
/* زر الهامبرغر مخفي افتراضيًا */
.mobile-menu-toggle { display: none; } 
.mobile-nav { display: none; }
.overlay { display: none; }


/* =================================================================== */
/* ===  ⬇️  كود التوافق الاحترافي (لا يغير أماكن العناصر)  ⬇️  === */
/* =================================================================== */

@media (max-width: 992px) {
    .main-header {
        height: 60px;
        padding: 0 2%;
    }

    /* إخفاء العناصر في الهيدر الرئيسي */
    .main-header .main-nav,
    .main-header .search-bar,
    .main-header .navigation .welcome-message .user-greeting,
    .main-header .header-controls {
        display: none;
    }

    /* إظهار زر قائمة الهامبرغر */
    .mobile-menu-toggle {
        display: block;
        background: transparent;
        border: none;
        font-size: 28px;
        color: var(--primary-color);
        cursor: pointer;
        order: 3; /* وضعه في النهاية */
    }

    .main-header .logo-container { order: 2; margin: 0 auto; }
    .main-header .navigation { order: 1; }

    /* تصميم القائمة الجانبية التي ستظهر */
    .mobile-nav {
        display: flex; /* تغيير display عند التفعيل */
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%; /* إخفاؤه خارج الشاشة */
        width: 300px;
        max-width: 80%;
        height: 100%;
        background: white;
        box-shadow: -5px 0 15px rgba(0,0,0,0.15);
        z-index: 2000;
        transition: right 0.4s ease;
        padding: 20px;
        overflow-y: auto;
    }

    body[dir="ltr"] .mobile-nav {
        right: auto;
        left: -100%;
        transition: left 0.4s ease;
    }

    .mobile-nav.show { right: 0; }
    body[dir="ltr"] .mobile-nav.show { left: 0; }
    
    .mobile-nav .close-btn { background: none; border: none; font-size: 24px; color: #333; margin-bottom: 2rem; cursor: pointer; text-align: left; width: 100%; }
    body[dir="rtl"] .mobile-nav .close-btn { text-align: right; }

    /* إظهار العناصر داخل القائمة الجانبية */
    .mobile-nav .main-nav, .mobile-nav .search-bar, .mobile-nav .header-controls, .mobile-nav .navigation {
        display: block;
        width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .mobile-nav .navigation .welcome-message {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .mobile-nav .main-nav ul { flex-direction: column; gap: 1rem; }
    .mobile-nav .search-bar { flex-direction: column; gap: 10px; margin: 0; max-width: none; }
    .mobile-nav .search-bar input, .mobile-nav .search-bar button { border-radius: 8px; }
    
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1999;
        display: none;
    }
    
    .overlay.show { display: block; }
}

@media (max-width: 480px) {
    .main-header .logo-container h1 { display: none; }
    .logo { height: 35px; }
}