/* ==========================================================================
   Navigation Styles (nav.css) - نالش
   يحتوي على: الهيدر الرئيسي، الهيدر الشفاف، القوائم السفلية، وهيدر المتاجر
   ========================================================================== */

/* ----------------------------------
   1. الهيدر الرئيسي (Main Header)
------------------------------------- */
.header-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    will-change: transform;
}

.navbar {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.navbar-scrolled {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.nav-container {
    width: 100%;
    max-width: 1280px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-size: 1.5rem;
    font-weight: 900;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.logo i {
    color: var(--primary);
    font-size: 1.8rem;
}

/* ----------------------------------
   2. أزرار الهيدر والإشعارات
------------------------------------- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.icon-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.2);
    color: var(--primary);
    border-color: var(--primary);
}

.icon-btn:active {
    transform: scale(0.95);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-body);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.cart-badge.show {
    opacity: 1;
    transform: scale(1);
}

.user-initial {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    font-weight: 800;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

/* ----------------------------------
   3. شريط الفئات الفرعي (Sub Navbar)
------------------------------------- */
.sub-navbar {
    height: var(--sub-nav-height);
    background: var(--bg-body);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 15px;
    overflow-x: auto;
    scrollbar-width: none;
    transform: translateZ(0);
}

.sub-navbar::-webkit-scrollbar {
    display: none;
}

.sub-nav-item {
    padding: 8px 20px;
    margin: 0 5px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-nav-item i {
    font-size: 1rem;
}

.sub-nav-item.active {
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    border-color: rgba(79, 70, 229, 0.2);
}

/* ----------------------------------
   4. الشريط السفلي للهواتف (Mobile Bottom Bar)
------------------------------------- */
.mobile-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.05);
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    padding: 10px 0;
}

.nav-item .nav-icon-container {
    position: relative;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active .nav-icon-container {
    transform: translateY(-5px);
}

/* ----------------------------------
   5. هيدر المتجر المستقل (Isolated Mode)
------------------------------------- */
.isolated-header {
    display: flex !important;
    flex-direction: column;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: translateY(-100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s, border 0.3s, box-shadow 0.3s !important;
    background: transparent;
    border-bottom: transparent;
    box-shadow: none;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 200 !important;
    height: 55px !important;
    width: 100% !important;
}

.isolated-header.scrolled {
    transform: translateY(0) !important;
    background: var(--glass-bg) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

.isolated-top {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0 15px !important;
    height: 55px !important;
    width: 100% !important;
}

.iso-brand {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1;
}

.iso-avatar-box {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 900;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4);
}

.iso-text-box h1 {
    font-size: 1rem;
    font-weight: 900;
    margin: 0;
    color: var(--text-main);
    line-height: 1.2;
}

.iso-text-box p {
    font-size: 0.85rem;
    color: var(--primary);
    margin: 0;
    font-weight: 700;
}

.iso-actions {
    display: flex;
    gap: 8px;
}

.iso-exit-btn, .store-exit-btn-new {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: none;
    border-radius: 10px;
    padding: 6px 12px;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: 0.3s;
}

.iso-exit-btn:hover, .store-exit-btn-new:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

/* الشريط السفلي للمتجر المستقل */
.isolated-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 75px;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 32px 0 rgba(31, 38, 135, 0.05);
    display: none;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

/* شريط الفئات اللاصق للمتجر (Sticky Category Bar) */
.sticky-category-bar {
    position: sticky !important;
    top: 0 !important;
    z-index: 190 !important;
    margin-top: 0 !important;
    background: var(--glass-bg) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    padding: 10px 15px !important;
    margin-bottom: 10px !important;
    border-bottom: 1px solid var(--border) !important;
    transition: top 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
}

.sticky-category-bar::-webkit-scrollbar {
    display: none;
}

body.header-is-scrolled .sticky-category-bar {
    top: 47px !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03) !important;
}

.premium-cat-btn {
    background: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 16px !important;
    border-radius: 16px;
    font-weight: 800;
    font-size: 0.8rem !important;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.premium-cat-btn:hover {
    border-color: var(--primary);
}

.premium-cat-btn.active {
    background: var(--text-main);
    color: var(--bg-body);
    border-color: var(--text-main);
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.dark-mode .premium-cat-btn.active {
    box-shadow: 0 8px 20px rgba(255,255,255,0.1);
}

/* ----------------------------------
   6. الهيدر الشفاف (Transparent Header) للصور الكبيرة
------------------------------------- */
.transparent-header {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: transparent !important;
    border: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    z-index: 10 !important;
}

/* ----------------------------------
   7. تعديلات الشاشات الكبيرة (التابلت والكمبيوتر)
------------------------------------- */
@media (min-width: 768px) {
    /* جعل الشريط السفلي يظهر في المنتصف بشكل أنيق ولا يختفي */
    .mobile-bar, .isolated-bottom-bar {
        display: flex !important; 
        max-width: 500px;
        left: 50% !important;
        transform: translateX(-50%);
        bottom: 15px;
        border-radius: 25px;
        border: 1px solid var(--border);
        box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    }
}