:root {
    --border-color: #e3e6e8;
}

/* --- 1. Top Bar --- */
.top-bar {
    background-color: #fcfcfc;
    border-bottom: 1px solid #f0f0f0;
    color: var(--main);
    position: relative;
    z-index: 1031;
}
.top-bar a {
    color: var(--main);
    text-decoration: none;
    transition: 0.3s;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--main);
    font-size: 13px;
    font-weight: 600;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-btn::after {
    display: none;
}

/* --- حاوية الهيدر الكاملة --- */
.header-wrapper {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #fff;
}

/* --- 2. Main Navbar --- */
.main-navbar {
    padding: 15px 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    order: 2;
}

.brand-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}
.brand-logo img {
    height: 55px;
    width: 166px;
    transition: all 0.3s ease;
}

/* --- 3. Promo Bar --- */
.promo-bar {
    background-color: var(--bg);
    padding: 8px 0;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    color: var(--main);
    order: 1;
}
.promo-close-btn {
    cursor: pointer;
    position: absolute;
    right: 15px;
}

/* --- 4. Custom Dropdown (Desktop) --- */
.dropdown-custom {
    position: relative;
}
.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    min-width: 230px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 10px 0;
    list-style: none;
    display: none;
    z-index: 1100;
    border: 1px solid #f0f0f0;
    margin-top: 5px;
}

