/**
 * Naturholz Header Styles
 * 
 * Complete header styling separated from main style.css
 * Includes: sticky header, navigation, mobile menu, admin bar fixes
 *
 * @package Naturholz
 * @version 2.0.0
 */

/* ==========================================================================
   CSS Variables for Header
   ========================================================================== */

:root {
    --header-height: 80px;
    --header-height-scrolled: 60px;
    --top-bar-height: 40px;
}

/* ==========================================================================
   Admin Bar Adjustments
   ========================================================================== */

body.admin-bar {
    margin-top: 0 !important;
}

body.admin-bar .site-header {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .site-header {
        top: 46px;
    }
}

/* ==========================================================================
   Top Bar
   ========================================================================== */

.top-bar {
    background: var(--color-primary-dark, #3E2723);
    color: #fff;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                max-height 0.3s ease;
    max-height: 50px;
    overflow: hidden;
}

.top-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.top-bar-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    text-decoration: none;
    font-size: 0.875rem;
    transition: opacity 0.2s ease;
}

.top-bar-link:hover {
    opacity: 0.8;
}

.top-bar-link svg {
    flex-shrink: 0;
}

.shipping-notice {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.shipping-notice svg {
    flex-shrink: 0;
}

/* Smooth hide top bar on scroll */
.site-header.scrolled .top-bar {
    max-height: 0;
    padding: 0;
    opacity: 0;
    transform: translateY(-100%);
}

@media (max-width: 768px) {
    .top-bar {
        font-size: 0.75rem;
        padding: 0.4rem 0;
        max-height: 40px;
    }
    
    .top-bar-inner {
        padding: 0 1rem;
        gap: 1rem;
    }
    
    .top-bar-left,
    .top-bar-right {
        gap: 0.75rem;
    }
    
    .top-bar-link span,
    .shipping-notice span {
        display: none;
    }
}

/* ==========================================================================
   Header Base
   ========================================================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--color-white, #fff);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 2rem; /* VERY SMALL - slim header */
    max-width: 1400px;
    margin: 0 auto;
    min-height: 50px; /* Minimum height */
    transition: padding 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                min-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--color-white, #fff);
}

