/* =====================================================
   MEGA MENU STYLES
   Only loaded when mega menu feature is enabled
   ===================================================== */

:root {
    --mega-menu-bg: #ffffff;
    --mega-menu-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --mega-menu-header-color: #333333;
    --mega-menu-link-color: #555555;
    --mega-menu-link-hover: var(--primary-color);
    --mega-menu-border-color: #e9ecef;
    --mega-menu-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Main navigation section needs stacking context for mega menu to overlap content below */
.mainnav-section {
    position: relative !important;
    z-index: 100 !important;
}

/* Navigation container needs position relative for mega menu positioning */
.navigation {
    position: relative !important;
}

/* Mega Menu Parent Container - needs static positioning for full-width dropdown */
.has-mega-menu {
    position: static !important;
    margin-top: -12px;
}

.mega-menu-links a {
    padding: 7px 0px !important;
    font-weight: 400 !important;
    font-size: 16px !important;
}

.mega-menu-links a i {
    display: none !important;
}

/* M ega Menu Dropdown Panel */
.mega-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--mega-menu-bg);
    background-color: #ffffff; /* Fallback solid background */
    box-shadow: var(--mega-menu-shadow);
    border-top: 3px solid var(--primary-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--mega-menu-transition);
    z-index: 1050;
    padding: 0;
}

/* Show on hover or when .show class is added via JS */
.has-mega-menu:hover .mega-menu-dropdown,
.mega-menu-dropdown:hover,
.mega-menu-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Extended hover area to prevent accidental closing - uses padding instead of pseudo-element
   since .has-mega-menu has position: static */
.has-mega-menu > a {
    padding-bottom: 20px;
    margin-bottom: -15px;
}

/* Mega Menu Inner Container */
.mega-menu-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 25px 30px;
}

/* 4-Column Grid Layout */
.mega-menu-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

/* Individual Column */
.mega-menu-column {
    min-height: 100px;
}

.mega-menu-column-empty {
    /* Empty column placeholder - allows flexible layouts */
}

/* Column Header */
.mega-menu-column-header {
    font-size: 15px;
    font-weight: 600;
    color: var(--mega-menu-header-color, #333333) !important;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Links List */
.mega-menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-links li {
    margin-bottom: 6px;
}

.mega-menu-links a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    color: var(--mega-menu-link-color, #555555) !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    transition: var(--mega-menu-transition);
    border: none !important;
    background: transparent !important;
    transform: none !important;
}

.mega-menu-links a:hover {
    color: var(--mega-menu-link-hover, var(--primary-color)) !important;
    padding-left: 10px;
    background: transparent !important;
}

.mega-menu-links a.active {
    color: var(--primary-color);
    font-weight: 500;
}

.mega-menu-links a i {
    font-size: 12px;
    opacity: 0.7;
    width: 16px;
}

/* Override main navigation styles for mega menu links */
.mega-menu-dropdown .mega-menu-links a::after {
    display: none !important;
}

.mega-menu-dropdown .mega-menu-links a:hover::after {
    display: none !important;
}

/* Animation Variants */
.mega-menu-dropdown.animation-fade {
    transition: opacity 0.2s ease, visibility 0.2s ease;
    transform: none;
}

.mega-menu-dropdown.animation-slide {
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.mega-menu-dropdown.animation-none {
    transition: none;
}

/* View All Link at bottom of column */
.mega-menu-view-all {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--mega-menu-border-color);
}

.mega-menu-view-all a {
    color: var(--primary-color) !important;
    font-weight: 500 !important;
    font-size: 13px !important;
}

.mega-menu-view-all a:hover {
    text-decoration: underline !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .mega-menu-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .mega-menu-container {
        padding: 20px;
    }
}

@media (max-width: 992px) {
    /* Hide mega menu on tablet/mobile - fallback to regular dropdown */
    .mega-menu-dropdown {
        display: none !important;
    }

    /* Show regular dropdown instead for mobile */
    .has-mega-menu .dropdown-menu {
        display: block !important;
    }
}

@media (max-width: 768px) {
    .mega-menu-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .mega-menu-container {
        padding: 15px;
    }
}

/* Focus states for accessibility */
.mega-menu-links a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mega-menu-dropdown {
        border-width: 2px;
    }

    .mega-menu-column-header {
        border-bottom-width: 3px;
    }
}

/* Print styles - hide mega menu */
@media print {
    .mega-menu-dropdown {
        display: none !important;
    }
}

/* =====================================================
   HEADER STYLE 5 MEGA MENU SPECIFIC STYLES
   Header v5 has navigation inside a flex container,
   so mega menu needs special positioning to span full width
   ===================================================== */

/* Make header-v5-section the positioning context with high z-index */
.header-v5-section {
    position: relative !important;
    z-index: 100 !important;
}

/* Header-v5 inner container should not create positioning context */
.header-v5-section .header-v5 {
    position: static !important;
}

/* Header-v5-right should not create positioning context */
.header-v5-section .header-v5-right {
    position: static !important;
}

/* Navigation in header-v5 should not create positioning context for mega menu */
.header-v5-section .navigation.header-v5-navigation {
    position: static !important;
}

/* Make the mega menu parent static so dropdown can escape */
.header-v5-section .has-mega-menu {
    position: static !important;
}

/* Header-v5 mega menu - position relative to .header-v5-section (full width) */
.header-v5-section .mega-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1050 !important;
}

/* Override header-v5 navigation colors for mega menu links */
.header-v5-section .mega-menu-dropdown .mega-menu-links a {
    color: var(--mega-menu-link-color, #555555) !important;
    background: transparent !important;
}

.header-v5-section .mega-menu-dropdown .mega-menu-links a:hover {
    color: var(--mega-menu-link-hover, var(--primary-color)) !important;
    background: transparent !important;
}

.header-v5-section .mega-menu-dropdown .mega-menu-column-header {
    color: var(--mega-menu-header-color, #333333) !important;
}
