/* ========================================
 * 0. Font Import
 * ======================================== */
@import 'https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;600;700&display=swap';

/* ========================================
 * 1. Base / Wrapper
 * ======================================== */

.hafo-header-wrapper {
    width: 100%;
    position: relative;
    background-color: var(--hafo-color-brand-white);
    font-family: var(--hafo-font-family);
    color: var(--hafo-color-black);
}

.hafo-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* ========================================
 * 2. Top Bar
 * ======================================== */

.hafo-top-bar {
    background-color: var(--hafo-color-brand);
    color: var(--hafo-color-brand-white);
    padding: 8px 0;
    font-size: 14px;
    font-weight: 300;
    line-height: 1.5;
}

.hafo-top-bar .hafo-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.top-bar-left,
.top-bar-center,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.top-bar-center {
    flex-grow: 1;
    justify-content: center;
}

.top-bar-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.top-bar-item i,
.top-bar-item svg {
    color: var(--hafo-color-green);
}

/* Mobile Top Bar: Marquee animation */
@media (width <= 767px) {
    .hafo-top-bar {
        overflow: hidden;
        position: relative;
    }

    .hafo-top-bar .hafo-container {
        display: block;
        white-space: nowrap;
        animation: marquee 15s linear infinite;
        padding-left: 100%;
    }

    .top-bar-left,
    .top-bar-center,
    .top-bar-right {
        display: inline-block;
        padding: 0 2rem;
    }

    .top-bar-center,
    .top-bar-right {
        display: inline-block !important;
    }
}

@keyframes marquee {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-100%);
    }
}

/* ========================================
 * 3. Main Header (Logo, Actions)
 * ======================================== */

.hafo-main-header {
    padding: 24px 0;
    background-color: var(--hafo-color-white);
    border-bottom: 1px solid var(--hafo-color-neutral-200);
}

.header-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 32px;
}

/* Logo */
.header-logo .site-title,
.header-logo .custom-logo-link {
    display: block;
    max-width: 200px;
}

.header-logo img {
    height: 100%;
    object-fit: cover;
}

/* Actions (Cart, Menu) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Mobile Toggle in Header (Figma: circular with navy border) */
.mobile-menu-toggle {
    display: none;
    background: var(--hafo-color-pale-blue);
    border: 1px solid var(--hafo-color-brand);
    border-radius: 100px;
    width: 56px;
    height: 56px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 18px;
    color: var(--hafo-color-brand);
    position: relative;
    overflow: hidden;
}

.mobile-menu-toggle:hover {
    background-color: #e8eef5;
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle[aria-expanded="true"] {
    background-color: var(--hafo-color-brand);
    color: var(--hafo-color-brand-white);
}

.mobile-menu-toggle[aria-expanded="true"]:hover {
    background-color: var(--hafo-color-brand);
    transform: rotate(90deg) scale(1.05);
}

.mobile-menu-toggle i {
    display: none;
    color: currentcolor;
}

/* Hamburger icon - animated lines */
.mobile-menu-toggle .hamburger-icon {
    width: 24px;
    height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-toggle .hamburger-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background: currentcolor;
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon {
    transform: rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(1) {
    transform: rotate(90deg);
    transform-origin: center;
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.mobile-menu-toggle[aria-expanded="true"] .hamburger-icon span:nth-child(3) {
    transform: rotate(0deg);
    transform-origin: center;
}

.hafo-cart-sidebar-toggle {
    background: var(--accordion-bg-hover);
    border: 1px solid var(--hafo-color-black);
    border-radius: 50%;
    width: 52px;
    height: 52px;
    cursor: pointer;
    position: relative;
    color: var(--hafo-color-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.hafo-cart-sidebar-toggle:hover {
    background-color: var(--accordion-bg-hover);
}

.cart-icon-wrapper {
    position: relative;
    display: flex;
}

.hafo-cart-sidebar-toggle__count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--hafo-color-green);
    color: var(--hafo-color-brand-white);
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--hafo-color-brand-white);
}

/* Mobile Header layout */
@media (width <= 1024px) {
    .hafo-main-header {
        padding: .5rem 1rem;
    }

    .header-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 0;
    }

    .header-logo {
        order: 1;
        flex: 1;
    }

    .header-logo .custom-logo-link {
        max-width: 165px;
    }

    .header-actions {
        order: 2;
        gap: 16px;
    }

    .mobile-menu-toggle {
        display: flex !important;
    }

}

/* ========================================
 * 4. Navigation Bar
 * ======================================== */

.hafo-nav-bar {
    border-bottom: 1px solid var(--hafo-color-neutral-200);
    background: var(--hafo-color-brand-white);
}

.nav-bar-inner {
    display: flex;
    align-items: center;
    height: 60px;
    justify-content: space-between;
}

.nav-left,
.nav-right {
    flex-shrink: 0;
}

.nav-right {
    display: flex;
    justify-content: flex-end;
}

.nav-center {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

/* Primary Menu (Walker Output) */
.primary-menu {
    display: flex;
    gap: 48px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.primary-menu>.menu-item>a {
    text-decoration: none;
    color: var(--hafo-color-black);
    font-weight: 400;
    font-size: 18px;
    font-family: var(--hafo-font-family);
    padding: 8px 0;
    display: flex;
    gap: 1rem;
    position: relative;
    transition: color 0.2s ease;
}

.primary-menu>.menu-item>a:hover {
    color: var(--hafo-color-brand) !important;
}

/* Simple Dropdown Styles */
.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--hafo-color-brand-white);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 10%);
    min-width: 220px;
    z-index: 50;
    border: 1px solid var(--hafo-color-neutral-200);
    border-radius: 8px;
    padding: 8px 0;
    flex-direction: column;
    gap: 0;
}

.menu-item {
    position: relative;
}

.menu-item:hover>.sub-menu {
    display: flex;
}

.sub-menu .menu-item>a {
    padding: 8px 16px;
    display: block;
    color: var(--hafo-color-black);
    text-decoration: none;
    font-size: 14px;
    font-family: var(--hafo-font-family);
    transition: background 0.2s;
}

.sub-menu .menu-item>a:hover {
    background-color: var(--hafo-color-neutral-50);
    color: var(--hafo-color-brand);
}

/* Language Switcher - Pill Style */
.language-switcher {
    background: var(--hafo-color-brand-white);
    border: 1px solid var(--hafo-color-neutral-200);
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 400;
    font-family: var(--hafo-font-family);
    color: var(--hafo-color-black);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.language-switcher:hover {
    border-color: var(--hafo-color-brand);
    color: var(--hafo-color-brand);
}

/* Mobile Nav: Hide entire nav bar */
@media (width <= 1024px) {
    .hafo-nav-bar {
        display: none;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }
}

/* ========================================
 * 5. Announcement Bar
 * ======================================== */

.announcement-bar {
    background-color: var(--hafo-color-cool-grey);
    color: var(--hafo-color-black);
    padding: 10px 0;
    font-size: 14px;
    font-family: var(--hafo-font-family);
    font-weight: 300;
    position: relative;
    transition: height 0.3s ease, opacity 0.3s ease;
}

.announcement-bar .hafo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.announcement-content {
    text-align: center;
}

.announcement-content strong {
    font-weight: 700;
}

.announcement-close {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: currentcolor;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
    font-size: 14px;
}

.announcement-close:hover {
    opacity: 1;
}

/* Mobile: Adjust announcement text */
@media (width <= 767px) {
    .announcement-bar {
        font-size: 13px;
    }
}
