/* ─── Ensure we fully control the header zone ─── */
header,
header .container-content,
header .content-header {
    all: unset;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 6px 15px !important;
    background-color: #872CFF !important;
    min-height: 60px !important;
    direction: rtl;
}

/* --- Logo smaller & centered vertically --- */
header .logo {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
}
header .logo img {
    height: 36px !important;
    width: auto !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* --- Links aligned in one row --- */
header .links {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px !important;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}
header .links li a {
    font-size: 22px !important; /* Desktop size - appropriate for عباس اكسبريس */
    color: #fff !important;
    padding: 3px 6px !important;
    text-decoration: none !important;
    font-weight: 400 !important;
    line-height: 1 !important;
}
header .links li a:hover {
    opacity: 0.8;
}

/* Larger screens - increase font size */
@media screen and (min-width: 1750px) {
    header .links li a {
        font-size: 30px !important;
    }
}

/* --- Mobile menu: ensure text is visible on white background --- */
@media screen and (max-width: 1080px) {
    header .links li a {
        color: #101b21 !important; /* Dark text on white background */
    }
    header .links li.current-link a {
        color: #872CFF !important; /* Purple for current link */
    }
}

/* --- Right‑side icons (user/cart) smaller --- */
header .shopping-and-login {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
}
header .shopping-and-login svg {
    width: 36px !important;
    height: 36px !important;
}
header .shopping-and-login .user-image {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}
header .shopping-and-login .feather.icon-user {
    width: 36px !important;
    height: 36px !important;
    font-size: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* --- Hamburger cleanup if shown --- */
header .hamburger {
    transform: scale(0.8) !important;
    margin-left: 10px !important;
}

/* --- Ensure hamburger wrapper is clickable --- */
header #show-links-header,
header .wrap {
    cursor: pointer !important;
    pointer-events: auto !important;
    z-index: 10 !important;
    position: relative !important;
}

/* --- Ensure hamburger animation works on mobile --- */
@media screen and (max-width: 1080px) {
    header .hamburger,
    header .hamburger-box,
    header .hamburger-inner,
    header .hamburger-inner:before,
    header .hamburger-inner:after {
        display: block !important;
        visibility: visible !important;
    }
    
    /* Ensure is-active animation works - preserve parent scale */
    header .hamburger--squeeze.is-active .hamburger-inner {
        transform: rotate(45deg) !important;
        -webkit-transform: rotate(45deg) !important;
    }
    header .hamburger--squeeze.is-active .hamburger-inner:after {
        bottom: 0 !important;
        transform: rotate(-90deg) !important;
        -webkit-transform: rotate(-90deg) !important;
    }
    header .hamburger--squeeze.is-active .hamburger-inner:before {
        top: 0 !important;
        opacity: 0 !important;
    }
}

/* --- Remove unexpected margins around group divs --- */
header .content-header > * {
    margin: 0 !important;
}

body header .container-content {
    margin: 0 !important;
    padding: 0 !important;
}

/* =====================================================
   Final header fixes for desktop + mobile + red badge
   ===================================================== */

/* 🔹 Unified icon styling */
header .shopping-and-login {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 28px !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Equal icon size */
header .shopping-and-login svg,
header .shopping-and-login .user-image {
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

header .shopping-and-login .user-image {
    border-radius: 50% !important;
    object-fit: cover !important;
}

/* 🔹 Ensure cart is relative for badge */
header .shopping-and-login .shopping-bag {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* 🔹 Badge - positioned at top-right corner of cart icon */
header .shopping-and-login .shopping-bag .cart-count {
    position: absolute !important;
    top: -2px !important; /* Position at top-right corner */
    right: -2px !important; /* Position at top-right corner */
    min-width: 18px !important;
    min-height: 18px !important;
    width: auto !important; /* Allow width to adjust for larger numbers */
    height: 18px !important;
    padding: 0 4px !important; /* Add padding for larger numbers */
    line-height: 18px !important;
    border-radius: 9px !important; /* Slightly rounded, not fully circular for larger numbers */
    background-color: red !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: bold !important;
    text-align: center !important;
    display: inline-flex !important; /* Change to inline-flex for better number display */
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 0 2px #872CFF !important; /* Clear border to stand out */
    z-index: 10 !important;
    white-space: nowrap !important; /* Prevent text wrapping */
}

/* Fallback for other badge classes */
header .shopping-and-login .shopping-bag::after,
header .shopping-and-login .shopping-bag .badge,
header .shopping-and-login .shopping-bag .cart-badge,
header .shopping-and-login .shopping-bag .count,
header .shopping-and-login .shopping-bag [class*="badge"],
header .shopping-and-login .shopping-bag [class*="count"] {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    width: auto !important;
    height: 18px !important;
    padding: 0 4px !important;
    line-height: 18px !important;
    border-radius: 9px !important;
    background-color: red !important;
    color: #fff !important;
    font-size: 10px !important;
    font-weight: bold !important;
    text-align: center !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 0 2px #872CFF !important;
    z-index: 10 !important;
    white-space: nowrap !important;
}

/* Bootstrap-specific reset - ensure badge is positioned correctly */
header .shopping-and-login .shopping-bag .badge.bg-danger {
    position: absolute !important;
    top: -2px !important;
    right: -2px !important;
    --bs-badge-font-size: 10px !important;
    --bs-badge-padding-x: 4px !important;
    --bs-badge-padding-y: 0 !important;
    --bs-badge-border-radius: 9px !important;
    font-size: 10px !important;
    font-weight: bold !important;
    padding: 0 4px !important;
    width: auto !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    line-height: 18px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 0 0 2px #872CFF !important;
    z-index: 10 !important;
    white-space: nowrap !important;
    border-radius: 9px !important;
}

/* =====================================================
   🔹 Mobile adaptive header layout
   ===================================================== */

@media (max-width: 767px) {
    /* Reduce header height and padding on mobile */
    header,
    header .container-content,
    header .content-header {
        min-height: 50px !important;
        padding: 4px 10px !important;
        height: auto !important;
    }

    header .content-header {
        flex-wrap: nowrap !important; /* Keep everything in one row */
        justify-content: flex-start !important; /* Start from left */
        align-items: center !important;
        gap: 0 !important;
        position: relative !important;
    }

    /* Icons on left side */
    header .shopping-and-login {
        flex: 0 0 auto !important;
        order: 1;
        gap: 16px !important; /* Reduced gap */
        align-items: center !important;
        margin-right: auto !important; /* Push to left */
    }

    /* All icons same size on mobile - slightly larger for clarity */
    header .shopping-and-login svg {
        width: 30px !important;
        height: 30px !important;
    }
    
    header .shopping-and-login .user-image {
        width: 30px !important;
        height: 30px !important;
    }
    
    /* Feather icon (when not logged in) should also match size */
    header .shopping-and-login .feather.icon-user {
        width: 30px !important;
        height: 30px !important;
        font-size: 30px !important;
    }

    /* Logo centered in the middle */
    header .logo {
        position: absolute !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        order: 2;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 auto !important;
    }
    
    /* Reduce logo image size on mobile */
    header .logo img {
        height: 24px !important;
        width: auto !important;
        max-width: 120px !important; /* Prevent logo from being too wide */
    }

    /* Hamburger on right side - same size as other icons */
    header .hamburger {
        flex: 0 0 auto !important;
        order: 3;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 30px !important;
        height: 30px !important;
    }
    
    /* Make hamburger box match icon size */
    header .hamburger .hamburger-box {
        width: 30px !important;
        height: 30px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Adjust hamburger inner size to match container */
    header .hamburger .hamburger-inner {
        width: 26px !important;
    }
    
    header .hamburger .hamburger-inner,
    header .hamburger .hamburger-inner:before,
    header .hamburger .hamburger-inner:after {
        height: 3px !important;
    }
    
    /* Smaller cart badge on mobile, aligned tight to top-right */
    header .shopping-and-login .shopping-bag .cart-count,
    header .shopping-and-login .shopping-bag::after,
    header .shopping-and-login .shopping-bag .badge,
    header .shopping-and-login .shopping-bag .cart-badge,
    header .shopping-and-login .shopping-bag .count,
    header .shopping-and-login .shopping-bag [class*="badge"],
    header .shopping-and-login .shopping-bag [class*="count"] {
        min-width: 14px !important;
        min-height: 14px !important;
        width: auto !important;
        height: 14px !important;
        padding: 0 3px !important;
        font-size: 9px !important;
        line-height: 14px !important;
        border-radius: 7px !important;
        top: -2px !important;
        right: -2px !important;
        box-shadow: 0 0 0 1px #872CFF !important;
    }
    
    /* Ensure hamburger wrapper is on the right */
    header #show-links-header,
    header .wrap {
        flex: 0 0 auto !important;
        margin-left: auto !important; /* Push to right */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* Ensure menu is positioned correctly and visible when active */
    header .links.active-links {
        left: 0 !important;
    }
    
    /* Make sure menu items are visible */
    header .links li {
        width: 100% !important;
        display: block !important;
    }
    
    header .links li a {
        width: 100% !important;
        display: block !important;
        padding: 14px 16px !important;
        color: #101b21 !important;
        border-bottom: 1px solid #872CFF !important;
    }
}

