/**
 * Header Original Design Restoration - EXACT MATCH TO IMAGE
 * استعادة التصميم الأصلي للـ Header - تطابق تام مع الصورة
 * Language Switcher (3 languages), Cart Icon (red badge), Login Button
 */

/* ============================================================================
 * TOP BAR ACTIONS - Compact & Connected Design
 * ============================================================================ */

.top-bar-actions {
    display: flex !important;
    gap: 0 !important; /* No gap - buttons connected */
    flex-wrap: wrap !important;
    align-items: center !important;
    overflow: visible !important;
}

/* ============================================================================
 * LANGUAGE SWITCHER - 3 Languages Connected (Français, العربية, English)
 * ============================================================================ */

.language-switcher {
    display: inline-flex !important;
    gap: 0 !important; /* No gap - connected buttons */
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    border: 1px solid #0B3D91 !important;
}

.btn-lang {
    display: inline-block !important;
    background: #0B3D91 !important; /* Dark blue for inactive (Français, English) */
    border: none !important;
    color: #fff !important; /* White text */
    padding: 10px 16px !important;
    border-radius: 0 !important; /* No border radius for connected look */
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    position: relative !important;
    z-index: 1 !important;
    margin: 0 !important;
}

/* Active language button - EXACT MATCH TO IMAGE (العربية with light blue/grey) */
.btn-lang.active {
    background: #e2e8f0 !important; /* Light blue/grey background - EXACT MATCH */
    color: #0B3D91 !important; /* Dark blue text */
    font-weight: 600 !important;
}

/* Hover effect - subtle */
.btn-lang:hover:not(.active) {
    background: #1f4fa8 !important; /* Slightly lighter blue on hover */
    color: #fff !important;
    z-index: 2 !important;
}

/* ============================================================================
 * CART ICON - EXACT MATCH TO IMAGE (Red Badge)
 * ============================================================================ */

#cart-icon {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 10px 16px !important;
    background: #FFC857 !important; /* YELLOW background - EXACT MATCH TO IMAGE */
    color: #0B3D91 !important; /* Dark blue text */
    border: none !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    margin: 0 8px !important; /* Space from language switcher */
    position: relative !important;
    z-index: 1 !important;
    overflow: visible !important;
}

#cart-icon svg {
    stroke: #0B3D91 !important; /* Dark blue icon */
    fill: none !important;
    width: 20px !important;
    height: 20px !important;
}

#cart-icon .cart-text {
    color: #0B3D91 !important; /* Dark blue text */
    font-weight: 600 !important;
}

/* Cart count badge - RED BADGE (EXACT MATCH TO IMAGE) */
#cart-icon #cart-count {
    background: #dc2626 !important; /* RED background - exact match */
    color: #fff !important; /* White text */
    border-radius: 50% !important;
    padding: 0 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    min-width: 20px !important;
    height: 20px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: -6px !important;
    right: -6px !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4) !important;
    border: 2px solid #fff !important;
}

/* RTL support for cart count */
html[dir="rtl"] #cart-icon #cart-count {
    right: auto !important;
    left: -6px !important;
}

/* Hover effect - subtle */
#cart-icon:hover {
    opacity: 0.8 !important;
}

#cart-icon:hover #cart-count {
    transform: scale(1.1) !important;
}

/* ============================================================================
 * LOGIN BUTTON - Original Professional Design
 * ============================================================================ */

.top-bar-actions > .btn-small:not(#cart-icon):not(.btn-lang) {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important; /* Space for icon */
    padding: 10px 16px !important;
    background: #FFC857 !important; /* YELLOW background - EXACT MATCH TO IMAGE */
    color: #0B3D91 !important; /* Dark blue text */
    border: none !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    position: relative !important;
    z-index: 1 !important;
    white-space: nowrap !important;
}

/* Hover effect - subtle */
.top-bar-actions > .btn-small:not(#cart-icon):not(.btn-lang):hover {
    background: #ffb703 !important; /* Slightly darker yellow */
    color: #0B3D91 !important;
    transform: translateY(-1px) !important;
    z-index: 2 !important;
}

