/**
 * Professional Header Styles
 * 
 * Top bar, account dropdown, search, social icons
 * Premium e-commerce header design
 * 
 * @package Commerce_Elite
 */

/* ============================================
   HEADER TOP BAR
   ============================================ */

.header-top {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-xs);
}

.header-top-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    padding: 0.5rem 0;
}

.header-top-left,
.header-top-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Announcement */
.header-announcement {
    color: var(--color-text-light);
    font-weight: var(--font-weight-medium);
}

/* Phone */
.header-phone {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--color-text);
    transition: color var(--transition-fast);
}

.header-phone:hover {
    color: var(--color-primary);
}

.header-phone svg {
    flex-shrink: 0;
}

/* Top Bar Menu */
.top-bar-navigation {
    margin: 0;
}

.top-bar-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
}

.top-bar-menu li {
    margin: 0;
}

.top-bar-menu a {
    color: var(--color-text);
    font-size: var(--font-size-xs);
    transition: color var(--transition-fast);
}

.top-bar-menu a:hover {
    color: var(--color-primary);
}

/* Social Icons */
.header-social {
    display: flex;
    gap: 0.75rem;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--color-text-muted);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.social-link:hover {
    color: var(--color-primary);
    background: rgba(34, 113, 177, 0.1);
}

.social-link svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   MAIN HEADER
   ============================================ */

.header-main {
    background: #f6e4e4;
    border-bottom: 1px solid var(--color-border);
    position: relative;
    z-index: var(--z-header);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 3rem;
    min-height: 70px;
    padding: 0.75rem 0;
}

/* Logo */
.site-branding {
    flex-shrink: 0;
}

.custom-logo {
    max-height: 50px;
    width: auto;
    display: block;
}

.site-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0;
}

.site-description {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    margin: 0.25rem 0 0;
}

/* Main Navigation */
.main-navigation {
    flex-grow: 1;
    display: flex;
    justify-content: center;
}

/* ============================================
   MENU BAR (Separate section below header)
   ============================================ */

.menu-bar {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: var(--z-header);
    overflow: visible; /* Allow mega menu to extend */
}

.menu-bar .container {
    display: block; /* Changed from flex - allows vertical expansion */
    overflow: visible; /* Critical for hover geometry */
    text-align: center; /* Center the menu */
}

.menu-bar .main-navigation {
    width: 100%;
    overflow: visible; /* Critical for hover geometry */
}

/* Header Actions (Right Side) */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

/* ============================================
   SEARCH DROPDOWN - DESKTOP (FIXED)
   ============================================ */

.header-search {
    position: relative;
}

.search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.search-toggle:hover {
    color: var(--color-primary);
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 600px; /* Increased from 500px */
    max-width: 90vw;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 1.25rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
}

.header-search.active .search-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.search-dropdown .search-form {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-form-inner {
    display: flex;
    align-items: stretch;
    width: 100%;
    gap: 0.75rem;
}

/* FIXED: Make search input MUCH bigger */
.search-form .search-field {
    flex: 1 1 auto; /* Takes all available space */
    min-width: 250px; /* Minimum width */
    padding: 0.875rem 1.25rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: border-color var(--transition-fast);
}

.search-form .search-field:focus {
    outline: none;
    border-color: #4a0e0e; /* LaNoira brand color */
}

.search-form .search-field::placeholder {
    color: #999;
    font-size: var(--font-size-sm);
}

.search-form .search-category {
    flex: 0 0 180px; /* Fixed width for dropdown */
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-background);
    font-size: var(--font-size-sm);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

.search-dropdown .search-submit {
    flex: 0 0 auto;
    padding: 0.875rem 1.75rem;
    background: #4a0e0e; /* LaNoira brand color */
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: background var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.search-dropdown .search-submit:hover {
    background: #2c2222; /* LaNoira darker shade */
}

.search-dropdown .search-submit svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

/* ============================================
   MOBILE SEARCH MODAL - NEW
   ============================================ */

/* Mobile Search Trigger */
.mobile-search-trigger {
    display: none; /* Hidden by default, shown on mobile */
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    transition: color var(--transition-fast);
    padding: 0;
}

.mobile-search-trigger:hover {
    color: var(--color-primary);
}

/* Mobile Search Modal */
.mobile-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-search-modal.active {
    display: block;
    opacity: 1;
}

/* Dark Overlay */
.mobile-search-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
}

/* Search Content Container */
.mobile-search-content {
    position: relative;
    background: #fff;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Header with Close Button */
.mobile-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f0f0f0;
}

.mobile-search-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c2222;
    margin: 0;
}

