/* header.css */
/* Header Styles */
#masthead {
    padding: 0;
    margin: 0;
}

.header-container {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Top Bar */
.header-top-bar {
    background-color: var(--color-dark-blue);
    padding: 10px 0;
}

.top-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: flex-end;
    gap: 30px;
}

.top-navigation a {
    color: #FFFFFFA6;
    text-decoration: none;
    font-size: 14px;
}

.top-navigation a:hover {
    text-decoration: underline;
}

/* Main Header */
.header-main {
    position: relative;
    z-index: 100; /* Keep z-index for potential overlaps */
    background-color: var(--color-white);
    padding: 20px 0;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e5e5e5;
}

.header-main .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
}

/* Logo */
.site-branding {
    flex: 0 0 200px;
    max-width: 200px;
}

.site-logo {
    max-width: 180px;
    height: auto;
    display: block; /* Good practice for images */
}

/* Navigation Icons */
.header-navigation {
    flex: 0 0 220px;
    max-width: 220px;
    display: flex;
    justify-content: flex-end;
}

.nav-icons {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 15px;
}

.nav-icon-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--color-dark-blue);
    font-size: 14px;
}

.nav-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 5px;
    color: var(--color-dark-blue);
}

/* Cart specific styles */
.cart-icon-wrapper {
    width: 28px;
    height: 28px;
    position: relative;
    margin-bottom: 5px;
}

.cart-icon-wrapper .nav-icon {
    margin-bottom: 0;
    position: absolute;
    top: 0;
    left: 0;
}

.cart-count {
    position: absolute;
    top: -10px;
    right: -12px;
    background: #d51625;
    color: white;
    font-size: 11px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1px;
    font-weight: 700;
    z-index: 1;
}

/* Hide count if it's zero */
.cart-count:empty,
.cart-count[data-count="0"] {
    display: none;
}

.cart-link .cart-total {
    color: var(--color-dark-blue);
    font-weight: 400;
}

/* Category Navigation */
.header-categories {
    background-color: var(--color-white);
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding: 10px 0;
    position: relative;
    z-index: 80; /* Lower than main header/search dropdown */
}

.category-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 30px;
}

.category-navigation a {
    color: var(--color-dark-blue);
    text-decoration: none;
    padding: 5px 0;
    position: relative;
    font-weight: 700;
}

/* Hover state */
.category-navigation a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--color-dark-blue);
}

/* Active state */
.category-navigation .current-menu-item > a::after,
.category-navigation .current-category-ancestor > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--color-dark-blue);
}

/* Account Dropdown */
.account-dropdown-container {
    position: relative;
}

.account-dropdown-toggle {
    position: relative; /* Needed for arrow positioning */
}

.dropdown-arrow {
    position: absolute;
    right: 0;
    top: 50%;
    width: 0;
    height: 0;
    margin-top: 8px; /* Adjust as needed */
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid var(--color-dark-blue);
    transition: transform 0.2s ease;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 10px); /* Spacing from toggle */
    right: -10px; /* Adjust alignment */
    width: 200px;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 200; /* High z-index */
    padding: 10px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.25s ease-in-out;
}

.account-dropdown:before { /* Dropdown arrow indicator */
    content: '';
    position: absolute;
    top: -6px;
    right: 27px; /* Adjust position to align with toggle */
    width: 12px;
    height: 12px;
    background-color: white;
    transform: rotate(45deg);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-left: 1px solid rgba(0, 0, 0, 0.05);
}

.account-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.account-dropdown-container:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.account-dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.account-dropdown-menu li {
    padding: 0;
    margin: 0;
}

.account-dropdown-menu li a {
    display: block;
    padding: 8px 15px;
    color: var(--color-dark-blue);
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.account-dropdown-menu li a:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

.dropdown-divider {
    height: 1px;
    margin: 6px 0;
    background-color: rgba(0, 0, 0, 0.1);
}

/* Hamburger Menu Button */
.hamburger-menu-container {
    display: none; /* Hidden by default, shown in media query */
    align-items: center;
}

.hamburger-menu-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 23px;
    width: 30px;
}

