/**
 * Lawbox Custom Header Styles
 * Mobile-first responsive design
 */

/* CSS Variables - Defaults (can be overridden via inline styles) */
:root {
    --header-height: 80px;
    --header-bg-color: #ffffff;
    --header-menu-bg-color: #f5f0e8; /* Background for mobile menu dropdown */
    --header-text-color: #333333;
    --header-link-color: #333333;
    --primary-color: #ff6b6b; /* Brand primary (used for buttons) */
    --header-link-hover-color: var(--primary-color);
    --header-border-color: #e0e0e0;
    --mobile-breakpoint: 960px; /* Break to mobile layout at 960px */
    --cart-badge-color: #e74c3c;
    --button-text-color: #ffffff; /* Text color for login button and hamburger icon */
    --header-font-family: inherit;
    --header-font-weight-desktop: 500;
    --header-font-weight-mobile: 600;
    --header-font-weight-button: 500;
    --header-font-size-desktop: 1rem;
    --header-font-size-mobile: 1.3rem;
    --header-font-size-button: 0.95rem;
    --header-font-color-desktop: #333333;
    --header-font-color-mobile: #333333;
    --button-bg-color: #ff6b6b;
    --mobile-logo-max-width: 44px;
    --mobile-logo-breakpoint: 420px;
    --header-nav-margin-top: 0;
    --header-container-max-width: 1000px;
}

/* Base Header Styles */
#lawbox-custom-header {
    position: relative;
    width: 100%;
    background-color: var(--header-bg-color) !important;
    z-index: 9999;
    font-family: var(--header-font-family) !important;
    transition: all 0.3s ease;
}

/* Header shadow (default off, only when .lawbox-shadow class applied) */
#lawbox-custom-header.lawbox-shadow {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sticky header */
#lawbox-custom-header.lawbox-sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
}

/* Add padding to body when sticky header is active to prevent content jump */
body:has(#lawbox-custom-header.lawbox-sticky) {
    padding-top: var(--header-height);
}

.lawbox-header-container {
    max-width: var(--header-container-max-width) !important;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space items evenly - logo left, nav center, actions right */
    height: var(--header-height) !important;
}

/* Logo Styles */
.lawbox-header-logo {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.lawbox-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--header-text-color) !important;
    font-weight: bold;
    font-size: 1.5rem;
    transition: opacity 0.3s ease;
}

.lawbox-logo-link:hover {
    opacity: 0.8;
}

.lawbox-logo-img {
    max-height: 44px; /* Limit logo height on all viewports */
    width: auto;
    display: block;
}

.lawbox-logo-text {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Logo visibility - mobile logo hidden by default */
.lawbox-logo-mobile {
    display: none;
}

.lawbox-logo-desktop {
    display: block;
}

/* Navigation Styles */
.lawbox-header-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: var(--header-nav-margin-top, 0) !important; /* Configurable vertical alignment */
}

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

.lawbox-nav-item {
    margin: 0;
    padding: 0;
}

.lawbox-nav-link {
    display: block;
    padding: 10px 0;
    color: var(--header-font-color-desktop) !important;
    text-decoration: none;
    font-size: var(--header-font-size-desktop) !important;
    font-weight: var(--header-font-weight-desktop) !important;
    transition: color 0.3s ease;
    position: relative;
}

.lawbox-nav-link:hover,
.lawbox-nav-link:focus {
    color: var(--header-link-hover-color) !important;
    outline: none;
}

.lawbox-nav-link::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--header-link-hover-color) !important;
    transition: width 0.3s ease;
}

.lawbox-nav-link:hover::after,
.lawbox-nav-link:focus::after {
    width: 100%;
}

/* Header Actions (Cart & Login) */
.lawbox-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Cart Button */
.lawbox-cart-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--header-link-color) !important;
    text-decoration: none;
    border-radius: 50%;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 1px 3px 0 0;
    margin: 0 8px;
}

.lawbox-cart-button:hover,
.lawbox-cart-button:focus {
    color: var(--header-link-hover-color) !important;
    background-color: rgba(0, 0, 0, 0.05) !important;
    outline: none;
}

.lawbox-cart-button svg {
    width: 20px;
    height: 20px;
}

.lawbox-cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--cart-badge-color) !important;
    color: #ffffff !important;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Cart button with text */
.lawbox-cart-button.lawbox-cart-with-text {
    width: auto;
    padding: 0 12px;
    gap: 8px;
    border-radius: 8px;
}

.lawbox-cart-text {
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: inherit !important;
}

/* Login Button */
.lawbox-login-button {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--button-bg-color) !important;
    color: var(--button-text-color) !important;
    text-decoration: none;
    border-radius: 16px;
    font-size: var(--header-font-size-button) !important;
    font-weight: var(--header-font-weight-button) !important;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-height: 44px; /* Match touch target size */
}

.lawbox-login-button:hover,
.lawbox-login-button:focus {
    background-color: var(--button-hover-bg-color, var(--button-bg-color)) !important;
    color: var(--button-text-color) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    outline: none;
}

/* Mobile Menu Toggle Button */
.lawbox-mobile-menu-toggle {
    display: none;
    background: transparent !important;
    border: none !important;
    cursor: pointer;
    padding: 0 !important;
    margin-left: 8px;
    flex-shrink: 0;
    z-index: 10000;
    color: var(--header-text-color) !important;
}

.lawbox-hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
}

.lawbox-hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: var(--header-text-color) !important;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* Mobile Menu Toggle Active State */
.lawbox-mobile-menu-toggle[aria-expanded="true"] .lawbox-hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.lawbox-mobile-menu-toggle[aria-expanded="true"] .lawbox-hamburger span:nth-child(2) {
    opacity: 0;
}

.lawbox-mobile-menu-toggle[aria-expanded="true"] .lawbox-hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}


/* Mobile Layout Styles - Now dynamically generated via inline styles in header.php
 * This allows the mobile breakpoint (hamburger menu) to be controlled via settings
 * Default breakpoint: 960px (configurable in Lawbox Custom settings -> Mobile Settings)
 * See class-lawbox-header.php output_custom_header() for dynamic media query
 */

/* Extra Small Mobile Styles - Now dynamically generated via inline styles in header.php
 * This allows the breakpoint to be controlled via settings
 * Default breakpoint: 420px (configurable in Lawbox Custom settings)
 * See class-lawbox-header.php output_custom_header() for dynamic media query
 */

/* Additional mobile refinements that don't need dynamic breakpoints */
@media screen and (max-width: 460px) {
    .lawbox-header-actions {
        gap: 5px; /* Reduce gap between cart and login */
        margin-right: 5px; /* Reduce spacing before hamburger */
    }
}

/* Accessibility: Focus styles */
.lawbox-mobile-menu-toggle:focus {
    outline: 2px solid var(--header-link-hover-color) !important;
    outline-offset: 2px;
    background: transparent !important;
}

.lawbox-nav-link:focus {
    outline: 2px solid var(--header-link-hover-color);
    outline-offset: 2px;
}

/* Print styles - hide header when printing */
@media print {
    #lawbox-custom-header {
        display: none !important;
    }
}