.custom-dropdown-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--main);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.custom-dropdown-menu li a i {
    width: 25px;
    color: var(--bg);
    font-size: 16px;
    text-align: center;
}
.custom-dropdown-menu li a:hover {
    background-color: #f8faff;
    padding-right: 25px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ديسكتوب */
@media (min-width: 992px) {
    .header-wrapper {
        position: relative;
    }
    .main-navbar {
        order: 1;
        padding: 15px 0;
    }
    .promo-bar {
        order: 2;
        padding: 10px 0;
        font-size: 14px;
    }
    .navbar-container-desktop {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    .v-divider {
        width: 1px;
        height: 30px;
        background: var(--bg);
        margin: 0 15px;
    }
    .nav-link-custom {
        font-weight: 700;
        color: var(--third) !important;
        padding: 0 12px !important;
        font-size: 16px;
    }
    .nav-link-custom.active {
        color: var(--main) !important;
    }
}

.active {
    color: var(--main) !important;
}

/* موبايل */
@media (max-width: 991px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-header-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    .brand-logo img {
        height: 35px;
        width: 150px;
    }
    .navbar-toggler {
        border: none;
        padding: 0;
        color: var(--main);
    }
    .mobile-search-wrapper {
        flex-grow: 1;
        margin: 0 10px;
        max-width: 250px;
    }
    .search-box {
        border: 1px solid #e6f0ff;
        border-radius: 8px;
        display: flex;
        align-items: center;
        padding: 4px 10px;
    }
    .search-box input {
        border: none;
        background: transparent;
        outline: none;
        font-size: 13px;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .brand-logo img {
        height: 35px;
        width: 100px;
    }
}

/* أيقونات الأكشن */
.action-item {
    position: relative;
    color: var(--main);
    font-size: 1.5rem;
    text-decoration: none;
    display: flex;
    align-items: center;
}
.badge-count {
    position: absolute;
    top: -6px;
    right: -7px;
    background-color: var(--bg);
    color: #000;
    font-size: 9px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: bold;
    border: 1px solid #fff;
}
.search-circle {
    width: 38px;
    height: 38px;
    border: 1px solid #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--main);
    text-decoration: none;
}

/* Offcanvas Styling */

.offcanvas {
    width: 300px !important;
    height: 100vh;
    position: fixed;
    z-index: 9999;
}

.offcanvas-header {
    padding: 1rem;
}
.offcanvas-header .btn-close {
    font-size: 12px;
}
.offcanvas-header .brand-logo img {
    height: 30px;
}

.offcanvas-body {
    padding: 0 !important;
    overflow-x: hidden;
    position: relative;
}
.menu-slider {
    display: flex;
    width: 300%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.menu-page {
    width: 33.333%;
    padding: 20px;
    flex-shrink: 0;
    min-height: 80vh;
}

.menu-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    color: var(--third);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}
.menu-link.blue-text {
    color: var(--main);
}
.menu-link i {
    font-size: 12px;
}

.back-nav {
    cursor: pointer;
    padding: 10px 0;
    color: var(--main);
    font-weight: bold;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 10px;
}

/* قسم اللغة في السايد بار */
.side-lang-options {
    display: none;
    background: #f9f9f9;
    padding: 5px 20px;
}
.side-lang-options .menu-link {
    font-size: 14px;
    border-bottom: none;
}
.lang-trigger-icon {
    font-size: 10px !important;
}

/* فوتر السايد بار */
.side-menu-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding-bottom: 1.5rem;
    text-align: center;
}
.side-social-link {
    color: var(--main);
    font-size: 18px;
    text-decoration: none;
}

[dir="rtl"] .auto-chevron {
    transform: rotate(180deg);
}

[dir="rtl"] .chevron-icon::before {
    content: "\f053"; /* left */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

[dir="ltr"] .chevron-icon::before {
    content: "\f054"; /* right */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

/* تأكد أن الحاوية تبدأ من الاتجاه الصحيح */
.menu-slider {
    display: flex;
    width: 300%;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    margin: 0;
    /* إضافة هذا السطر لضمان البداية الصحيحة */
    flex-direction: row;
}

/* لضمان عدم ظهور سكرول أفقي داخل الـ Offcanvas */
.offcanvas-body {
    overflow-x: hidden;
    direction: inherit; /* يرث الاتجاه من الأب */
}

/* ضبط اتجاه الأيقونات (السهام) تلقائياً */
[dir="rtl"] .auto-chevron {
    transform: rotate(180deg);
}

/* في حال أردت تثبيت الـ Offcanvas في الـ RTL ليكون يميناً */
[dir="rtl"] .offcanvas-start {
    right: 0;
    left: auto;
    transform: translateX(100%);
}

[dir="rtl"] .offcanvas.show {
    transform: translateX(0);
}

/* التنسيق الأساسي للقائمة */
.dropdown-custom {
    position: relative;
}

.dropdown-toggle::after {
    display: none !important;
}

/* تأكد أن القائمة مخفية في الحالة العادية */
.custom-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 230px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 10px 0;
    list-style: none;
    z-index: 1100;
    border: 1px solid #f0f0f0;
    margin-top: 5px;
}

.custom-dropdown-menu {
    display: none;
}

/* كلاس إضافي ليتم تفعيله عبر JavaScript عند الضغط */
.custom-dropdown-menu.show {
    display: block !important;
}

/*  */

/* الحاوية الأساسية للبحث */
.search-container {
    position: absolute; /* علشان يفتح تحت الهيدر بالظبط */
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0px 45px 37.8px 0px #2626261a;
    padding: 40px 0;
    z-index: 9999; /* رقم عالي جداً علشان يظهر فوق أي حاجة */
    display: flex;
    justify-content: center;
    border-bottom: 1px solid #eee;
}

/* حالة الإخفاء */
.search-container.hidden {
    display: none !important;
}

/* تنسيق العناصر الداخلية */
.search-content {
    display: flex;
    width: 90%;
    max-width: 700px;
    height: 50px;
}

/* العنوان العلوي */
.search-title {
    color: var(--main);
    font-weight: bold;
    margin-bottom: 25px;
    font-size: calc(36 / 16 * 1rem);
}

.search-main-box {
    display: flex;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
    height: 55px;
}

/* اختيار الفئات (أقصى اليمين) */
/* الحاوية الأساسية */
.search-category-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    width: fit-content;
    border-left: 1px solid #eee;
    padding: 5px 10px;
}

/* تنسيق قائمة الاختيار */
.search-category-select {
    appearance: none; /* إخفاء سهم المتصفح الافتراضي */
    -webkit-appearance: none;
    -moz-appearance: none;

    background-color: transparent;
    border: none;
    outline: none;

    font-size: 16px;
    color: var(--third);
    cursor: pointer;
}

/* تنسيق الأيقونة (السهم) */
.select-icon {
    pointer-events: none; /* لمنع الأيقونة من إعاقة الضغط على القائمة */
    color: var(--third);
    font-size: 14px;
}

/* تأثير عند تمرير الماوس (اختياري) */
.search-category-select:hover {
    color: #4a4a4a;
}
/* حقل الإدخال (المنتصف) */
.search-input {
    flex: 1;
    border: none;
    padding: 0 15px;
    outline: none;
    text-align: right;
    font-size: 15px;
    color: var(--main);
}

/* زر البحث (أقصى اليسار) */
.search-submit-btn {
    background-color: var(--bg);
    border: none;
    padding: 0 30px;
    font-weight: bold;
    color: var(--main); /* كتابة بالأزرق */
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.search-submit-btn:hover {
    background-color: var(--bg);
}

/* حاوية النتائج الكبيرة */
.search-results-wrapper {
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 15px;
    margin-top: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
}

/* الرأس (تم العثور على...) */
.results-header {
    background-color: #fafafa;
    padding: 12px 20px;
    border-bottom: 1px solid #c7cdd1;
}

.results-count {
    color: var(--third);
    font-size: 1rem;
}

.num {
    color: var(--main);
}

.results-label {
    color: var(--main);
    font-weight: bold;
    font-size: 16px;
}

/* عنصر المنتج الفردي */
.result-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f1f1f1;
    transition: background 0.2s;
    cursor: pointer;
}

.result-item:last-child {
    border-bottom: none;
}

.result-item:hover {
    background-color: #fcfcfc;
}

/* السعر جهة اليسار */
.price {
    color: var(--main);
    font-weight: bold;
    font-size: 16px;
    min-width: 100px;
    text-align: left;
}

/* معلومات المنتج في المنتصف */
.item-name {
    font-size: 16px;
    font-weight: bold;
    color: var(--main);
    margin-bottom: 4px;
}

.item-desc {
    font-size: 14px;
    color: #888;
    margin: 0;
    max-width: 299px;
}

/* الصورة جهة اليمين */
.item-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
}

.item-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.top-bar-icons {
    font-size: 17px;
}
