/**
 * Navigation & Header Styles - Phase 3.3
 * Modern mega-menu, mobile-first responsive design
 */

/* ========================================
   HEADER CONTAINER
   ======================================== */

.ha-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #1A202C 0%, #2D3748 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.ha-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    gap: 20px;
}

/* ========================================
   LOGO & BRANDING
   ======================================== */

.ha-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.3rem;
    color: white;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
    min-width: 150px;
}

.ha-logo:hover {
    opacity: 0.8;
}

.ha-logo img {
    height: 40px;
    width: auto;
    display: block;
}

.ha-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.ha-logo-text span {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* ========================================
   PRIMARY NAVIGATION
   ======================================== */

.ha-nav-primary {
    display: flex;
    align-items: center;
    gap: 0;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.ha-nav-item {
    position: relative;
    height: 70px;
    display: flex;
    align-items: center;
}

.ha-nav-link {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    position: relative;
    white-space: nowrap;
}

.ha-nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--color-primary);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

.ha-nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.ha-nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ========================================
   DROPDOWN MENU (MEGA-MENU for Categories)
   ======================================== */

.ha-nav-item.has-children > .ha-nav-link::before {
    content: '▼';
    display: inline-block;
    margin-left: 6px;
    font-size: 0.7rem;
    transition: transform 0.3s ease;
}

.ha-nav-item.has-children > .ha-nav-link:hover::before,
.ha-nav-item.has-children.active > .ha-nav-link::before {
    transform: rotate(180deg);
}

/* Dropdown/Mega Menu */
.ha-dropdown-menu {
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    min-width: 250px;
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-top: 3px solid var(--color-primary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    z-index: 200;
}

.ha-nav-item:hover > .ha-dropdown-menu,
.ha-nav-item.active > .ha-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.ha-dropdown-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ha-dropdown-item {
    border-bottom: 1px solid var(--color-border);
}

.ha-dropdown-item:last-child {
    border-bottom: none;
}

.ha-dropdown-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    white-space: normal;
}

.ha-dropdown-item a:hover {
    background: var(--color-bg-secondary);
    color: var(--color-primary);
    padding-left: 24px;
}

.ha-dropdown-item a::before {
    content: '→';
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.ha-dropdown-item a:hover::before {
    opacity: 1;
    color: var(--color-primary);
}

.ha-dropdown-count {
    margin-left: auto;
    background: var(--color-primary-light);
    color: var(--color-primary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
}

/* ========================================
   SEARCH BAR
   ======================================== */

.ha-search-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    gap: 8px;
    transition: all 0.3s ease;
    flex: 0 1 250px;
}

.ha-search-container:focus-within {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--color-primary);
}

.ha-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 0.95rem;
    outline: none;
    min-width: 100px;
}

.ha-search-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.ha-search-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.ha-search-button:hover {
    color: var(--color-primary);
}

/* Search Autocomplete Dropdown */
.ha-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
    z-index: 201;
}

.ha-search-suggestions.active {
    display: block;
}

.ha-search-suggestion {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--color-text);
    text-decoration: none;
}

.ha-search-suggestion:hover {
    background: var(--color-bg-secondary);
    color: var(--color-primary);
}

.ha-search-suggestion .icon {
    font-size: 0.9rem;
    opacity: 0.6;
}

/* ========================================
   MOBILE MENU TOGGLE
   ======================================== */

.ha-menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    gap: 5px;
    flex-shrink: 0;
}

.ha-menu-toggle span {
    width: 24px;
    height: 2.5px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
    display: block;
}

.ha-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px);
}

.ha-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.ha-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ========================================
   MOBILE MENU (OFFCANVAS)
   ======================================== */

@media (max-width: 1024px) {
    .ha-nav-primary {
        position: fixed;
        left: 0;
        top: 70px;
        width: 100%;
        max-width: 300px;
        height: calc(100vh - 70px);
        background: white;
        flex-direction: column;
        gap: 0;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        z-index: 99;
    }

    .ha-nav-primary.active {
        transform: translateX(0);
    }

    .ha-nav-item {
        width: 100%;
        height: auto;
        border-bottom: 1px solid var(--color-border);
    }

    .ha-nav-item:last-child {
        border-bottom: none;
    }

    .ha-nav-link {
        width: 100%;
        height: auto;
        padding: 16px 20px;
        color: var(--color-text);
        font-size: 1rem;
    }

    .ha-nav-link::after {
        display: none;
    }

    .ha-nav-link:hover {
        background: var(--color-bg-secondary);
        color: var(--color-primary);
    }

    .ha-dropdown-menu {
        position: static;
        width: 100%;
        max-width: none;
        top: auto;
        left: auto;
        opacity: 0;
        visibility: hidden;
        max-height: 0;
        overflow: hidden;
        box-shadow: none;
        background: var(--color-bg-secondary);
        border-top: none;
        border-left: 3px solid var(--color-primary);
        transition: all 0.3s ease;
        margin: 0;
        padding: 0;
    }

    .ha-dropdown-menu.active {
        opacity: 1;
        visibility: visible;
        max-height: 500px;
    }

    .ha-dropdown-item a {
        padding: 10px 20px 10px 40px;
    }

    .ha-dropdown-item a:hover {
        padding-left: 44px;
    }

    .ha-menu-toggle {
        display: flex;
    }

    .ha-search-container {
        flex: 0 1 auto;
        width: 40px;
        height: 40px;
        padding: 0;
        border: none;
        background: transparent;
    }

    .ha-search-input {
        display: none;
    }

    .ha-search-suggestions {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-radius: 0;
        margin: 0;
    }
}

@media (max-width: 640px) {
    .ha-header-inner {
        height: 60px;
        gap: 12px;
    }

    .ha-logo {
        min-width: 120px;
        font-size: 1.1rem;
    }

    .ha-logo img {
        height: 35px;
    }

    .ha-nav-primary {
        top: 60px;
        max-height: calc(100vh - 60px);
    }

    .ha-search-container {
        width: 36px;
        height: 36px;
    }

    .ha-search-button {
        font-size: 1rem;
    }
}

/* ========================================
   BREADCRUMBS
   ======================================== */

.ha-breadcrumbs {
    background: white;
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    max-width: 1200px;
    margin: 0 auto;
}

.ha-breadcrumbs a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.ha-breadcrumbs a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.ha-breadcrumbs span {
    margin: 0 8px;
    opacity: 0.6;
}

.ha-breadcrumbs-current {
    color: var(--color-text);
    font-weight: 500;
}

/* ========================================
   ACCESSIBILITY & ANIMATIONS
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .ha-nav-link,
    .ha-dropdown-menu,
    .ha-search-suggestions,
    .ha-menu-toggle span,
    .ha-nav-primary {
        transition: none;
    }
}

/* Focus styles for keyboard navigation */
.ha-nav-link:focus,
.ha-dropdown-item a:focus,
.ha-search-input:focus,
.ha-menu-toggle:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ========================================
   STICKY BEHAVIOR
   ======================================== */

.ha-header.scrolled {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ========================================
   UTILITIES
   ======================================== */

.ha-nav-item.active > .ha-nav-link {
    background: rgba(255, 107, 53, 0.1);
    color: var(--color-primary);
}

.ha-nav-item.active > .ha-nav-link::after {
    transform: scaleX(1);
}

/* Print styles */
@media print {
    .ha-header,
    .ha-breadcrumbs,
    .ha-search-container,
    .ha-menu-toggle {
        display: none !important;
    }
}
