/**
 * ArchFinishes Global Header Styles
 */

/* CSS Variables (can be overridden by customizer) */
.af-header {
    --header-bg: #FFFFFF;
    --header-text: #1a1a1a;
    --header-accent: #4A90B8;
    --header-height: 72px;
    --header-border: #E5E7EB;
}

/* ========================================
   MAIN HEADER
   ======================================== */
.af-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.af-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-height);
    gap: 32px;
}


/* ========================================
   LOGO
   ======================================== */
.af-header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--header-text);
    flex-shrink: 0;
}

.af-logo-icon {
    color: var(--header-accent);
}

.af-logo-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--header-text);
    transition: color 0.2s ease;
}

/* Logo Image */
.af-logo-image {
    height: 40px;
    width: auto;
    object-fit: contain;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.af-header-logo:hover .af-logo-image {
    transform: scale(1.03);
}

.af-header-logo:hover .af-logo-icon,
.af-header-logo:hover .af-logo-text {
    color: var(--header-accent);
}

/* ========================================
   NAVIGATION
   ======================================== */
.af-header-nav {
    flex: 1;
    display: flex;
    justify-content: center;
}

.af-nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 8px;
}

.af-nav-item {
    position: relative;
}

.af-nav-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: var(--header-text);
    text-decoration: none;
    transition: color 0.2s ease;
    border-radius: 6px;
}

.af-nav-link:hover {
    color: var(--header-accent);
    background: rgba(74, 144, 184, 0.06);
}

/* ========================================
   MEGA MENU
   ======================================== */
.af-mega-menu {
    position: fixed;
    top: var(--header-height);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid var(--header-border);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 32px 40px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    width: 90%;
    max-width: 1000px;
    margin-top: 8px;
    z-index: 999;
}

.af-nav-item.has-mega-menu:hover .af-mega-menu {
    opacity: 1;
    visibility: visible;
}

.af-mega-inner {
    display: grid;
    grid-template-columns: 180px 1fr 1fr;
    gap: 40px;
}

.af-mega-title {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--header-text);
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.af-mega-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.af-mega-list li {
    margin-bottom: 4px;
}

.af-mega-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 14px;
    color: #4B5563;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.af-mega-list a:hover {
    background: #F3F4F6;
    color: var(--header-accent);
}

.af-mega-list a .material-symbols-outlined {
    font-size: 20px;
    color: #9CA3AF;
}

.af-mega-list--2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

/* Styles Column - wide layout */
.af-mega-col--wide {
    min-width: 280px;
}

.af-mega-section {
    margin-bottom: 20px;
}

.af-mega-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: #6B7280;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.af-mega-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.af-mega-tag {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    color: #4B5563;
    background: #F3F4F6;
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.af-mega-tag:hover {
    background: var(--header-accent);
    color: #fff;
}

/* Color Swatches */
.af-color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.af-color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #E5E7EB, 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.af-color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px var(--header-accent), 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ========================================
   HEADER ICONS
   ======================================== */
.af-header-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.af-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: var(--header-text);
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}

.af-header-icon:hover {
    background: #F3F4F6;
    color: var(--header-accent);
}

.af-header-icon .material-symbols-outlined {
    font-size: 22px;
}

.af-cart-icon {
    position: relative;
}

.af-cart-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: var(--header-accent);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile Toggle */
.af-mobile-toggle {
    display: none;
}

/* ========================================
   SEARCH OVERLAY
   ======================================== */
/* ========================================
   CINEMATIC FULL-SCREEN SEARCH
   ======================================== */
.af-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 2000;
    visibility: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    padding-top: 120px; /* Floating position */
}

@media (max-width: 768px) {
    .af-search-overlay {
        padding-top: 80px; /* Adjust for mobile */
    }
}

.af-search-overlay.is-open {
    visibility: visible;
    opacity: 1;
}

.af-search-inner {
    width: 90%;
    max-width: 800px;
    background: rgba(18, 18, 18, 0.95);
    padding: 12px 12px 12px 20px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transform: translateY(-40px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    height: fit-content;
}

.af-search-overlay.is-open .af-search-inner {
    transform: translateY(0) scale(1);
}

.af-search-inner form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.af-search-input {
    flex: 1;
    padding: 10px 0;
    font-size: 16px;
    border: none;
    background: transparent;
    color: #FFFFFF;
    outline: none;
    font-family: inherit;
}

.af-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.af-search-submit,
.af-search-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    transition: all 0.2s ease;
}

.af-search-submit:hover,
.af-search-close:hover {
    background: var(--header-accent);
    color: #fff;
    transform: scale(1.05);
}

.af-search-close {
    background: rgba(255, 255, 255, 0.05);
}

/* ========================================
   MOBILE MENU
   ======================================== */
.af-mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: #fff;
    z-index: 1002;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.af-mobile-menu.is-open {
    transform: translateX(0);
}

.af-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
}

