/* ============================================
   HEADER COMPONENT CSS
   Consolidated header styles for all pages
   ============================================ */

/* ============================================
   DESKTOP HEADER STYLES
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    z-index: 1000;
    border-bottom: 1px solid var(--color-border, #E5E5E5);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
    will-change: transform;
    transform: translateY(0);
}

/* At top of page - header visible and fixed at top */
.header.at-top {
    transform: translateY(0);
    box-shadow: none;
}

/* Scrolling down - hide header by sliding up */
.header.scroll-down {
    transform: translateY(-100%);
}

/* Scrolling up - show header (becomes sticky) */
.header.scroll-up {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Scrolled State - maintains white background and black text */
.header.scrolled {
    background: #ffffff;
    border-bottom: 1px solid var(--color-border, #E5E5E5);
}

.header.scrolled .logo,
.header.scrolled .nav a {
    color: var(--color-text, #000000);
}

.header.scrolled .contact-sales-btn {
    background: var(--color-text, #000000);
    color: var(--color-background, #FFFFFF);
}

.header.scrolled .contact-sales-btn:hover {
    background: var(--color-primary, #7963f6);
    color: var(--color-background, #FFFFFF);
}

/* Legacy hidden class for compatibility */
.header.hidden {
    transform: translateY(-100%);
}

/* Header Container */
.header-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 6px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================
   LOGO STYLES
   ============================================ */

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: var(--font-heading, 'Gellix', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text, #000000);
    transition: color 0.3s ease;
}

.logo-icon {
    width: 250px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
}

/* Logo uses black SVG by default and maintains black on scroll */

/* ============================================
   NAVIGATION STYLES
   ============================================ */

.nav {
    display: flex;
    gap: var(--spacing-lg, 24px);
    align-items: center;
}

.nav a {
    text-decoration: none;
    color: var(--color-text, #000000);
    font-size: 18px;
    font-weight: 700;
    transition: color 0.3s ease;
}

.nav a:hover {
    color: var(--color-primary, #7963f6);
}

/* Hide mobile expertise link on desktop */
.mobile-expertise-link {
    display: none;
}

/* ============================================
   DROPDOWN MENU STYLES
   ============================================ */

.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--color-text, #000000);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.3s ease;
    background: transparent;
    border: none;
    padding: 0;
    font-family: inherit;
}

.header.scrolled .nav-dropdown-toggle {
    color: var(--color-text, #000000);
}

.nav-dropdown-toggle:hover {
    color: var(--color-primary, #7963f6);
}

.nav-dropdown-chevron {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.nav-dropdown.active .nav-dropdown-chevron {
    transform: rotate(180deg);
}

/* Desktop Dropdown Menu */
@media (min-width: 1025px) {
    .nav-dropdown-menu {
        position: absolute;
        top: calc(100% + 20px);
        left: 50%;
        transform: translateX(-50%);
        background: #FFFFFF;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        padding: 16px;
        min-width: 240px;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
        transform: translateX(-50%) translateY(-10px);
        z-index: 1001;
        align-items: center;
    }

    .nav-dropdown.active .nav-dropdown-menu,
    .nav-dropdown:hover .nav-dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateX(-50%) translateY(0);
    }

    .nav-dropdown.active .nav-dropdown-chevron,
    .nav-dropdown:hover .nav-dropdown-chevron {
        transform: rotate(180deg);
    }

    .nav-dropdown-menu::before {
        content: '';
        position: absolute;
        top: -8px;
        left: 50%;
        transform: translateX(-50%);
        width: 16px;
        height: 16px;
        background: #FFFFFF;
        transform: translateX(-50%) rotate(45deg);
        border-radius: 2px;
    }

    .nav-dropdown-menu-items {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .nav-dropdown-item {
        display: block;
        padding: 12px 16px;
        color: var(--color-text, #000000) !important;
        text-decoration: none;
        font-size: 15px;
        font-weight: 600;
        border-radius: 8px;
        transition: background-color 0.2s ease, color 0.2s ease;
    }

    .nav-dropdown-item:hover {
        background-color: #F8F8F8;
        color: var(--color-primary, #7963f6) !important;
    }
}

/* ============================================
   CTA BUTTON STYLES
   ============================================ */

.contact-sales-btn {
    background: var(--color-text, #000000);
    color: var(--color-background, #FFFFFF);
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.contact-sales-btn:hover {
    background: var(--color-primary, #7963f6);
    color: var(--color-background, #FFFFFF);
}

.mobile-cta-btn {
    display: none;
}

/* ============================================
   MOBILE MENU BUTTON (HAMBURGER)
   ============================================ */

.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.mobile-menu-btn span {
    width: 25px;
    height: 3px;
    background: var(--color-text, #000000);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.header.scrolled .mobile-menu-btn span {
    background: var(--color-text, #000000);
}

/* Hamburger Animation */
.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================
   TABLET & MOBILE RESPONSIVE STYLES
   ============================================ */

@media (max-width: 1024px) {
    /* Show mobile menu button */
    .mobile-menu-btn {
        display: flex;
        order: 3;
    }

    /* Mobile Navigation Sidebar */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--color-background, #FFFFFF);
        flex-direction: column;
        padding: 80px 30px 30px;
        gap: var(--spacing-md);
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 1000;
        align-items: normal;
    }

    .nav.active {
        right: 0;
    }

    /* Mobile Navigation Overlay */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .nav-overlay.active {
        display: block;
        opacity: 1;
    }

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

    /* Mobile Navigation Links */
    .nav a {
        color: var(--color-text, #000000);
        padding: 15px 0;
        border-bottom: 1px solid var(--color-border, #E5E5E5);
    }

    .header.scrolled .nav a {
        color: var(--color-text, #000000);
    }

    /* Hide desktop CTA, show mobile CTA */
    .desktop-cta-btn {
        display: none;
    }

    .mobile-cta-btn {
        display: block !important;
        margin-top: var(--spacing-md);
        padding: 15px 24px;
        text-align: center;
        background: var(--color-text, #000000);
        color: #FFFFFF !important;
        border-radius: 8px;
        border: none;
        width: 100%;
    }

    .mobile-cta-btn:hover {
        background: var(--color-primary, #7963f6);
        color: #FFFFFF !important;
    }

    /* Hide mobile expertise link */
    .mobile-expertise-link {
        display: none !important;
    }

    /* Mobile Dropdown Styles */
    .nav-dropdown {
        display: block;
        border-bottom: 1px solid var(--color-border, #E5E5E5);
    }

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

    .nav-dropdown .nav-dropdown-toggle {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 15px 0;
        background: none;
        border: none;
        color: var(--color-text, #000000);
        font-size: 18px;
        font-weight: 700;
        cursor: pointer;
        text-align: left;
    }

    .nav-dropdown .nav-dropdown-chevron {
        width: 16px;
        height: 16px;
        transition: transform 0.3s ease;
    }

    .nav-dropdown.active .nav-dropdown-chevron {
        transform: rotate(180deg);
    }

    .nav-dropdown .nav-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        background: #ffffff;
        box-shadow: none;
        border-radius: 0;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        padding: 0;
    }

    .nav-dropdown.active .nav-dropdown-menu {
        max-height: 500px;
    }

    .nav-dropdown .nav-dropdown-menu-items {
        display: flex;
        flex-direction: column;
        padding: 8px 0;
    }

    .nav-dropdown .nav-dropdown-menu-items .nav-dropdown-item {
        padding: 12px 0 12px 20px !important;
        color: #1a1a1a !important;
        font-size: 16px !important;
        font-weight: 500 !important;
        border-bottom: none !important;
        transition: color 0.2s ease;
    }

    .nav-dropdown .nav-dropdown-menu-items .nav-dropdown-item:hover {
        color: var(--color-primary, #7963f6) !important;
    }

    /* Header Container Mobile */
    .header-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .logo {
        order: 1;
    }
}

/* ============================================
   MOBILE SPECIFIC (768px and below)
   ============================================ */

@media (max-width: 768px) {
    /* Adjust logo size if needed for smaller screens */
    .logo-icon {
        width: 250px;
        padding: 5px;
    }

    .header.scrolled .logo-icon {
        width: 250px;
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-text);
    color: var(--color-background);
    padding: var(--spacing-xs) var(--spacing-sm);
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Focus styles for navigation */
.nav a:focus-visible,
.nav-dropdown-toggle:focus-visible,
.nav-dropdown-item:focus-visible,
.contact-sales-btn:focus-visible,
.mobile-menu-btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .header,
    .nav,
    .nav-overlay,
    .nav-dropdown-menu,
    .mobile-menu-btn span,
    .nav-dropdown-chevron {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   SPACING FOR FIXED HEADER
   ============================================ */

/* Add top spacing to first content section to account for fixed header */
body > .ic-section:first-of-type,
#header-placeholder + .ic-section {
    padding-top: 100px;
}

/* Adjust for mobile devices */
@media (max-width: 768px) {
    body > .ic-section:first-of-type,
    #header-placeholder + .ic-section {
        padding-top: 80px;
    }
}
