/**
 * Navigation Styles - WordPress.org Compliant
 * Main navigation menu, dropdowns, mobile menu, and keyboard focus styles
 */

/* ============================================
   DESKTOP NAVIGATION
   ============================================ */

.hvn-theme-main-navigation {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.hvn-theme-nav-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem;
}

.hvn-theme-nav-menu li {
    position: relative;
    margin: 0;
}

.hvn-theme-nav-menu a {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--hvn-theme-text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
    border-radius: 0.375rem;
}

/* Focus Styles for Keyboard Navigation */
.hvn-theme-nav-menu a:focus-visible {
    outline: 2px solid var(--hvn-theme-brand-primary);
    outline-offset: 2px;
    background-color: rgba(108, 96, 254, 0.05);
}

.hvn-theme-nav-menu a:hover {
    color: var(--hvn-theme-brand-primary);
    background-color: var(--hvn-theme-color-gray-100);
}

/* Current Menu Item */
.hvn-theme-nav-menu .current-menu-item > a,
.hvn-theme-nav-menu .current-page-ancestor > a {
    color: var(--hvn-theme-brand-primary);
    background-color: rgba(108, 96, 254, 0.08);
    font-weight: 600;
}

/* ============================================
   DROPDOWN MENU - DESKTOP (Single Arrow)
   ============================================ */

.hvn-theme-nav-menu .menu-item-has-children {
    position: relative;
}

.hvn-theme-nav-menu .menu-item-has-children > a {
    padding-right: 1.75rem;
    position: relative;
}

/* Dropdown Arrow - Using CSS pseudo-element (ONLY ONE ARROW) */
.hvn-theme-nav-menu .menu-item-has-children > a::after {
    content: "";
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.2s ease;
}

/* Rotate arrow on hover */
.hvn-theme-nav-menu .menu-item-has-children:hover > a::after {
    transform: translateY(-50%) rotate(180deg);
}

/* Hide any span dropdown indicators from walker */
.hvn-theme-nav-menu .dropdown-indicator {
    display: none;
}

/* Submenu */
.hvn-theme-nav-menu .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--hvn-theme-color-white);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    border-radius: 0.75rem;
    padding: 0.5rem 0;
    margin: 0.5rem 0 0;
    list-style: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.5rem);
    transition: all 0.2s ease;
    z-index: 99999;
    border: 1px solid var(--hvn-theme-border-color);
}

/* Show submenu on hover */
.hvn-theme-nav-menu .menu-item-has-children:hover > .sub-menu,
.hvn-theme-nav-menu .menu-item-has-children.focus > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Submenu Items */
.hvn-theme-nav-menu .sub-menu li {
    width: 100%;
}

.hvn-theme-nav-menu .sub-menu a {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 0;
}

.hvn-theme-nav-menu .sub-menu a:hover {
    background-color: var(--hvn-theme-color-gray-100);
    padding-left: 1.25rem;
}

/* Nested Dropdowns (Third Level) - Right arrow for nested items */
.hvn-theme-nav-menu .sub-menu .menu-item-has-children > a::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='9 18 15 12 9 6'%3E%3C/polyline%3E%3C/svg%3E");
    right: 0.75rem;
}

.hvn-theme-nav-menu .sub-menu .menu-item-has-children > .sub-menu {
    top: -0.5rem;
    left: 100%;
    margin-left: 0.25rem;
}

/* Dropdown Toggle Button (for mobile fallback) */
.dropdown-toggle {
    display: none;
}

/* ============================================
   MOBILE MENU - HAMBURGER & SIDE MENU
   ============================================ */

/* Menu Toggle Button (Hamburger) */
.hvn-theme-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.hvn-theme-menu-toggle .hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--hvn-theme-text-primary);
    position: relative;
    transition: all 0.2s ease;
}

.hvn-theme-menu-toggle .hamburger::before,
.hvn-theme-menu-toggle .hamburger::after {
    content: "";
    position: absolute;
    width: 24px;
    height: 2px;
    background: var(--hvn-theme-text-primary);
    left: 0;
    transition: all 0.2s ease;
}

.hvn-theme-menu-toggle .hamburger::before {
    top: -8px;
}

.hvn-theme-menu-toggle .hamburger::after {
    bottom: -8px;
}

/* Active state - transforms hamburger to X */
.hvn-theme-menu-toggle.active .hamburger {
    background: transparent;
}

.hvn-theme-menu-toggle.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.hvn-theme-menu-toggle.active .hamburger::after {
    transform: rotate(-45deg);
    bottom: 0;
}

