/**
 * Kloagger Menu Styles
 * Version: 1.0.0
 * Based on kloagger.dk dropdown menu structure
 */

/* ===========================
   Main Container & Reset
   =========================== */

/* Container for inline hamburger and dropdown */
.kloagger-menu-wrapper {
    position: relative;
    display: inline-block;
}

/* ===========================
   Level 1 - Main Menu (Two Column Layout)
   =========================== */

.DropdownMenu ul.level1 {
    display: block;
    list-style: none;
    margin: 0;
    padding: 20px 30px 30px;
}

.DropdownMenu ul.level1 > li {
    position: relative;
    margin: 0;
    padding: 0;
}

.DropdownMenu ul.level1 > li > a {
    display: block;
    padding: 12px 0;
    text-decoration: none;
    color: #ffffff;
    font-size: 15px;
    font-weight: 400;
    transition: all 0.3s ease;
    position: relative;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.DropdownMenu ul.level1 > li > a:hover,
.DropdownMenu ul.level1 > li > a:focus {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.3);
}

/* Current menu item - only active link gets green */
.DropdownMenu ul.level1 > li.current-menu-item > a,
.DropdownMenu ul.level1 > li.current-menu-ancestor > a {
    color: #9ACD32;
    border-bottom-color: #9ACD32;
    font-weight: 400;
}

/* ===========================
   Dropdown Indicators
   =========================== */

/* Remove theme's default arrows/icons */
.DropdownMenu .menu-item-has-children > a::after,
.DropdownMenu .menu-item-has-children > a::before,
.DropdownMenu .has-dropdown > a::after,
.DropdownMenu .has-dropdown > a::before {
    display: none !important;
    content: none !important;
}

/* Remove Astra theme's dropdown icons */
.DropdownMenu .ast-icon,
.DropdownMenu .icon-arrow,
.DropdownMenu .ast-icon.icon-arrow,
.DropdownMenu span.ast-icon,
.DropdownMenu .dropdown-menu-toggle {
    display: none !important;
}

.DropdownMenu .has-dropdown > a {
    position: relative;
    padding-right: 20px;
}

.DropdownMenu .dropdown-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor;
    transition: transform 0.3s ease;
}

.DropdownMenu li.submenu-open > a .dropdown-indicator {
    transform: translateY(-50%) rotate(180deg);
}

/* ===========================
   Mobile Menu Toggle (Hamburger) - Inline
   =========================== */

.kloagger-menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 15px;
    cursor: pointer;
    position: relative;
    z-index: 1003;
    overflow: visible;
}

.menu-toggle-icon {
    display: flex;
    flex-direction: column;
    width: 30px;
    height: 22px;
    justify-content: space-between;
    position: relative;
    overflow: visible;
}

.menu-toggle-icon span {
    display: block;
    width: 100%;
    height: 2px;
    background-color: #ffffff;
    transition: all 0.3s ease;
    transform-origin: center;
}

.kloagger-menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}

.kloagger-menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.kloagger-menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(3) {
    transform: translateY(-10px) rotate(-45deg);
}

/* ===========================
   No Menu Message
   =========================== */

.kloagger-no-menu {
    padding: 20px;
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    color: #666;
    margin: 0;
}

/* ===========================
   Menu Content (Dropdown from hamburger)
   =========================== */

.kloagger-menu-content {
    position: absolute;
    top: 100%;
    right: 0;
    width: 350px;
    max-height: 0;
    background: #3a3a3a;
    overflow: hidden;
    z-index: 1002;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    margin-top: 5px;
}

.kloagger-menu-content.active {
    max-height: 80vh;
    opacity: 1;
    overflow-y: auto;
}

/* No overlay needed */

/* ===========================
   Submenu Styling
   =========================== */

.DropdownMenu ul.level2 {
    display: none;
    list-style: none;
    margin: 0;
    padding-left: 20px;
}

.DropdownMenu ul.level1 > li.submenu-open > ul.level2 {
    display: block;
}

.DropdownMenu ul.level2 li {
    margin: 0;
    padding: 0;
}

.DropdownMenu ul.level2 li a {
    display: block;
    padding: 10px 0;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.DropdownMenu ul.level2 li a:hover {
    color: rgba(255, 255, 255, 1);
}

.DropdownMenu ul.level2 li.current-menu-item > a {
    color: #9ACD32;
}

/* Level 3 */
.DropdownMenu ul.level3 {
    display: none;
    list-style: none;
    padding-left: 20px;
}

.DropdownMenu ul.level2 > li.submenu-open > ul.level3 {
    display: block;
}

.DropdownMenu ul.level3 li a {
    font-size: 13px;
}

/* ===========================
   Responsive Adjustments - Mobile
   =========================== */

@media (max-width: 768px) {
    /* Right-align wrapper on mobile */
    .kloagger-menu-wrapper {
        display: flex;
        justify-content: flex-end;
        width: 100%;
    }

    /* Full width dropdown on mobile */
    .kloagger-menu-content {
        position: fixed;
        top: 0;
        right: -100%;
        left: auto;
        width: 85%;
        max-width: 400px;
        height: 100vh;
        max-height: 100vh;
        margin-top: 0;
        border-radius: 0;
        transition: right 0.4s ease;
        padding-top: 70px;
    }

    .kloagger-menu-content.active {
        right: 0;
    }

    /* Larger touch targets on mobile */
    .DropdownMenu ul.level1 > li > a {
        padding: 15px 0;
        font-size: 16px;
    }

    .DropdownMenu ul.level1 {
        padding: 20px 25px;
    }

    /* Better submenu spacing on mobile */
    .DropdownMenu ul.level2 {
        padding-left: 15px;
        margin-top: 10px;
    }

    .DropdownMenu ul.level2 li a {
        padding: 12px 0;
        font-size: 15px;
    }

    /* Hamburger positioned fixed on mobile */
    .kloagger-menu-toggle {
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 1003;
        padding: 15px;
    }

    /* Larger hamburger icon on mobile */
    .menu-toggle-icon {
        width: 32px;
        height: 24px;
    }

    .menu-toggle-icon span {
        height: 3px;
    }

    /* Adjust transforms for larger mobile icon */
    .kloagger-menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(1) {
        transform: translateY(10.5px) rotate(45deg);
    }

    .kloagger-menu-toggle[aria-expanded="true"] .menu-toggle-icon span:nth-child(3) {
        transform: translateY(-10.5px) rotate(-45deg);
    }

    /* No overlay on mobile */
}

@media (max-width: 480px) {
    .kloagger-menu-content {
        width: 90%;
    }

    .DropdownMenu ul.level1 {
        padding: 20px;
    }

    .DropdownMenu ul.level1 > li > a {
        font-size: 15px;
    }
}
