/**
 * Custom Mega Menu CSS for Valutahandel.se
 * Created: 2026-10-28
 * Modern, clean mega-menu without plugin dependencies
 */

/* ===================================
   BASE MENU STRUCTURE
   =================================== */

.MainMenu {
    position: relative;
}

.MainMenu .custom-mega-menu,
.MainMenu .sf-menu {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.MainMenu .custom-mega-menu > li,
.MainMenu .sf-menu > li {
    position: relative;
    margin: 0;
    padding: 12px 15px;
    list-style: none;
}

.MainMenu .custom-mega-menu > li > a,
.MainMenu .sf-menu > li > a {
    display: block;
    font-family: 'Arimo', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #262a33;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.MainMenu .custom-mega-menu > li > a:hover,
.MainMenu .custom-mega-menu > li.current-menu-item > a,
.MainMenu .sf-menu > li > a:hover,
.MainMenu .sf-menu > li.current-menu-item > a {
    color: #2697c1;
}

/* Active underline effect */
.MainMenu .custom-mega-menu > li.current-menu-item > a::after,
.MainMenu .sf-menu > li.current-menu-item > a::after {
    content: "";
    position: absolute;
    bottom: -28px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #2697c1;
}

header.fixed .MainMenu .custom-mega-menu > li.current-menu-item > a::after,
header.fixed .MainMenu .sf-menu > li.current-menu-item > a::after {
    bottom: -19px;
}

/* Dropdown icon */
.dropdown-icon {
    margin-left: 5px;
    font-size: 14px;
    transition: transform 0.3s ease;
}

.has-mega-menu:hover .dropdown-icon {
    transform: rotate(180deg);
}

/* ===================================
   MEGA DROPDOWN
   =================================== */

.mega-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin: 0;
    padding: 30px;
    list-style: none;
    background: #faf2ea;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
    min-width: 250px;
}

/* Show dropdown on hover */
.has-mega-menu:hover > .mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Full width mega menu for main items */
.MainMenu .custom-mega-menu > li.has-mega-menu > .mega-dropdown {
    left: -30px;
    right: -30px;
    width: auto;
    min-width: 600px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Mega dropdown items */
.mega-dropdown li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-dropdown a {
    display: block;
    padding: 10px 15px;
    color: #2a2a2a;
    font-size: 14px;
    font-family: 'Roboto', sans-serif;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.mega-dropdown a:hover {
    color: #2697c1;
    background: rgba(38, 151, 193, 0.1);
    padding-left: 20px;
}

/* Nested dropdowns (flyout) */
.mega-dropdown .has-mega-menu {
    position: relative;
}

.mega-dropdown .has-mega-menu > .mega-dropdown {
    left: 100%;
    top: 0;
    margin-left: 10px;
    padding: 20px;
}

.mega-dropdown .has-mega-menu:hover > .mega-dropdown {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   MOBILE MENU TOGGLE
   =================================== */

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 10;
}

.mobile-menu-toggle span {
    width: 30px;
    height: 3px;
    background: #262a33;
    border-radius: 10px;
    transition: all 0.3s ease;
    transform-origin: 1px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* ===================================
   RESPONSIVE / MOBILE
   =================================== */

@media (max-width: 990px) {
    .mobile-menu-toggle {
        display: flex;
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
    }
    
    .MainMenu .custom-mega-menu,
    .MainMenu .sf-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 300px;
        height: 100vh;
        background: #fff;
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 20px 20px;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
        transition: right 0.3s ease;
        z-index: 999;
        overflow-y: auto;
    }
    
    .MainMenu .custom-mega-menu.mobile-active,
    .MainMenu .sf-menu.mobile-active {
        right: 0;
    }
    
    .MainMenu .custom-mega-menu > li,
    .MainMenu .sf-menu > li {
        width: 100%;
        padding: 0;
        border-bottom: 1px solid #eee;
    }
    
    .MainMenu .custom-mega-menu > li > a,
    .MainMenu .sf-menu > li > a {
        padding: 15px 20px;
        display: block;
        font-size: 14px;
    }
    
    .mega-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        padding: 0;
        background: #f5f5f5;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .has-mega-menu.mobile-open > .mega-dropdown {
        max-height: 1000px;
        padding: 10px 0;
    }
    
    .mega-dropdown li {
        width: 100%;
    }
    
    .mega-dropdown a {
        padding: 10px 30px;
        font-size: 13px;
    }
    
    .MainMenu .custom-mega-menu > li.current-menu-item > a::after,
    .MainMenu .sf-menu > li.current-menu-item > a::after {
        display: none;
    }
    
    /* Mobile overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 768px) {
    .MainMenu .custom-mega-menu,
    .MainMenu .sf-menu {
        width: 280px;
    }
}

/* ===================================
   HEADER FIXED STATE
   =================================== */

header.fixed .mega-dropdown {
    padding: 21px;
}

/* ===================================
   ACCESSIBILITY
   =================================== */

.custom-mega-menu a:focus,
.mobile-menu-toggle:focus {
    outline: 2px solid #2697c1;
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #2697c1;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}
