/* إعادة تهيئة وإعدادات المتغيرات الجمالية */
:root {
    --primary-color: var(--store-primary-color, #ff5c00);
    --primary-hover: color-mix(in srgb, var(--primary-color) 86%, #000000);
    --bg-topbar: var(--primary-color);
    --text-white: #ffffff;
    --text-dark: #333333;
    --text-muted: #777777;
    --border-color: #f1f1f1;
    --bg-light: #f9f9f9;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    direction: rtl;
    font-family: var(--font-main);
    background-color: #fdfdfd;
}

li {
    list-style: none;
}

a {
    text-decoration: none;
    color: inherit;
}

/* 1. تنسيق الشريط العلوي المتوهج (Top Bar) */
.top-bar {
    background-color: var(--bg-topbar);
    color: var(--text-white);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    padding: 10px 20px;
    font-size: 13.5px;
    font-weight: 500;
    direction: rtl;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-item i {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
}

.animate-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* 2. هيدر الديسك توب الرئيسي المتكامل (Desktop Header) */
.main-desktop-header {
    display: grid;
    grid-template-columns: 240px 1fr auto;
    align-items: center;
    gap: 30px;
    padding: 20px 6%;
    background-color: var(--text-white);
    border-bottom: 1px solid var(--border-color);
}

/* الشعار والعلامة التجارية */
.logo .logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.logo-text .site-name {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.1;
}

.logo-text p {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* محرك البحث الإحترافي وعريض بالكامل */
.search_container {
    width: 100%;
}

.search_bar form {
    display: flex;
    align-items: center;
    background-color: #f7f7f7;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    transition: var(--transition-smooth);
}

.search_bar form:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 92, 0, 0.1);
    background-color: var(--text-white);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    flex-grow: 1;
    position: relative;
}

.search_input {
    width: 100%;
    border: none;
    background: transparent;
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-dark);
    outline: none;
}

.search-category-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 15px;
    border-right: 1px solid #e5e5e5;
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}

.button_search {
    background-color: var(--primary-color);
    color: var(--text-white);
    border: none;
    height: 48px;
    width: 60px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.button_search:hover {
    background-color: var(--primary-hover);
}

/* أزرار الإجراءات والمستخدم والسلة اليسرى */
.cart-and-actions {
    display: flex;
    align-items: center;
}

.action-buttons-list {
    display: flex;
    align-items: center;
    gap: 24px;
}

.action-item a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-dark);
    transition: var(--transition-smooth);
    position: relative;
}

.action-item i {
    font-size: 20px;
    transition: var(--transition-smooth);
}

.action-label {
    font-size: 12px;
    font-weight: 500;
}

.action-item:hover a, .action-item:hover i {
    color: var(--primary-color);
}

.logout-link-inline {
    margin-top: 2px;
    font-size: 11px;
    color: #e11d48 !important;
}

.badge-container {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -10px;
    background-color: var(--primary-color);
    color: var(--text-white);
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--text-white);
}

/* 3. شريط التنقل والأقسام المستقل بالكامل (Navigation Sub-Bar) */
.categories-nav-bar {
    background-color: var(--text-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 6%;
}

.categories-nav-bar .sections {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none; /* إخفاء سكرولبار الـ Firefox */
}

.categories-nav-bar .sections::-webkit-scrollbar {
    display: none; /* إخفاء سكرولبار الـ Chrome */
}

.categories-nav-bar .sections li a {
    color: var(--text-dark);
    font-size: 14.5px;
    font-weight: 600;
    padding: 16px 20px;
    display: block;
    position: relative;
    white-space: nowrap;
    transition: var(--transition-smooth);
}

.categories-nav-bar .sections li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: var(--primary-color);
    transition: var(--transition-smooth);
    border-radius: 3px 3px 0 0;
}

.categories-nav-bar .sections li:hover a {
    color: var(--primary-color);
}

.categories-nav-bar .sections li:hover a::after,
.categories-nav-bar .sections li.active a::after {
    width: 70%;
}

/* 4. شريط أحدث المنتجات المصغرة الذكي (Latest Products Thumbnail Row) */
.last_post {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 12px 6%;
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.latest-label-box h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
    position: relative;
    padding-left: 15px;
}

.latest-label-box h3::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 14px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.news-scroll-container {
    overflow-x: auto;
    flex-grow: 1;
    scrollbar-width: none;
}

.news-scroll-container::-webkit-scrollbar {
    display: none;
}

.news {
    display: flex;
    align-items: center;
    gap: 15px;
}

.news-item-card {
    background-color: var(--text-white);
    border: 1px solid #eaf0f3;
    border-radius: 8px;
    padding: 4px;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.news-item-card img {
    display: block;
    border-radius: 6px;
    object-fit: cover;
    transition: var(--transition-smooth);
}

.news-item-card:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(255, 92, 0, 0.12);
}

/* 5. التصميم المتجاوب الكامل للهواتف الذكية (Responsive Mobile Structure) */
.site-menu-toggle {
    display: none;
}