.af-mobile-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #4B5563;
}

.af-mobile-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.af-mobile-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.af-mobile-nav li {
    border-bottom: 1px solid #F3F4F6;
}

.af-mobile-nav li.has-submenu {
    display: block;
}

.af-mobile-nav-item-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.af-mobile-nav-item-wrap a {
    flex: 1;
}

/* Mobile Submenu Accordion */
.af-mobile-submenu {
    max-height: 0;
    overflow: hidden;
    background: #F9FAFB;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.af-mobile-nav li.is-expanded > .af-mobile-submenu {
    max-height: 1200px; /* High enough to contain all items */
}

.af-mobile-submenu-inner {
    padding: 12px 24px 24px 32px;
}

.af-mobile-submenu-group {
    margin-bottom: 24px;
}

.af-mobile-submenu-group:last-child {
    margin-bottom: 0;
}

.af-mobile-submenu-title {
    font-size: 13px;
    font-weight: 700;
    color: #9CA3AF;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

.af-mobile-submenu ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.af-mobile-submenu li {
    border-bottom: none !important;
}

.af-mobile-submenu li a {
    display: block;
    padding: 8px 0 !important;
    font-size: 15px !important;
    font-weight: 500;
    color: var(--af-text, #1A1A1A) !important;
    text-decoration: none;
    background: transparent !important;
}

.af-mobile-submenu li a:hover {
    color: var(--header-accent) !important;
}

/* Submenu Toggle Icon Rotation */
.af-submenu-toggle .material-symbols-outlined {
    transition: transform 0.3s ease;
}

.af-mobile-nav li.is-expanded .af-submenu-toggle .material-symbols-outlined {
    transform: rotate(90deg);
}

.af-mobile-nav a {
    display: block;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 500;
    color: var(--header-text);
    text-decoration: none;
}

.af-mobile-nav a:hover {
    background: #F9FAFB;
    color: var(--header-accent);
}

.af-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9CA3AF;
}

.af-mobile-icons {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    border-top: 1px solid #E5E7EB;
}

.af-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.af-mobile-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .af-header-nav {
        display: none;
    }

    .af-mobile-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        background: transparent;
        border: none;
        cursor: pointer;
        color: var(--header-text);
        transition: background 0.2s ease, transform 0.2s ease;
    }

    .af-mobile-toggle:hover {
        background: rgba(0, 0, 0, 0.05);
    }

    .af-mobile-toggle:active {
        transform: scale(0.95);
    }

    .af-mobile-toggle .material-symbols-outlined {
        font-size: 26px;
    }

    .af-header-icons .af-header-icon:not(.af-cart-icon):not(.af-mobile-toggle):not(.af-search-toggle) {
        display: none;
    }


    .af-logo-image {
        height: 32px;
    }

    .af-header-inner {
        gap: 8px;
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .af-header-inner {
        padding: 0 12px;
        gap: 8px;
    }

    .af-logo-text {
        font-size: 14px;
        letter-spacing: -0.2px;
    }

    .af-logo-image {
        height: 24px;
    }

    .af-mobile-menu {
        width: 100%;
        max-width: 100%;
    }

    .af-header-icons {
        gap: 2px;
    }

    .af-header-icon {
        width: 32px;
        height: 32px;
    }

    .af-header-icon .material-symbols-outlined {
        font-size: 18px;
    }
}


/* ========================================
   HEADER LOAD ANIMATION
   ======================================== */
@keyframes headerSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.af-header {
    animation: headerSlideIn 0.4s ease-out;
}

/* ========================================
   STICKY HEADER VARIANTS
   ======================================== */
.af-header--sticky {
    position: sticky;
    top: 0;
}

.af-header:not(.af-header--sticky) {
    position: relative;
}

/* Scrolled state - enhanced shadow */
.af-header.is-scrolled {
    box-shadow: var(--header-shadow, 0 2px 8px rgba(0, 0, 0, 0.08));
}

/* ========================================
   TRANSPARENT HEADER (Home Page Only)
   ======================================== */
.af-header--transparent {
    position: absolute;
    width: 100%;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
}