.mobile-search-close {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-search-close:hover {
    color: #4a0e0e;
}

/* Search Form */
.mobile-search-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Category Dropdown */
.mobile-search-category {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #333;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.25rem center;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.mobile-search-category:focus {
    outline: none;
    border-color: #4a0e0e;
}

/* Search Input */
.mobile-search-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: border-color 0.3s ease;
}

.mobile-search-input:focus {
    outline: none;
    border-color: #4a0e0e;
}

.mobile-search-input::placeholder {
    color: #999;
}

/* Search Submit Button */
.mobile-search-submit {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: #4a0e0e;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: background 0.3s ease;
}

.mobile-search-submit:hover {
    background: #2c2222;
}

.mobile-search-submit svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   ACCOUNT DROPDOWN
   ============================================ */

.header-account {
    position: relative;
}

.account-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: color var(--transition-fast);
    white-space: nowrap;
}

.account-toggle:hover {
    color: var(--color-primary);
}

.account-toggle svg {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.account-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 280px;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-base);
    z-index: var(--z-dropdown);
}

.header-account.active .account-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Account dropdown header (logged in) */
.account-dropdown-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.account-dropdown-header strong {
    color: var(--color-text);
    font-size: var(--font-size-base);
}

.account-email {
    color: var(--color-text-muted);
    font-size: var(--font-size-xs);
}

/* Account dropdown menu */
.account-dropdown-menu {
    list-style: none;
    padding: 0.5rem;
    margin: 0;
}

.account-dropdown-menu li {
    margin: 0;
}

.account-dropdown-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--color-text);
    font-size: var(--font-size-sm);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.account-dropdown-menu a:hover {
    background: var(--color-surface);
    color: var(--color-primary);
}

.account-dropdown-menu .account-logout a {
    color: var(--color-error);
}

.account-dropdown-menu .account-logout a:hover {
    background: rgba(214, 54, 56, 0.1);
}

/* Account dropdown signin (logged out) */
.account-dropdown-signin {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.account-dropdown-signin p {
    margin: 0;
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
    text-align: center;
}

.account-dropdown-signin .button {
    width: 100%;
    text-align: center;
    padding: 0.75rem;
}

/* ============================================
   WISHLIST & CART
   ============================================ */

.header-wishlist,
.header-cart {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--color-text);
    transition: color var(--transition-fast);
}

.header-wishlist:hover,
.header-cart:hover {
    color: var(--color-primary);
}

.wishlist-count,
.cart-count {
    position: absolute;
    top: -0.375rem;
    right: -0.375rem;
    min-width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #ffffff;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    border-radius: var(--radius-full);
    padding: 0 0.375rem;
    box-shadow: var(--shadow-sm);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    /* Hide desktop menu */
    .main-navigation {
        display: none;
    }
    
    /* Show mobile toggle */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    /* Adjust header actions */
    .account-text {
        display: none;
    }
    
    .header-actions {
        gap: 0.5rem;
    }
}

@media (max-width: 991px) {
    /* Hide desktop search, show mobile search trigger */
    .header-search {
        display: none;
    }
    
    .mobile-search-trigger {
        display: flex;
    }
}

@media (max-width: 768px) {
    /* Top bar */
    .header-top-inner {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .header-top-left,
    .header-top-right {
        justify-content: center;
    }
    
    /* Main header */
    .header-inner {
        min-height: 60px;
        padding: 0.75rem 0;
    }
    
    .custom-logo {
        max-height: 40px;
    }
}

@media (max-width: 480px) {
    /* Mobile search modal full screen */
    .mobile-search-content {
        border-radius: 0;
        height: 100vh;
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
    }
    
    .mobile-search-form {
        flex: 1;
    }
}

/* ============================================
   DARK MODE
   ============================================ */

body.dark-mode .header-top {
    background: var(--color-background-dark);
    border-bottom-color: var(--color-border-dark);
}

body.dark-mode .header-main {
    background: var(--color-background);
    border-bottom-color: var(--color-border);
}

body.dark-mode .search-dropdown,
body.dark-mode .account-dropdown {
    backdrop-filter: blur(10px);
    background: rgba(26, 26, 26, 0.95);
}

body.dark-mode .mobile-search-content {
    background: #1a1a1a;
    color: #fff;
}

body.dark-mode .mobile-search-header h3 {
    color: #fff;
}

body.dark-mode .mobile-search-input,
body.dark-mode .mobile-search-category {
    background: #2a2a2a;
    border-color: #444;
    color: #fff;
}