/*
    navigation-override.css
    Enhanced navigation styles for AI-categorized navigation
    Provides improved responsive design and better visual hierarchy
*/

/* Navigation Override Fixes */

/* Ensure dropdown menus are hidden by default with higher specificity */
.main-navigation .nav-menu .dropdown-menu {
    display: none !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    min-width: 200px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    border-radius: 4px;
    z-index: 1000;
}

/* Ensure dropdown menu links have visible text color */
.dropdown-menu a, 
.dropdown-menu .dropdown-link {
    color: #333 !important; /* Dark text color for visibility on white background */
}

/* Show dropdown on hover for desktop */
@media (hover: hover) and (pointer: fine) {
    .main-navigation .nav-menu .has-dropdown:hover .dropdown-menu {
        display: block !important;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

/* Show dropdown when active class is applied */
.main-navigation .nav-menu .has-dropdown.active .dropdown-menu {
    display: block !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Show dropdown when aria-expanded is true */
.main-navigation .nav-menu .dropdown-toggle[aria-expanded="true"] + .dropdown-menu {
    display: block !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Ensure proper layout for nav items */
.main-navigation .nav-menu {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

.main-navigation .nav-menu > li {
    display: flex !important;
    align-items: center !important;
}

/* Fix for dropdown positioning */
.main-navigation .nav-menu .has-dropdown {
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure mobile nav is hidden on desktop */
@media (min-width: 769px) {
    .mobile-nav-wrapper {
        display: none !important;
    }
}

/* Enhanced Navigation Overflow Detection */
.navigation-overflow-detected #desktop-nav {
    display: none !important;
}

.navigation-overflow-detected .mobile-nav-wrapper {
    display: block !important;
}

/* Improved Desktop Navigation Spacing */
@media (min-width: 1025px) {
    .nav-menu {
        gap: 0.75rem;
        flex-wrap: nowrap;
    }
    
    .nav-menu > li > a {
        padding: 0.75rem 1rem;
        white-space: nowrap;
        font-size: 0.95rem;
    }
    
    /* Better dropdown positioning for items near edge */
    .nav-menu > li:nth-last-child(-n+2) .dropdown-menu {
        left: auto;
        right: 0;
    }
}

/* Medium screen navigation adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .nav-menu {
        gap: 0.5rem;
    }
    
    .nav-menu > li > a {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Enhanced Mobile Navigation */
@media (max-width: 1024px) {
    .mobile-nav-wrapper {
        display: block;
    }
    
    #desktop-nav {
        display: none;
    }
    
    .mobile-nav-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
}

/* Responsive navigation categories styling */
.nav-item[data-page*="service"],
.nav-item[data-page*="products"] {
    /* Service/Product items styling */
}

.nav-item[data-page*="contact"],
.nav-item[data-page*="quote"] {
    /* CTA items styling - make them stand out */
    margin-left: auto;
}

.nav-item[data-page="request-a-quote"] a,
.nav-item[data-page="contact-us"] a {
    background-color: var(--primary-color, #0056b3);
    color: white !important;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.nav-item[data-page="request-a-quote"] a:hover,
.nav-item[data-page="contact-us"] a:hover {
    background-color: var(--secondary-color, #007bff);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 86, 179, 0.3);
}

/* Enhanced dropdown visual hierarchy */
.dropdown-menu {
    border-radius: 8px;
    padding: 0.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dropdown-menu .dropdown-link {
    display: block !important;
    padding: 0.75rem 1.25rem !important;
    margin: 0 !important;
    text-decoration: none !important;
    color: inherit !important;
    transition: all 0.2s ease !important;
    border-radius: 0 !important;
}

.dropdown-menu .dropdown-link:hover {
    background-color: #f8f9fa !important;
    padding-left: 1.5rem !important;
    color: var(--primary-color, #0056b3) !important;
}

/* Mobile navigation category indicators */
.mobile-nav-item[data-page*="privacy"],
.mobile-nav-item[data-page*="terms"],
.mobile-nav-item[data-page*="environmental"] {
    order: 999; /* Move legal pages to bottom */
    opacity: 0.7;
    font-size: 0.9rem;
}

/* Improved mobile submenu spacing */
.mobile-submenu-link {
    padding-left: 2.5rem;
    position: relative;
}

.mobile-submenu-link::before {
    content: "→";
    position: absolute;
    left: 1.5rem;
    opacity: 0.5;
    font-size: 0.8rem;
}

/* Enhanced visual feedback for active states */
.nav-item.active > a::after,
.mobile-nav-item.active > a::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: var(--primary-color, #0056b3);
    border-radius: 1px;
}

.mobile-nav-item.active > a::after {
    bottom: auto;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
}

/* Accessibility improvements */
.nav-menu a:focus,
.mobile-nav-link:focus,
.dropdown-link:focus {
    outline: 2px solid var(--primary-color, #0056b3);
    outline-offset: 2px;
    background-color: rgba(0, 86, 179, 0.1);
}

/* Smooth animations for better UX */
.nav-menu a,
.mobile-nav-link,
.dropdown-link {
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Logo responsiveness */
.logo a {
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    line-height: 1.2;
}

/* Navigation container flex improvements */
.site-header .container {
    gap: 1rem;
}

@media (max-width: 480px) {
    .site-header .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .logo a {
        font-size: 1.1rem;
    }
    
    .mobile-nav-toggle {
        width: 36px;
        height: 36px;
    }
    
    .hamburger-line {
        width: 24px;
        height: 2px;
    }
}

/* Animation for navigation state changes */
@keyframes navSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-menu {
    animation: navSlideIn 0.2s ease-out;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nav-menu a,
    .mobile-nav-link {
        border: 1px solid transparent;
    }
    
    .nav-menu a:hover,
    .nav-menu a:focus,
    .mobile-nav-link:hover,
    .mobile-nav-link:focus {
        border-color: currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nav-menu a,
    .mobile-nav-link,
    .dropdown-link,
    .mobile-nav-content,
    .mobile-nav-menu {
        transition: none;
    }
    
    .dropdown-menu {
        animation: none;
    }
}

/* Print styles - hide navigation */
@media print {
    .site-header,
    .mobile-nav-wrapper,
    .mobile-nav-menu {
        display: none !important;
    }
}

/* Fix dropdown parent item alignment - ensure inline with other nav items */
.main-navigation .nav-menu > li.has-dropdown > a {
    display: flex !important;
    align-items: center !important;
    padding: 0.75rem 1rem !important;
    /* Ensure same padding as regular nav items */
}

/* Ensure dropdown arrows don't affect alignment */
.dropdown-arrow {
    margin-left: 0.5rem !important;
    font-size: 0.8rem !important;
    transition: transform 0.2s ease !important;
}

/* Rotate arrow when dropdown is open */
.has-dropdown.active .dropdown-arrow,
.dropdown-toggle[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg) !important;
}

/* Ensure consistent nav item spacing regardless of type */
.main-navigation .nav-menu > li > a,
.main-navigation .nav-menu > li > button {
    padding: 0.75rem 1rem !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
}

/* Override any inherited styles that might cause indentation */
.main-navigation .nav-menu > li.has-dropdown {
    position: relative !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure dropdown items are properly indented under parent */
.dropdown-menu .dropdown-item {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
} 
/* Ensure text in primary sections is visible */
.section-primary * { color: #ffffff; }
