/**
 * Multi-level Navigation Menu Styles
 * 
 * Comprehensive styling for the multi-level dropdown menu system.
 * Includes responsive design, hover effects, and accessibility features.
 * 
 * @package HelloElementorChild
 * @since 1.0.0
 */

/* ==========================================================================
   Base Menu Container
   ========================================================================== */

.multilevel-menu-container {
    position: relative;
    z-index: 1000;
}

/* Ensure dropdowns are considered part of the container for hover detection */
.multilevel-menu-container * {
    pointer-events: auto;
}

.multilevel-menu-error {
    color: #e53e3e;
    background-color: #fed7d7;
    border: 1px solid #feb2b2;
    border-radius: 4px;
    padding: 12px 16px;
    margin: 10px 0;
    font-size: 14px;
}

/* ==========================================================================
   Main Menu Level (Level 1)
   ========================================================================== */

.multilevel-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: flex-end;
    position: relative;
}


.multilevel-menu .menu-item {
    position: relative;
    margin: 0;
    padding: 0;
}

.multilevel-menu .menu-item img{
    width: 16px;
    height: 16px;
}

.multilevel-menu .menu-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin: 4px;
    white-space: nowrap;
}

.multilevel-menu .menu-link:hover,
.multilevel-menu .menu-link:focus {
    text-decoration: none;
    transform: translateY(-1px);
}

.multilevel-menu .dropdown-arrow {
    margin-left: 8px;
    font-size: 10px;
}


/* ==========================================================================
   Dropdown Menu (Level 2)
   ========================================================================== */

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 250px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    padding: 8px 0;
    display: none;
    opacity: 0;
    z-index: 1001;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-10px);
    list-style: none;
    margin: 0;
    visibility: hidden;
}

.dropdown-menu a {
    font-weight: 600;
    font-size: 16px;
    color: #223B4B
}

.dropdown-menu .submenu a {
    font-weight: 400;
    font-size: 14px;
    color: #6294B4
}

/* Show dropdown when visible */
.dropdown-menu[style*="display: block"] {
    visibility: visible;
}

/* CSS-only hover fallback (in case JavaScript doesn't load) */
.multilevel-menu .has-dropdown:hover > .dropdown-menu,
.multilevel-menu .has-dropdown > .dropdown-menu:hover {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Keep dropdown visible when hovering over it */
.dropdown-menu:hover {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.dropdown-menu.level-1 {
    padding-top: 8px;
}

.dropdown-menu[style*="opacity: 1"] {
    transform: translateY(0);
}

.dropdown-item {
    position: relative;
    list-style: none;
    margin: 0;
}

.dropdown-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    color: #4a5568;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 0 8px;
}

.dropdown-link:hover,
.dropdown-link:focus {
    background-color: #f7fafc;
    color: #6294B4;
    text-decoration: none;
    transform: translateX(4px);
}

.dropdown-link:hover .dropdown-arrow,
.dropdown-link:focus .dropdown-arrow {
    color: #6294B4;
}

.submenu-arrow {
    font-size: 10px;
    color: #a0aec0;
    transition: color 0.2s ease;
    opacity: 0.7;
}

.dropdown-link:hover .submenu-arrow,
.dropdown-link:focus .submenu-arrow {
    color: #4a5568;
    opacity: 1;
}

/* ==========================================================================
   Submenu (Level 3)
   ========================================================================== */

.submenu {
    position: absolute;
    top: 0;
    left: 100%;
    min-width: 200px;
    background: transparent;
    padding: 8px;
    display: none;
    opacity: 0;
    z-index: 1002;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-10px);
    list-style: none;
    visibility: hidden;
}

.submenu-container {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
}

/* CSS-only hover fallback for submenus */
.dropdown-menu .has-submenu:hover > .submenu,
.dropdown-menu .has-submenu > .submenu:hover {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
}

/* Keep submenu visible when hovering over it */
.submenu:hover {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.submenu[style*="opacity: 1"] {
    transform: translateX(0);
}

.submenu-item {
    list-style: none;
    margin: 0;
}

.submenu-link {
    display: block;
    padding: 5px 20px;
    color: #4a5568;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 0 8px;
}

.submenu-link:hover,
.submenu-link:focus {
    text-decoration: none;
    transform: translateX(4px);
}

/* ==========================================================================
   Visual Enhancements
   ========================================================================== */


/* Hover effects for menu items */
.multilevel-menu .has-dropdown {
    transition: all 0.3s ease;
}

.multilevel-menu .has-dropdown:hover {
    transform: translateY(-1px);
}

/* Animation for dropdowns */
.dropdown-menu,
.submenu {
    animation: fadeInUp 0.2s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Accessibility Features
   ========================================================================== */

/* Focus states for keyboard navigation */
.menu-link:focus,
.dropdown-link:focus,
.submenu-link:focus {
    outline: 2px solid #4299e1;
    outline-offset: 2px;
    background-color: rgba(66, 153, 225, 0.1);
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet styles */
@media (max-width: 1024px) {
    .multilevel-menu .menu-link {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .dropdown-menu {
        min-width: 220px;
    }
    
    .submenu {
        min-width: 180px;
    }
}

/* Mobile styles */
@media (max-width: 768px) {
    .multilevel-menu {
        flex-direction: column;
        border-radius: 8px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    .multilevel-menu .menu-link {
        padding: 12px 16px;
        margin: 1px;
        border-radius: 0;
        justify-content: space-between;
    }
    
    .multilevel-menu .menu-item:first-child .menu-link {
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }
    
    .multilevel-menu .menu-item:last-child .menu-link {
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }
    
    .dropdown-menu {
        position: static;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
        background: #f8fafc;
        border-radius: 0;
        margin: 0;
        border: none;
        border-top: 1px solid #e2e8f0;
        min-width: auto;
    }
    
    .submenu {
        position: static;
        margin-left: 0;
        background: #f1f5f9;
        box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
        border-radius: 0;
        border: none;
        border-top: 1px solid #e2e8f0;
        min-width: auto;
    }
    
    .dropdown-link,
    .submenu-link {
        padding-left: 30px;
        transform: none !important;
    }
    
    .submenu-link {
        padding-left: 45px;
    }
    
    /* Mobile hover states */
    .dropdown-link:hover,
    .submenu-link:hover {
        transform: none;
    }
}

/* Small mobile styles */
@media (max-width: 480px) {
    .multilevel-menu .menu-link {
        padding: 10px 12px;
        font-size: 12px;
    }
    
    .dropdown-link {
        padding: 5px 20px;
        font-size: 13px;
    }
    
    .submenu-link {
        padding: 8px 35px;
        font-size: 12px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .multilevel-menu-container {
        display: none;
    }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */

@media (prefers-contrast: high) {
    .multilevel-menu {
        border: 2px solid #000000;
    }
    
    .menu-link,
    .dropdown-link,
    .submenu-link {
        border: 1px solid transparent;
    }
    
    .menu-link:focus,
    .dropdown-link:focus,
    .submenu-link:focus {
        border-color: #000000;
        outline: 2px solid #000000;
    }
}

/* ==========================================================================
   Reduced Motion Support
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .multilevel-menu *,
    .dropdown-menu *,
    .submenu * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}