.af-header--transparent .af-header-logo,
.af-header--transparent .af-nav-link,
.af-header--transparent .af-logo-text,
.af-header--transparent .af-header-icon {
    color: var(--header-transparent-text, #FFFFFF);
}

.af-header--transparent .af-logo-icon {
    color: var(--header-transparent-text, #FFFFFF);
}

.af-header--transparent .af-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--header-transparent-text, #FFFFFF);
}

/* Transparent header becomes solid on scroll */
.af-header--transparent.is-scrolled {
    position: sticky;
    background: var(--header-bg);
    border-bottom: 1px solid var(--header-border);
    box-shadow: var(--header-shadow, 0 2px 8px rgba(0, 0, 0, 0.08));
}

.af-header--transparent.is-scrolled .af-header-logo,
.af-header--transparent.is-scrolled .af-nav-link,
.af-header--transparent.is-scrolled .af-logo-text,
.af-header--transparent.is-scrolled .af-header-icon {
    color: var(--header-text);
}

.af-header--transparent.is-scrolled .af-logo-icon {
    color: var(--header-accent);
}

.af-header--transparent.is-scrolled .af-nav-link:hover {
    background: rgba(74, 144, 184, 0.06);
    color: var(--header-accent);
}

/* ========================================
   SHRINK ON SCROLL
   ======================================== */
.af-header--shrink-enabled {
    --header-height: 72px;
    transition: all 0.3s ease;
}

.af-header--shrink-enabled.is-scrolled {
    --header-height: 56px;
}

.af-header--shrink-enabled.is-scrolled .af-logo-text {
    font-size: 18px;
}

.af-header--shrink-enabled.is-scrolled .af-logo-icon {
    transform: scale(0.9);
}

/* ========================================
   LINK HOVER ANIMATIONS
   ======================================== */

/* Style 1: Underline Slide */
.af-header--hover-underline .af-nav-link {
    position: relative;
    overflow: hidden;
}

.af-header--hover-underline .af-nav-link::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 16px;
    right: 16px;
    height: 2px;
    background: var(--header-accent);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform var(--animation-speed, 200ms) ease;
}

.af-header--hover-underline .af-nav-link:hover::after {
    transform: scaleX(1);
}

/* Style 2: Color Fade */
.af-header--hover-fade .af-nav-link {
    transition: color var(--animation-speed, 200ms) ease,
        background var(--animation-speed, 200ms) ease,
        opacity var(--animation-speed, 200ms) ease;
}

.af-header--hover-fade .af-nav-link:hover {
    color: var(--header-accent);
    opacity: 1;
}

.af-header--hover-fade .af-nav-list:hover .af-nav-link:not(:hover) {
    opacity: 0.6;
}

/* Style 3: Scale Up */
.af-header--hover-scale .af-nav-link {
    transition: transform var(--animation-speed, 200ms) ease,
        color var(--animation-speed, 200ms) ease;
}

.af-header--hover-scale .af-nav-link:hover {
    transform: scale(1.05);
    color: var(--header-accent);
}

/* ========================================
   ICON HOVER EFFECTS
   ======================================== */
.af-header--icon-effects .af-header-icon {
    transition: transform var(--animation-speed, 200ms) ease,
        color var(--animation-speed, 200ms) ease,
        background var(--animation-speed, 200ms) ease;
}

.af-header--icon-effects .af-header-icon:hover {
    transform: scale(1.1);
    color: var(--header-accent);
    background: rgba(74, 144, 184, 0.08);
}

.af-header--icon-effects .af-header-icon .material-symbols-outlined {
    transition: transform var(--animation-speed, 200ms) ease;
}

.af-header--icon-effects .af-header-icon:hover .material-symbols-outlined {
    transform: scale(1.05);
}

/* Cart icon bounce on hover */
.af-header--icon-effects .af-cart-icon:hover {
    animation: iconBounce 0.4s ease;
}

@keyframes iconBounce {

    0%,
    100% {
        transform: scale(1.1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* ========================================
   MEGA MENU ENHANCED ANIMATION
   ======================================== */
.af-mega-menu {
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.25s ease,
        visibility 0.25s ease,
        transform 0.25s ease;
}

.af-nav-item.has-mega-menu:hover .af-mega-menu {
    transform: translateX(-50%) translateY(0);
}

/* Staggered list item animations */
.af-mega-list li {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li {
    opacity: 1;
    transform: translateY(0);
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(1) {
    transition-delay: 0.02s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(2) {
    transition-delay: 0.04s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(3) {
    transition-delay: 0.06s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(4) {
    transition-delay: 0.08s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(5) {
    transition-delay: 0.10s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(6) {
    transition-delay: 0.12s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(7) {
    transition-delay: 0.14s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(8) {
    transition-delay: 0.16s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(9) {
    transition-delay: 0.18s;
}

.af-nav-item.has-mega-menu:hover .af-mega-list li:nth-child(n+10) {
    transition-delay: 0.20s;
}

/* Mega menu tags animation */
.af-mega-tag {
    transition: background var(--animation-speed, 200ms) ease,
        color var(--animation-speed, 200ms) ease,
        transform var(--animation-speed, 200ms) ease;
}

.af-mega-tag:hover {
    transform: translateY(-2px);
}

/* ========================================
   TRANSPARENT HEADER RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
    .af-header--transparent {
        position: sticky;
        background: var(--header-bg);
        border-bottom: 1px solid var(--header-border);
    }

    .af-header--transparent .af-header-logo,
    .af-header--transparent .af-nav-link,
    .af-header--transparent .af-logo-text,
    .af-header--transparent .af-header-icon {
        color: var(--header-text);
    }

    .af-header--transparent .af-logo-icon {
        color: var(--header-accent);
    }
}