/**
 * Header Navigation Styles
 * Includes dropdown menus and chevron arrows based on Figma design
 */

/* ==========================================================================
   Desktop Navigation - Dropdown Menu Styles
   ========================================================================== */

/* Nav item wrapper for items with dropdowns */
.custom-header__nav-item-wrapper {
    display: flex;
    align-items: center;
    gap: 4px; /* 4px spacing between text and arrow as per Figma */
    position: relative;
}

/* Dropdown toggle button (chevron arrow) */
.custom-header__dropdown-toggle {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    color: #1e1e1e; /* Match Figma text color */
    transition: transform 0.2s ease, color 0.2s ease;
    vertical-align: middle;
}

.custom-header__dropdown-toggle:hover {
    color: #000000;
    background: none;
}

/* Arrow rotation when dropdown is open */
.custom-header__nav-list .has-dropdown.dropdown-open .custom-header__dropdown-toggle {
    transform: rotate(180deg);
}

/* Dropdown menu container */
.custom-header__dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px; /* Figma: minimum width, adapts to content */
    width: max-content; /* Adaptive width based on content */
    max-width: 320px; /* Reasonable maximum to prevent overflow */
    background: #ffffff; /* Figma: white background */
    border: 1px solid rgb(217, 217, 217); /* Figma: r: 0.8509804 */
    border-radius: 8px; /* Figma: cornerRadius: 8 */
    padding: 8px; /* Figma: internal padding */
    margin: 8px 0 0 0;
    list-style: none;
    z-index: 1000;
    display: none; /* Initially hidden, shown by JavaScript */
    /* Figma: Drop shadows */
    box-shadow: 
        0 1px 4px rgba(12, 12, 13, 0.05),
        0 1px 4px rgba(12, 12, 13, 0.1);
}

/* Dropdown menu items */
.custom-header__dropdown-menu li {
    margin: 0 0 8px 0; /* Figma: 8px item spacing */
    padding: 0;
}

.custom-header__dropdown-menu li:last-child {
    margin-bottom: 0; /* Remove margin from last item */
}

.custom-header__dropdown-menu a {
    margin: 4px 0;
    display: flex;
    align-items: center;
    width: 100%; /* Adaptive width - fills container */
    height: 30px; /* Figma: exact height */
    padding: 4px 8px; /* Figma: internal padding (4px top/bottom to center 22px text in 30px container) */
    color: rgb(30, 30, 30); /* Figma: r: 0.11764705926179886 */
    background: transparent;
    text-decoration: none;
    font-family: var(--proxima-nova-font), 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px; /* Figma: font size for menu items */
    font-weight: 400; /* Figma: regular font weight */
    line-height: 22px; /* Figma: text height */
    border-radius: 0; /* Default state - no border radius */
    transition: all 0.2s ease;
    box-sizing: border-box;
    white-space: nowrap; /* Prevent text wrapping */
}

.custom-header__dropdown-menu a:hover,
.custom-header__dropdown-menu a:focus {
    background: rgba(118, 118, 128, 0.08); /* Figma: hover background with 8% opacity */
    border-radius: 4px; /* Figma: cornerRadius on hover */
    color: rgb(30, 30, 30); /* Figma: keep same text color */
    /* No underline for submenu items - handled by main CSS */
}

/* ==========================================================================
   Mobile Navigation - Dropdown Menu Styles
   ========================================================================== */

/* Mobile nav item wrapper for items with dropdowns */
.custom-header__mobile-nav-item-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Mobile dropdown toggle button */
.custom-header__mobile-dropdown-toggle {
    background: none;
    border: none;
    padding: 8px;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #1e1e1e;
    transition: transform 0.2s ease, color 0.2s ease;
    border-radius: 4px;
}

.custom-header__mobile-dropdown-toggle:hover {
    background: none;
}

/* Arrow rotation when dropdown is open */
.custom-header__mobile-dropdown-toggle.active {
    transform: rotate(180deg);
}