.hamburger-bar {
    display: block;
    width: 100%;
    height: 2px;
    background-color: var(--color-dark-blue);
    border-radius: 0px;
    transition: all 0.3s ease;
}

/* Mobile Menu System */
.mobile-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.mobile-menu-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    right: -100%; /* Start off-screen */
    bottom: 0;
    width: 100%;
    max-width: 320px;
    background-color: white;
    z-index: 9999;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    overflow-y: auto;
}

.mobile-menu-overlay.active {
    right: 0;
}

.mobile-menu-content {
    padding: 20px;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.mobile-menu-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--color-dark-blue);
}

.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: var(--color-dark-blue);
    padding: 0; /* Remove default padding */
    line-height: 1; /* Ensure consistent height */
}

.close-icon { /* If using an icon font or SVG */
    font-size: 28px;
    line-height: 1;
}

.mobile-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-menu-list > li {
    margin-bottom: 15px;
}

.mobile-menu-list > li > a {
    display: block;
    font-weight: 700;
    color: var(--color-dark-blue);
    text-decoration: none;
    padding: 8px 0;
    font-size: 16px;
}

.mobile-menu-section {
    margin-top: 25px;
}

.mobile-menu-section-title {
    display: block;
    font-weight: 700;
    color: var(--color-dark-blue);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e5e5e5;
}

.mobile-menu-subsection {
    list-style: none;
    margin: 0;
    padding: 0 0 0 10px; /* Indent subsection items */
}

.mobile-menu-subsection li {
    margin-bottom: 5px;
}

.mobile-menu-subsection a {
    color: var(--color-dark-blue);
    text-decoration: none;
    display: block;
    padding: 5px 0;
}

body.menu-open {
    overflow: hidden; /* Prevent background scroll when mobile menu is open */
}

/* Mobile-specific classes */
.mobile-only {
    display: none;
}

.mobile-hide {
    display: block; /* Or flex, inline-block etc. depending on element */
}

/* Cart popup (Keep general popup styles here if used elsewhere, otherwise move) */
.cart-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.2);
    z-index: 1000;
}

.cart-popup-content {
    text-align: center;
}

.cart-popup p {
    margin: 0 0 20px 0;
    font-size: 16px;
}

.cart-popup .button {
    display: inline-block;
    background: var(--color-dark-blue);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    text-decoration: none;
}

.cart-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}


/* Responsive General Header */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 15px;
    }

    .nav-icons {
        gap: 15px;
    }
}

@media (max-width: 768px) {
    /* Hide elements on mobile */
    .header-top-bar,
    .header-categories {
        display: none;
    }

    .mobile-hide {
        display: none;
    }

    .mobile-only {
        display: block; /* Or flex, inline-block etc. */
    }

    /* Updated mobile logo size */
    .site-branding {
        flex: 0 0 140px;
        max-width: 140px;
    }

    .site-logo {
        max-width: 140px;
    }

    /* Updated hamburger menu positioning */
    .hamburger-menu-container {
        display: flex; /* Changed from block to flex */
        margin-left: 10px;
        position: relative;
        top: 4px; /* Push down slightly */
    }

    .header-main .header-container {
        flex-wrap: wrap;
        gap: 10px; /* Adjust gap for mobile */
    }

    .header-navigation {
        flex: 0 0 auto; /* Allow it to size based on content */
        display: flex;
        align-items: center;
    }

    .nav-icon-link {
        font-size: 12px;
    }

    .nav-icon {
        width: 24px;
        height: 24px;
    }

    .cart-icon-wrapper {
        width: 24px;
        height: 24px;
    }

    .cart-link .cart-total {
        font-size: 12px;
    }
}