/* Active state */
.top-bar-actions > .btn-small:not(#cart-icon):not(.btn-lang):active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(11, 61, 145, 0.2) !important;
}

/* ============================================================================
 * RESPONSIVE DESIGN
 * ============================================================================ */

@media (max-width: 768px) {
    .top-bar-actions {
        gap: 8px !important; /* Add gap on mobile */
        flex-wrap: wrap !important;
        justify-content: flex-end !important;
    }
    
    .language-switcher {
        gap: 0 !important;
    }
    
    .btn-lang {
        padding: 8px 14px !important;
        font-size: 12px !important;
    }
    
    #cart-icon {
        padding: 8px 14px !important;
        font-size: 12px !important;
        margin: 0 4px !important;
    }
    
    .top-bar-actions > .btn-small:not(#cart-icon):not(.btn-lang) {
        padding: 8px 16px !important;
        font-size: 12px !important;
    }
}

/* ============================================================================
 * RTL/LTR SUPPORT
 * ============================================================================ */

html[dir="rtl"] .top-bar-actions {
    direction: rtl !important;
}

html[dir="ltr"] .top-bar-actions {
    direction: ltr !important;
}

/* Language switcher order in RTL */
html[dir="rtl"] .language-switcher .btn-lang:first-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    border-left: none !important;
    border-right: 1px solid #0B3D91 !important;
}

html[dir="rtl"] .language-switcher .btn-lang:last-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
    border-right: none !important;
    border-left: 1px solid #0B3D91 !important;
}

/* ============================================================================
 * BADGES SECTION - Professional Design (دعم فني 24/7, سيرفرات عالمية متقدمة, Uptime 99.99%)
 * ============================================================================ */

.top-bar {
    /* Background color will be set dynamically from settings via inline style in header.php */
    /* Fallback to dark blue if not set */
    background: var(--brand, #0B3D91) !important;
    border-bottom: none !important;
    padding: 10px 0 !important;
    min-height: 50px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    position: relative !important;
    z-index: 1000 !important;
}

.badges-section {
    display: flex !important;
    gap: 12px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    flex: 1 !important;
    margin: 0 16px !important;
}

.badges-section .badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 8px 16px !important;
    background: rgba(255, 255, 255, 0.15) !important; /* Semi-transparent white */
    color: #fff !important; /* White text */
    border-radius: 20px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    backdrop-filter: blur(10px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.badges-section .badge:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Top bar container - better layout */
.top-bar .container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 20px !important;
    flex-wrap: wrap !important;
    padding: 0 32px !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
    width: 100% !important;
}

/* Logo section - Enhanced Professional Design */
.top-bar .logo {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    color: #fff !important;
    font-weight: 700 !important;
    font-size: 18px !important;
    white-space: nowrap !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
}

.top-bar .logo:hover {
    opacity: 0.9 !important;
    transform: translateY(-1px) !important;
}

.top-bar .logo .mark {
    width: 40px !important;
    height: 40px !important;
    border-radius: 10px !important;
    background: linear-gradient(135deg, #FFC857, #ffb703) !important;
    display: grid !important;
    place-items: center !important;
    color: #0B3D91 !important;
    font-weight: 900 !important;
    font-size: 20px !important;
    box-shadow: 0 2px 8px rgba(255, 200, 87, 0.3) !important;
    transition: all 0.2s ease !important;
}

.top-bar .logo:hover .mark {
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(255, 200, 87, 0.4) !important;
}

.top-bar .logo .established {
    background: rgba(22, 163, 74, 0.95) !important;
    color: #fff !important;
    border-radius: 14px !important;
    padding: 5px 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    margin-inline-start: 10px !important;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3) !important;
    letter-spacing: 0.3px !important;
    text-transform: uppercase !important;
}

/* ============================================================================
 * OVERRIDE CONFLICTS
 * ============================================================================ */

/* Ensure our styles take priority */
.top-bar-actions .btn-lang,
.top-bar-actions #cart-icon,
.top-bar-actions > .btn-small:not(#cart-icon):not(.btn-lang) {
    isolation: isolate !important;
    contain: layout style !important;
    transform: translateZ(0) !important;
    backface-visibility: hidden !important;
    -webkit-backface-visibility: hidden !important;
}

