/* ==========================================================================
   HEADER STYLES - MOBILE OPTIMIZED WITH PRODUCT DROPDOWN (SCROLL FIX)
   ========================================================================== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: #FFFFFF !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    animation: headerSlide 0.8s var(--ease-out-expo) forwards;
    transition: box-shadow 0.3s ease;
}

.header.scrolled {
    background: #FFFFFF !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.12);
}

@keyframes headerSlide {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 32px;
    height: 85px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1001;
    flex-shrink: 0;
}

.logo-img {
    height: 45px;
    width: auto;
    max-width: 100%;
    display: block;
}

.nav {
    display: flex;
    align-items: center;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-list li {
    position: relative;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-700);
    border-radius: var(--border-radius-pill);
    transition: var(--transition-fast);
    position: relative;
    text-decoration: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition-fast);
    transform: translateX(-50%);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link:hover::after {
    width: 20px;
}

/* ==========================================================================
   DROPDOWN MENU STYLES
   ========================================================================== */
.nav-item-dropdown {
    position: relative;
}

.nav-link-dropdown {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.dropdown-arrow {
    transition: transform 0.3s ease;
}

.nav-link-dropdown:hover .dropdown-arrow,
.nav-link-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 600px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    margin-top: 10px;
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
    pointer-events: none;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    margin-top: 5px;
    pointer-events: auto;
}

/* Desktop hover to open dropdown */
@media (min-width: 993px) {
    .nav-item-dropdown:hover .dropdown-menu {
        opacity: 1;
        visibility: visible;
        margin-top: 5px;
        pointer-events: auto;
    }
    
    .nav-item-dropdown:hover .dropdown-arrow {
        transform: rotate(180deg);
    }
}

.dropdown-content {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.dropdown-category {
    border-left: 3px solid var(--primary);
    padding-left: 15px;
}

.dropdown-category-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dropdown-product-link {
    font-size: 0.9rem;
    color: var(--gray-600);
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    display: block;
}

.dropdown-product-link:hover {
    background: rgba(242, 107, 34, 0.1);
    color: var(--primary);
    padding-left: 16px;
}

.dropdown-empty {
    font-size: 0.85rem;
    color: var(--gray-400);
    font-style: italic;
}

/* ==========================================================================
   HEADER ACTIONS
   ========================================================================== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.header-cta {
    padding: 12px 28px;
    font-size: 14px;
    background: var(--gradient-primary);
    color: var(--secondary);
    border-radius: var(--border-radius-pill);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(242, 107, 34, 0.3);
    text-decoration: none;
    white-space: nowrap;
}

.header-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(242, 107, 34, 0.4);
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 48px;
    height: 48px;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    z-index: 1001;
    padding: 0;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.hamburger:hover {
    background: rgba(0, 0, 0, 0.1);
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--gray-800);
    border-radius: 2px;
    transition: var(--transition-fast);
    position: relative;
}

.hamburger-line:nth-child(1) {
    transform: translateY(-6px);
}

.hamburger-line:nth-child(3) {
    transform: translateY(6px);
}

.hamburger.active .hamburger-line:nth-child(1) {
    transform: translateY(2px) rotate(45deg);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: translateY(-2px) rotate(-45deg);
}

.mobile-cta {
    display: none;
}

/* Overlay for mobile menu */
.nav-overlay {
    display: none;
}

/* ==========================================================================
   TABLET BREAKPOINT (992px and below)
   ========================================================================== */
@media (max-width: 992px) {
    .header-container {
        height: 70px;
        padding: 0 20px;
    }
    
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        height: 100dvh;
        background: #FFFFFF;
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
        padding: 20px;
        padding-top: 90px;
        padding-bottom: 30px;
        transition: right 0.3s ease;
        overflow-y: auto;
        overflow-x: hidden;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        box-sizing: border-box;
        /* Enable smooth scrolling */
        -webkit-overflow-scrolling: touch;
    }
    
    .nav.active {
        right: 0;
    }
    
    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .nav-list li {
        width: 100%;
    }
    
    .nav-link {
        font-size: 1rem;
        padding: 14px 20px;
        border-radius: 12px;
        color: var(--gray-700);
        text-align: left;
        background: var(--gray-50);
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    
    .nav-link::after {
        display: none;
    }
    
    .nav-link:hover,
    .nav-link:active {
        background: rgba(242, 107, 34, 0.1);
        color: var(--primary);
    }
    
    /* Mobile Dropdown Styles */
    .dropdown-menu {
        position: static;
        transform: none;
        min-width: 100%;
        width: 100%;
        margin: 0;
        margin-top: 8px;
        box-shadow: none;
        border: 1px solid var(--gray-200);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease, padding 0.3s ease;
        padding: 0;
        border-radius: 8px;
    }
    
    .dropdown-menu.show {
        max-height: 400px;
        overflow-y: auto;
        padding: 15px;
        margin-top: 8px;
        /* Enable smooth scrolling */
        -webkit-overflow-scrolling: touch;
    }
    
    .dropdown-content {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0;
    }
    
    .dropdown-category {
        border-left: 2px solid var(--primary);
        padding-left: 12px;
    }
    
    .dropdown-category-title {
        font-size: 0.85rem;
        margin-bottom: 10px;
    }
    
    .dropdown-product-link {
        font-size: 0.85rem;
        padding: 10px 12px;
    }
    
    .nav-link-dropdown {
        justify-content: space-between;
    }
    
    .header-cta {
        display: none;
    }
    
    .mobile-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px 16px;
        font-size: 12px;
        background: var(--gradient-primary);
        color: var(--secondary);
        border-radius: var(--border-radius-pill);
        font-weight: 500;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        box-shadow: 0 4px 15px rgba(242, 107, 34, 0.3);
        text-decoration: none;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .hamburger {
        display: flex;
    }
    
    .header-actions {
        gap: 10px;
    }
    
    .nav-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 999;
        backdrop-filter: blur(5px);
    }
    
    .nav-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* FIXED: Remove body position fixed to allow scrolling */
    body.menu-open {
        overflow: hidden;
        /* Don't use position: fixed as it prevents scrolling */
    }
}