/* Mobile Menu Panel */
.hvn-theme-mobile-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: var(--hvn-theme-color-white);
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.hvn-theme-mobile-menu.active {
    left: 0;
}

/* Mobile Menu Header */
.hvn-theme-mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--hvn-theme-border-color);
    background: var(--hvn-theme-color-white);
}

.hvn-theme-mobile-menu-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--hvn-theme-brand-primary);
}

.hvn-theme-mobile-menu-close {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--hvn-theme-text-muted);
    padding: 5px 10px;
    transition: all 0.2s ease;
}

.hvn-theme-mobile-menu-close:hover {
    color: var(--hvn-theme-brand-error);
    transform: scale(1.1);
}
.hvn-theme-mobile-menu-header button, .hvn-theme-mobile-menu-header button:hover, .hvn-theme-mobile-menu-header button:focus , .hvn-theme-mobile-menu-header button:active {
    background-color: transparent;
}
/* Mobile Menu Content */
.hvn-theme-mobile-menu-content {
    flex: 1;
    padding: 20px;
}

/* Mobile Navigation Menu */
.hvn-theme-mobile-nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hvn-theme-mobile-nav-menu li {
    border-bottom: 1px solid var(--hvn-theme-border-color-light);
}

.hvn-theme-mobile-nav-menu li:last-child {
    border-bottom: none;
}

.hvn-theme-mobile-nav-menu a {
    display: block;
    padding: 14px 0;
    color: var(--hvn-theme-text-primary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.hvn-theme-mobile-nav-menu a:hover,
.hvn-theme-mobile-nav-menu a:focus {
    color: var(--hvn-theme-brand-primary);
    padding-left: 5px;
}

/* Mobile Dropdowns */
.hvn-theme-mobile-nav-menu .menu-item-has-children {
    position: relative;
}

.hvn-theme-mobile-nav-menu .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 15px;
    display: none;
}

.hvn-theme-mobile-nav-menu .sub-menu.toggled {
    display: block;
}

.hvn-theme-mobile-nav-menu .sub-menu a {
    padding: 10px 0;
    font-size: 0.875rem;
    font-weight: 400;
}

.hvn-theme-mobile-nav-menu .sub-menu a:hover {
    padding-left: 10px;
}

/* Mobile Dropdown Toggle Button */
.hvn-theme-mobile-dropdown-toggle {
    position: absolute;
    right: 0;
    top: 10px;
    background: none;
    border: 1px solid var(--hvn-theme-border-color);
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    color: var(--hvn-theme-text-muted);
    font-size: 0.75rem;
    transition: all 0.2s ease;
    min-width: 36px;
    text-align: center;
}

.hvn-theme-mobile-dropdown-toggle:hover {
    background: var(--hvn-theme-color-gray-100);
    color: var(--hvn-theme-brand-primary);
}

.hvn-theme-mobile-dropdown-toggle.active {
    transform: rotate(180deg);
    background: var(--hvn-theme-brand-primary);
    color: white;
    border-color: var(--hvn-theme-brand-primary);
}

/* Mobile Overlay */
.hvn-theme-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.hvn-theme-mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Tablet & Mobile (up to 991px) */
@media (max-width: 991px) {
    /* Show hamburger button */
    .hvn-theme-menu-toggle {
        display: block;
    }
    
    /* Hide desktop navigation */
    .hvn-theme-main-navigation {
        display: none;
    }
    
    /* Header actions layout */
    .hvn-theme-header-actions {
        display: flex;
        align-items: center;
        gap: 10px;
    }
}

/* Desktop (992px and above) */
@media (min-width: 992px) {
    /* Show desktop navigation */
    .hvn-theme-main-navigation {
        display: flex !important;
    }
    
    /* Hide hamburger button on desktop */
    .hvn-theme-menu-toggle {
        display: none !important;
    }
    
    /* Hide mobile menu elements on desktop */
    .hvn-theme-mobile-menu,
    .hvn-theme-mobile-overlay {
        display: none !important;
    }
}

/* ============================================
   ACCESSIBILITY & FOCUS STYLES
   ============================================ */

/* Focus styles for keyboard navigation */
.keyboard-user *:focus {
    outline: 2px solid var(--hvn-theme-brand-primary) !important;
    outline-offset: 2px !important;
}

.mouse-user *:focus {
    outline: none !important;
}

/* Focus styles for menu items */
.hvn-theme-nav-menu .menu-item-has-children.focus > .sub-menu,
.hvn-theme-nav-menu .menu-item-has-children:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Focus visible for all interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--hvn-theme-brand-primary);
    outline-offset: 2px;
    border-radius: 4px;
}