/**
 * Header Styles
 */

.site-header {
    background: var(--esimfly-white);
    box-shadow: var(--esimfly-shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0;
    margin: 0;
    transition: all 0.3s ease;
}

/* Transparent header on homepage */
body.home .site-header {
    background: transparent;
    box-shadow: none;
    position: absolute;
    width: 100%;
}

/* White background on scroll (homepage) */
body.home .site-header.scrolled {
    background: var(--esimfly-white);
    box-shadow: var(--esimfly-shadow);
    position: fixed;
}

/* Fix header position when admin bar is visible */
body.admin-bar .site-header {
    top: 32px;
}

body.home.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }

    body.home.admin-bar .site-header {
        top: 46px;
    }
}

/* White text on transparent header (homepage) */
body.home .site-header .primary-menu a,
body.home .site-header .site-title a,
body.home .site-header .cart-link,
body.home .site-header .account-link {
    color: var(--esimfly-white);
}

body.home .site-header .primary-menu a:hover {
    color: var(--esimfly-white);
    opacity: 0.8;
}

body.home .site-header.scrolled .primary-menu a,
body.home .site-header.scrolled .site-title a,
body.home .site-header.scrolled .cart-link,
body.home .site-header.scrolled .account-link {
    color: var(--esimfly-text);
}

body.home .site-header .menu-toggle span {
    background: var(--esimfly-white);
}

body.home .site-header.scrolled .menu-toggle span {
    background: var(--esimfly-text);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

/* Logo */
.site-branding {
    flex-shrink: 0;
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.site-title a {
    color: var(--esimfly-primary);
    text-decoration: none;
}

.custom-logo {
    max-height: 30px;
    width: auto;
    transition: opacity 0.3s ease;
}

/* Default logo visible, sticky logo hidden */
.logo-default {
    display: block;
}

.logo-sticky {
    display: none;
}

/* On scroll - switch logos */
.site-header.scrolled .logo-default {
    display: none;
}

.site-header.scrolled .logo-sticky {
    display: block;
}

/* If no sticky logo, keep showing default */
.site-header.scrolled .custom-logo-link:not(:has(.logo-sticky)) .logo-default {
    display: block;
}

/* Navigation */
.main-navigation {
    flex: 1;
}

.primary-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 2rem;
    align-items: center;
}

.primary-menu li {
    position: relative;
}

.primary-menu a {
    color: var(--esimfly-text);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0;
    display: block;
    transition: var(--esimfly-transition);
}

.primary-menu a:hover,
.primary-menu .current-menu-item a {
    color: var(--esimfly-primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--esimfly-text);
    transition: var(--esimfly-transition);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cart-link,
.account-link {
    position: relative;
    color: var(--esimfly-text);
    padding: 0.5rem;
    display: flex;
    align-items: center;
    transition: var(--esimfly-transition);
}

.cart-link:hover,
.account-link:hover {
    color: var(--esimfly-primary);
    text-decoration: none;
}

.cart-count {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--esimfly-error);
    color: var(--esimfly-white);
    border-radius: var(--esimfly-radius-full);
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.login-link {
    padding: 0.5rem 1rem;
    background: var(--esimfly-primary);
    color: var(--esimfly-white);
    border-radius: var(--esimfly-radius);
    font-weight: 600;
    transition: var(--esimfly-transition);
}

.login-link:hover {
    background: var(--esimfly-primary-dark);
    text-decoration: none;
}

/* Mobile Navigation */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }

    .main-navigation {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--esimfly-white);
        box-shadow: var(--esimfly-shadow-lg);
        display: none;
    }

    .main-navigation.active {
        display: block;
    }

    .primary-menu {
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
    }

    .primary-menu a {
        padding: 1rem 1.5rem;
    }

    .header-container {
        padding: 1rem;
    }
}