@media (max-width: 991px) {
    /* تفعيل وإظهار زر القائمة العائم الثابت للهاتف */
   .site-menu-toggle {
        display: flex;
        position: fixed;
        top: 50px;
        right: 10px;
        z-index: 2000;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 8px;
        background: var(--primary-color);
        color: #fff;
        font-size: 20px;
        cursor: pointer;
    }

  .site-menu-toggle{
    position: fixed;
}

.site-menu-toggle img {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: all 1s ease; /* إضافة تنعيم للحركة */
    pointer-events: none; /* لمنع تداخل الصور مع النقرات */
    transform: rotate(0deg);
}

.site-menu-toggle img.active {
    opacity: 1; /* القيمة الصحيحة للظهور الكامل */
    transform: rotate(180deg);

}
    /* إخفاء لوحة الهيدر الكامل بشكل افتراضي على الجوال وتحويلها لقائمة ذكية سفلية */
    .site-header-panel {
        display: none;
        background-color: var(--text-white);
        width: 100%;
                position: fixed;
                z-index: 999;

    }

    .site-header-panel.open {
        display: block;
        position: fixed;
        z-index: 99;


        
    }

    /* الشريط العلوي للجوال */
 /* الحاوية الخارجية الثابتة */
.top-bar {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important; /* إخفاء العناصر الخارجية أساسي لعمل الحركة */
    background: var(--primary-color) !important; 
    padding: 12px 0 !important;
    box-sizing: border-box !important;
    display: block !important; /* تحويلها إلى block يمنع أي خصائص فليكس موروثة من خنق التراك الداخلي */
    position: relative !important;
    z-index: 999 !important;
}

/* مسار شريط الأخبار المتحرك */
.top-bar-track {
    display: flex !important; /* استخدام فليكس هنا لترتيب العناصر على سطر واحد */
    align-items: center !important;
    gap: 60px !important; /* مسافة واضحة بين الجمل */
    width: max-content !important;
    white-space: nowrap !important;
    padding-right: 20px;
    
    /* استدعاء الأنيميشن الصارم */
    animation: marqueeLeftToRight 30s linear infinite !important;
    will-change: transform !important; /* إجبار المتصفح على الاستعداد للتحريك */
}

/* العناصر الداخلية للشريط */
.top-bar-item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    flex-shrink: 0 !important; /* يمنع المتصفح نهائياً من تقليص حجم النص */
    white-space: nowrap !important;
}

.top-bar-item i {
    color: #ffffff !important; 
}

/* إيقاف الحركة عند التمرير بالماوس */
.top-bar:hover .top-bar-track {
    animation-play-state: paused !important;
}

/* ==========================================================================
   الأنيميشن المطور والمتوافق تماماً مع البيئات العربية (RTL) والأجهزة الذكية
   ========================================================================== */
@keyframes marqueeLeftToRight {
    0% {
        /* تبدأ الحركة من نقطة الصفر الطبيعية للموقع */
        transform: translate3d(0, 0, 0);
    }
    100% {
        /* تتحرك بمقدار نصف طول الحاوية بالكامل إلى اليمين (بسبب مضاعفة العناصر) */
        transform: translate3d(50%, 0, 0);
    }
}

    /* إعادة هيكلة الهيدر المكتبي ليتحول إلى هيكل الجوال المطلوب بالترتيب */
    .main-desktop-header {
        display: flex;
        flex-direction: column;
        gap: 15px;
        padding: 15px 15px;
        border-bottom: none;
    }

    /* السطر الأول للجوال: الشعار والمفضلة والسلة والحساب جنباً إلى جنب بشكل أفقي مدمج */
    .logo {
        width: 100%;
        margin-right: 35px; /* إتاحة مساحة لزر الهمبرغر */
    }

    .cart-and-actions {
        width: 100%;
        justify-content: center;
        border-top: 1px solid var(--border-color);
        padding-top: 10px;
    }

    .action-buttons-list {
        width: 100%;
        justify-content: space-around;
        gap: 0;
    }

    .action-label {
        display: block; /* إخفاء الكلمات لإظهار الأيقونات المرجعية فقط بصورة متناسقة */
    }

    .action-item i {
        font-size: 22px;
    }

    /* السطر الثاني للجوال: شريط البحث الممتد بعرض كامل */
    .search_container {
        width: 100%;
        order: 2;
    }

    .search_bar form {
        border-radius: 8px;
    }

    .search_input {
        padding: 12px 15px;
    }

    .search-category-dropdown {
        display: none; /* إخفائه بالجوال لتوفير مساحة العرض الكامل */
    }

    /* السطر الثالث للجوال: شريط الأقسام الممرر أفقياً بسلاسة */
    .categories-nav-bar {
        padding: 0 10px;
        background-color: var(--bg-light);
        border-top: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
    }

    .categories-nav-bar .sections {
        padding: 5px 0;
    }

    .categories-nav-bar .sections li a {
        padding: 10px 14px;
        font-size: 13px;
    }

    /* السطر الرابع للجوال: أحدث المنتجات الممررة أفقياً */
    .last_post {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 15px;
    }

    .latest-label-box h3 {
        font-size: 13px;
    }

    .news {
        gap: 10px;
    }

    .news-item-card img {
        width: 50px;
        height: 50px;
    }
}
@media (max-width: 480px) {
    .site-menu-toggle { top: 54px; right: 8px; width: 40px; height: 40px; }
    .main-desktop-header { padding: 12px 10px; gap: 12px; }
    .logo { margin-right: 44px; }
    .logo-text .site-name { font-size: 19px; }
    .logo-text p { font-size: 10px; }
    .logo img { height: 40px; }
    .action-buttons-list { gap: 8px; flex-wrap: wrap; }
    .action-item a, .theme-toggle { min-width: 44px; }
    .search_input { min-width: 0; font-size: 13px; }
    .button_search { width: 50px; }
}

@media (min-width: 768px) and (max-width: 992px) {
    .site-header-panel.open { max-height: calc(100vh - 44px); overflow-y: auto; }
    .main-desktop-header { padding: 18px 24px; }
}