/* ==========================================================================
   MOBILE BREAKPOINT (768px and below)
   ========================================================================== */
@media (max-width: 768px) {
    .header-container {
        padding: 0 16px;
    }
    
    .logo-img {
        height: 40px;
    }
    
    .mobile-cta {
        padding: 9px 14px;
        font-size: 11px;
    }
    
    .hamburger {
        width: 44px;
        height: 44px;
    }
    
    .nav {
        width: 280px;
        padding: 16px;
        padding-top: 85px;
        padding-bottom: 25px;
    }
    
    .dropdown-category-title {
        font-size: 0.8rem;
    }
    
    .dropdown-product-link {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
    
    .dropdown-menu.show {
        max-height: 350px;
    }
}

/* ==========================================================================
   SMALL MOBILE BREAKPOINT (480px and below)
   ========================================================================== */
@media (max-width: 480px) {
    .header-container {
        height: 65px;
        padding: 0 12px;
    }
    
    .logo-img {
        height: 35px;
    }
    
    .mobile-cta {
        padding: 8px 12px;
        font-size: 10px;
        letter-spacing: 0.3px;
    }
    
    .hamburger {
        width: 42px;
        height: 42px;
    }
    
    .hamburger-line {
        width: 20px;
    }
    
    .nav {
        width: 260px;
        max-width: 80vw;
        padding: 12px;
        padding-top: 80px;
        padding-bottom: 20px;
    }
    
    .nav-link {
        font-size: 0.95rem;
        padding: 12px 16px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .dropdown-menu.show {
        max-height: 300px;
        padding: 12px;
    }
}

/* ==========================================================================
   EXTRA SMALL DEVICES (360px and below)
   ========================================================================== */
@media (max-width: 360px) {
    .header-container {
        padding: 0 10px;
    }
    
    .logo-img {
        height: 32px;
    }
    
    .mobile-cta {
        padding: 7px 10px;
        font-size: 9px;
    }
    
    .hamburger {
        width: 40px;
        height: 40px;
    }
    
    .nav {
        width: 240px;
    }
}

/* ==========================================================================
   PREVENT HORIZONTAL SCROLL
   ========================================================================== */
html {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    /* Allow normal vertical scrolling */
    overflow-y: auto;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* Fix for iOS Safari scrolling */
@supports (-webkit-touch-callout: none) {
    .nav {
        /* Prevent rubber band effect on iOS */
        overscroll-behavior: contain;
    }
}