/* Mobile dropdown menu container */
.custom-header__mobile-dropdown-menu {
    list-style: none;
    margin: 8px 0 0 0;
    padding: 0 0 0 20px;
    border-left: 2px solid #f0f0f0;
}

.custom-header__mobile-dropdown-menu li {
    margin: 0;
    padding: 0;
}

.custom-header__mobile-dropdown-menu a {
    display: block;
    padding: 12px 16px;
    color: #666666;
    text-decoration: none;
    font-family: var(--proxima-nova-font), 'Proxima Nova', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    transition: color 0.2s ease;
}

.custom-header__mobile-dropdown-menu a:hover,
.custom-header__mobile-dropdown-menu a:focus {
    color: #1e1e1e;
}

/* ==========================================================================
   Navigation List Base Styles
   ========================================================================== */

/* Ensure proper positioning for dropdown menus */
.custom-header__nav-list > li {
    position: relative;
}

.custom-header__nav-list .has-dropdown > a {
    /* Remove any potential right margin that might interfere with arrow positioning */
    margin-right: 0;
}

/* ==========================================================================
   Responsive Behavior
   ========================================================================== */

/* Hide desktop dropdowns on mobile */
@media (max-width: 1023px) {
    .custom-header__dropdown-menu {
        display: none !important;
    }
    
    .custom-header__dropdown-toggle {
        display: none;
    }
    
    .custom-header__nav-item-wrapper {
        display: contents;
    }
}

/* Hide mobile dropdowns on desktop */
@media (min-width: 1024px) {
    .custom-header__mobile-dropdown-toggle {
        display: none;
    }
    
    .custom-header__mobile-nav-item-wrapper {
        display: contents;
    }
    
    .custom-header__mobile-dropdown-menu {
        display: none !important;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

/* Focus styles for dropdown toggles */
.custom-header__dropdown-toggle:focus,
.custom-header__mobile-dropdown-toggle:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .custom-header__dropdown-menu {
        border: 2px solid #000000;
    }
    
    .custom-header__dropdown-menu a:hover,
    .custom-header__dropdown-menu a:focus {
        color: #000000;
        text-decoration: underline;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .custom-header__dropdown-toggle,
    .custom-header__mobile-dropdown-toggle {
        transition: none;
    }
    
    .custom-header__dropdown-menu a {
        transition: none;
    }
}

/* ==========================================================================
   Language Selector Arrow (already styled in header.php)
   ========================================================================== */

/* The language selector already has proper chevron styling in header.php
   This section ensures consistency with the navigation dropdown arrows */

.custom-header__language-chevron {
    width: 16px;
    height: 16px;
    color: #1e1e1e;
    transition: transform 0.2s ease;
}

.custom-header__language-button[aria-expanded="true"] .custom-header__language-chevron {
    transform: rotate(180deg);
}

/* ==========================================================================
   Responsive Animated Underlines for Navigation
   ========================================================================== */

/* Only target normal nav menu links (exclude parent items with dropdowns and submenu items) */
.custom-header nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a),
.custom-footer nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a) {
  position: relative;
  text-decoration: none !important;
  color: inherit !important;
}

/* Animated underline (hidden initially) - only for normal menu items */
.custom-header nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a)::after,
.custom-footer nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  width: 0;
  height: 2px;
  background: currentColor;
  transition: width 0.3s ease;
  transform: translateX(-50%);
}

/* Hover: keep color, animate underline - only for normal menu items */
.custom-header nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a):hover,
.custom-footer nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a):hover {
  color: inherit !important;
  text-decoration: none !important;
}

.custom-header nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a):hover::after,
.custom-footer nav ul li:not(.has-dropdown) a:not(.custom-header__dropdown-menu a):hover::after {
  width: 100%;
}

/* Ensure submenu items and parent menu items have no underlines */
.custom-header nav ul li.has-dropdown > a::after,
.custom-header__dropdown-menu a::after {
  display: none !important;
}