/* Scrolled state - ULTRA COMPACT */
.site-header.scrolled {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.site-header.scrolled .header-inner {
    padding: 0.25rem 2rem; /* TINY padding when scrolled */
    min-height: 45px;
}

/* Content offset */
.site-content {
    margin-top: 90px; /* Reduced for slim header */
}

body.admin-bar .site-content {
    margin-top: 90px;
}

@media (max-width: 1024px) {
    .header-inner {
        padding: 0.5rem 1rem;
        min-height: 48px;
    }
    
    .site-header.scrolled .header-inner {
        padding: 0.25rem 1rem;
        min-height: 42px;
    }
    
    .site-content {
        margin-top: 80px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0.4rem 1rem;
        min-height: 44px;
    }
    
    .site-header.scrolled .header-inner {
        padding: 0.2rem 1rem;
        min-height: 40px;
    }
    
    .site-content {
        margin-top: 70px;
    }
}

/* ==========================================================================
   Logo / Branding
   ========================================================================== */

.site-branding {
    display: flex;
    align-items: center;
    z-index: 1;
}

.site-branding .custom-logo-link {
    display: block;
    line-height: 0;
}

.site-branding .custom-logo,
.site-branding .custom-logo-link img {
    display: block;
    height: auto;
    width: auto;
    max-height: 40px; /* Smaller logo for slim header */
    /* Logo stays same size - no shrinking on scroll */
}

@media (max-width: 768px) {
    .site-branding .custom-logo,
    .site-branding .custom-logo-link img {
        max-height: 32px; /* Very small on mobile */
    }
}

.site-logo-text {
    font-family: var(--font-heading, 'Playfair Display', serif);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--color-primary-dark, #3E2723);
    text-decoration: none;
}

.site-logo-text:hover {
    color: var(--color-primary, #5D4037);
}

/* ==========================================================================
   Main Navigation
   ========================================================================== */

.main-nav {
    display: flex;
    align-items: center;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    display: block;
    padding: 0.5rem 0;
    color: var(--color-text, #333);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: color 0.3s ease;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent, #8B5A2B);
    transition: width 0.3s ease;
}

.nav-menu a:hover,
.nav-menu .current-menu-item a {
    color: var(--color-primary, #5D4037);
}

.nav-menu a:hover::after,
.nav-menu .current-menu-item a::after {
    width: 100%;
}

/* Dropdown/Submenu */
.nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    padding: 0.5rem 0;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    list-style: none;
    margin: 0;
}

.nav-menu li:hover > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-menu .sub-menu a {
    padding: 0.75rem 1.5rem;
}

.nav-menu .sub-menu a::after {
    display: none;
}

/* ==========================================================================
   Header Actions
   ========================================================================== */

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-text, #333);
    transition: all 0.3s ease;
    position: relative;
    text-decoration: none;
}

.header-icon:hover {
    color: var(--color-primary, #5D4037);
    transform: scale(1.1);
}

.header-icon svg {
    flex-shrink: 0;
}

/* Cart Badge */
.cart-icon {
    position: relative;
}

.cart-count {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-primary, #5D4037);
    color: #fff;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
}

.cart-count.hidden {
    display: none;
}

/* ==========================================================================
   Mobile Navigation Toggle
   ========================================================================== */

.mobile-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.mobile-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--color-text, #333);
    transition: all 0.3s ease;
}

.mobile-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.mobile-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

@media (max-width: 1024px) {
    .mobile-toggle {
        display: flex;
    }
    
    .main-nav {
        display: none;
    }
    
    .header-inner {
        padding: 0 1rem;
    }
}

/* ==========================================================================
   Mobile Navigation Overlay
   ========================================================================== */

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

body.admin-bar .mobile-nav-overlay {
    top: 46px;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-nav-inner {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #fff;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.2);
}

.mobile-nav-overlay.active .mobile-nav-inner {
    transform: translateX(0);
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.mobile-nav-title {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--color-text, #333);
}

.mobile-nav-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--color-text, #333);
    transition: all 0.2s ease;
}

.mobile-nav-close:hover {
    color: var(--color-primary, #5D4037);
}

.mobile-menu {
    list-style: none;
    margin: 0;
    padding: 1rem 0;
}

.mobile-menu li {
    border-bottom: 1px solid #f5f5f5;
}

.mobile-menu a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--color-text, #333);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.mobile-menu a:hover,
.mobile-menu .current-menu-item a {
    background: var(--color-beige, #F5F0E8);
    color: var(--color-primary, #5D4037);
}

.mobile-nav-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
}

.mobile-contact-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: var(--color-text, #333);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.mobile-contact-link:hover {
    background: var(--color-beige, #F5F0E8);
}

/* Prevent body scroll when mobile nav is open */
body.mobile-nav-open {
    overflow: hidden;
}

/* ==========================================================================
   Search Overlay
   ========================================================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.98);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
}

body.admin-bar .search-overlay {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .search-overlay {
        top: 46px;
    }
}

.search-overlay.active {
    display: flex;
}

.search-overlay-inner {
    width: 90%;
    max-width: 600px;
}

.search-overlay .search-form {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.search-overlay .search-field {
    flex: 1;
    padding: 1.25rem 4rem 1.25rem 1.5rem;
    font-size: 1.25rem;
    border: 2px solid var(--color-gray, #E0DCD5);
    border-radius: 12px;
    font-family: var(--font-body, 'Open Sans', sans-serif);
    transition: all 0.3s ease;
}

.search-overlay .search-field:focus {
    outline: none;
    border-color: var(--color-primary, #5D4037);
}

.search-overlay .search-submit {
    position: absolute;
    right: 60px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    color: var(--color-text, #333);
    transition: color 0.2s ease;
}

.search-overlay .search-submit:hover {
    color: var(--color-primary, #5D4037);
}

.search-overlay .search-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    color: var(--color-text, #333);
    transition: color 0.2s ease;
}

.search-overlay .search-close:hover {
    color: var(--color-primary, #5D4037);
}

body.search-open {
    overflow: hidden;
}

/* ==========================================================================
   Smooth Scrolling Fix
   ========================================================================== */

html {
    scroll-padding-top: calc(var(--header-height) + var(--top-bar-height));
}

body.admin-bar html {
    scroll-padding-top: calc(var(--header-height) + var(--top-bar-height) + 32px);
}

@media screen and (max-width: 782px) {
    body.admin-bar html {
        scroll-padding-top: calc(var(--header-height) + var(--top-bar-height) + 46px);
    }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 1024px) {
    :root {
        --header-height: 70px;
        --header-height-scrolled: 60px;
    }
    
    .header-inner {
        padding: 0 1rem;
    }
}

@media (max-width: 768px) {
    :root {
        --header-height: 60px;
        --header-height-scrolled: 60px;
        --top-bar-height: 36px;
    }
    
    .site-branding .custom-logo {
        max-height: 45px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .site-header,
    .top-bar,
    #wpadminbar {
        display: none !important;
    }
    
    .site-content {
        padding-top: 0 !important;
    }
}