/* header-style.css - Samra Theme Header Styles */
/* This file contains header-specific styles that integrate with theme settings */

/* Header Base Styles */
.site-header {
    background: #fff;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-header.scrolled {
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.12);
}

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

/* Site Branding */
.site-branding {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.site-logo img {
    max-height: 50px;
    width: auto;
    transition: transform 0.3s ease;
}

.site-identity {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.site-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--samra-secondary-color, #333333);
}

.site-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.site-title a:hover {
    color: var(--samra-primary-color, #007cba);
}

.site-description {
    margin: 0;
    font-size: 0.9rem;
    color: var(--samra-text-color, #333333);
    opacity: 0.7;
    line-height: 1.4;
}

/* Main Navigation */
.main-navigation {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
}

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

.nav-menu > li {
    position: relative;
}

.nav-menu > li > a {
    text-decoration: none;
    color: var(--samra-text-color, #333333);
    font-weight: 600;
    font-size: 1rem;
    padding: 1rem 0;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-menu > li > a:hover {
    color: var(--samra-primary-color, #007cba);
}

.nav-menu > li > a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--samra-primary-color, #007cba);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav-menu > li > a:hover::after {
    width: 100%;
}

/* Current Menu Item */
.nav-menu .current-menu-item > a,
.nav-menu .current-page-ancestor > a {
    color: var(--samra-primary-color, #007cba);
}

.nav-menu .current-menu-item > a::after,
.nav-menu .current-page-ancestor > a::after {
    width: 100%;
}

/* Sub-menu Styles (Level 1) */
.nav-menu .sub-menu,
.nav-menu .children {
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 240px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    list-style: none;
    margin: 0;
    padding: 0.75rem 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.nav-menu li:hover > .sub-menu,
.nav-menu li:hover > .children {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.nav-menu .sub-menu li,
.nav-menu .children li {
    margin: 0;
    position: relative;
}

.nav-menu .sub-menu a,
.nav-menu .children a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    color: var(--samra-text-color, #333333);
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-menu .sub-menu a:hover,
.nav-menu .children a:hover {
    background: linear-gradient(135deg, var(--samra-primary-color, #007cba)08, var(--samra-primary-color, #007cba)02);
    color: var(--samra-primary-color, #007cba);
    border-left-color: var(--samra-primary-color, #007cba);
    padding-left: 2rem;
}

/* Sub-sub-menu Styles (Level 2) */
.nav-menu .sub-menu .sub-menu,
.nav-menu .children .children {
    top: -0.75rem;
    left: 100%;
    transform: translateX(-10px) scale(0.95);
    margin-left: 0;
}

.nav-menu .sub-menu li:hover > .sub-menu,
.nav-menu .children li:hover > .children {
    transform: translateX(0) scale(1);
}

/* Sub-menu indicators */
.nav-menu .menu-item-has-children > a::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    transition: transform 0.3s ease;
    opacity: 0.7;
}

.nav-menu .sub-menu .menu-item-has-children > a::after {
    transform: rotate(-90deg);
}

.nav-menu li:hover > a::after {
    transform: rotate(180deg);
}

.nav-menu .sub-menu li:hover > a::after {
    transform: rotate(0deg);
}

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

.header-cart .cart-contents {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--samra-text-color, #333333);
    font-weight: 600;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
}

.header-cart .cart-contents:hover {
    background: var(--samra-primary-color, #007cba);
    color: #fff;
    transform: translateY(-2px);
}

.cart-count {
    background: var(--samra-primary-color, #007cba);
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.75rem;
    flex-direction: column;
    gap: 4px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    background: var(--samra-primary-color, #007cba)10;
}

.toggle-bar {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--samra-text-color, #333333);
    transition: all 0.3s ease;
    border-radius: 2px;
}

.menu-toggle.active .toggle-bar:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.menu-toggle.active .toggle-bar:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active .toggle-bar:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -60px;
    left: 1rem;
    background: var(--samra-primary-color, #007cba);
    color: white;
    padding: 1rem 1.5rem;
    text-decoration: none;
    border-radius: 8px;
    z-index: 1001;
    transition: top 0.3s ease;
    font-weight: 600;
}

.skip-link:focus {
    top: 1rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 1.5rem;
        gap: 1rem;
    }

    .nav-menu {
        gap: 2rem;
    }
    
    /* Fix sub-submenu positioning for last items on tablet */
    .nav-menu > li:nth-last-child(1) .sub-menu .sub-menu,
    .nav-menu > li:nth-last-child(2) .sub-menu .sub-menu,
    .nav-menu > li:nth-last-child(3) .sub-menu .sub-menu,
    .nav-menu > li:nth-last-child(1) .children .children,
    .nav-menu > li:nth-last-child(2) .children .children,
    .nav-menu > li:nth-last-child(3) .children .children {
        left: auto;
        right: 100%;
        transform: translateX(10px) scale(0.95);
    }
    
    .nav-menu > li:nth-last-child(1) .sub-menu li:hover > .sub-menu,
    .nav-menu > li:nth-last-child(2) .sub-menu li:hover > .sub-menu,
    .nav-menu > li:nth-last-child(3) .sub-menu li:hover > .sub-menu,
    .nav-menu > li:nth-last-child(1) .children li:hover > .children,
    .nav-menu > li:nth-last-child(2) .children li:hover > .children,
    .nav-menu > li:nth-last-child(3) .children li:hover > .children {
        transform: translateX(0) scale(1);
    }
}

@media (max-width: 768px) {
    .header-container {
        padding: 0 1rem;
        min-height: 70px;
    }

    .menu-toggle {
        display: flex;
    }

    .main-navigation {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        height: calc(100vh - 70px);
        background: #fff;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-20px);
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }

    .main-navigation.active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-menu {
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
        width: 100%;
    }

    .nav-menu li {
        width: 100%;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }

    .nav-menu a {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 1.25rem 1.5rem;
        width: 100%;
        border-left: 4px solid transparent;
    }

    .nav-menu a::after {
        display: none !important;
    }

    .nav-menu .sub-menu,
    .nav-menu .children {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: #f8f9fa;
        display: none;
        padding: 0;
        border-radius: 0;
        border: none;
        border-left: 4px solid var(--samra-primary-color, #007cba)20;
    }

    .nav-menu .sub-menu.active,
    .nav-menu .children.active {
        display: block;
    }

    .nav-menu .sub-menu a,
    .nav-menu .children a {
        padding-left: 3rem;
        font-size: 0.9rem;
    }

    .nav-menu .sub-menu .sub-menu a,
    .nav-menu .children .children a {
        padding-left: 4.5rem;
    }

    /* Mobile submenu toggle styles */
    .nav-menu .menu-item-has-children > a {
        pointer-events: auto;
        padding-right: 3.5rem;
    }
    
    .mobile-submenu-toggle {
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
        width: 28px;
        height: 28px;
        border: none;
        background: rgba(0, 0, 0, 0.08);
        border-radius: 4px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
        transition: all 0.3s ease;
        z-index: 2;
    }
    
    .mobile-submenu-toggle::before {
        content: '▸';
        transition: transform 0.3s ease;
    }
    
    .mobile-submenu-toggle.active::before {
        transform: rotate(90deg);
    }

    .site-branding {
        flex: 1;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .site-description {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 1rem;
        min-height: 60px;
    }

    .site-title {
        font-size: 1.375rem;
    }

    .site-description {
        display: none;
    }

    .main-navigation {
        top: 60px;
        height: calc(100vh - 60px);
    }

    .header-actions {
        gap: 1rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .site-header {
        border-bottom: 3px solid #000;
    }

    .nav-menu a {
        font-weight: 700;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .site-header,
    .nav-menu a,
    .menu-toggle,
    .main-navigation,
    .skip-link,
    .toggle-bar {
        transition: none;
    }

    .nav-menu .sub-menu,
    .nav-menu .children {
        transition: opacity 0.3s ease;
    }
    
    .mobile-submenu-toggle::before {
        transition: none;
    }
}