.main-nav {
    display: flex;
    align-items: center;
}

/* nav_panel is mobile-only — hidden on desktop */
.nav_panel {
    display: none;
}


.nav-list {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 5px;
}

.nav-list > li {
    position: relative;
}

.nav-list > li > a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    color: var(--text-white);
    font-weight: 500;
    font-size: 16px;
    transition: var(--transition);
    border-radius: 4px;
}

@media (min-width: 1251px) {
    .nav-list > li > a {
        font-size: 18px;
    }
}

.nav-list > li > a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-white);
}


/* Level 1 dropdown — hidden by default, shown on hover */
.drop_level2_wrapper {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-white);
    min-width: 240px;
    box-shadow: var(--shadow-lg);
    border-radius: 6px;
    padding: 10px 0;
    z-index: 100;
}

.nav-list > li.has-dropdown:hover > .drop_level2_wrapper {
    display: block;
}

/* Last two nav items open to the left */
.nav-list > li.last-item > .drop_level2_wrapper,
.nav-list > li.second-last-item > .drop_level2_wrapper {
    left: auto;
    right: 0;
}

.drop_level2_wrapper ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.drop_level2_wrapper li {
    margin: 0;
    list-style: none;
    position: relative;
}

.drop_level2_wrapper a {
    display: block;
    padding: 10px 20px;
    color: var(--text-dark);
    font-size: 1rem;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
}

.drop_level2_wrapper li:hover > a {
    background: var(--secondary-color);
    color: var(--text-on-secondary);
}

/* Arrow indicator for items with level 2 children */
.drop_level2_wrapper a.drop1_haschildren {
    padding-right: 2rem;
    position: relative;
}

.drop_level2_wrapper a.drop1_haschildren::after {
    content: '\203A';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.6rem;
    opacity: 0.6;
    transition: var(--transition);
}

.drop_level2_wrapper li:hover > a.drop1_haschildren::after {
    opacity: 1;
    right: 10px;
}

.nav-list > li.last-item .drop_level2_wrapper a.drop1_haschildren {
    padding-right: 20px;
    padding-left: 2rem;
}

.nav-list > li.last-item .drop_level2_wrapper a.drop1_haschildren::after {
    content: '\2039';
    right: auto;
    left: 14px;
}

/* Level 2 flyout — hidden by default, shown on hover of parent li */
.drop_level2_wrapper li .drop_level2_wrapper {
    display: none;
    position: absolute;
    top: -10px;
    left: 100%;
    z-index: 1;
    border-radius: 6px;
}

.drop_level2_wrapper li:hover > .drop_level2_wrapper {
    display: block;
}

/* Last two items — level 2 flyout opens to the left */
.nav-list > li.last-item .drop_level2_wrapper li .drop_level2_wrapper,
.nav-list > li.second-last-item .drop_level2_wrapper li .drop_level2_wrapper {
    left: auto;
    right: 100%;
}

.nav-list > li.last-item .drop_level2_wrapper a.drop1_haschildren,
.nav-list > li.second-last-item .drop_level2_wrapper a.drop1_haschildren {
    padding-right: 20px;
    padding-left: 2rem;
}

.nav-list > li.last-item .drop_level2_wrapper a.drop1_haschildren::after,
.nav-list > li.second-last-item .drop_level2_wrapper a.drop1_haschildren::after {
    content: '\2039';
    right: auto;
    left: 14px;
}

@media (max-width: 1200px) {
    .desktop-nav {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }

    /* Mobile nav panel */
    .nav_panel {
        display: block;
        position: fixed;
        right: -110%;
        top: 0;
        width: 100vw;
        height: 100%;
        max-height: 100vh;
        transition: all 0.3s;
        z-index: 199;
        background: #ffffff;
        overflow: hidden;
    }

    .nav_panel.open {
        right: 0;
    }

    .nav_panel_content {
        height: 100%;
        max-height: 100vh;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        background: #ffffff;
        display: flex;
        flex-direction: column;
    }

    /* Mobile top row: close button + search */
    .mobile_top_row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20px 25px;
        border-bottom: 1px solid var(--border-color);
    }

    .mobile-menu-close {
        background: none;
        border: none;
        cursor: pointer;
        font-size: 1.4rem;
        color: var(--text-dark);
        padding: 5px;
    }

    .mobile-search-form {
        display: flex;
        align-items: center;
        gap: 8px;
        flex: 1;
        margin-left: 20px;
    }

    .mobile-search-form input {
        flex: 1;
        border: 1px solid var(--border-color);
        border-radius: 4px;
        padding: 8px 12px;
        font-size: 1rem;
    }

    .mobile-search-form button {
        background: var(--primary-color);
        border: none;
        color: #fff;
        padding: 8px 12px;
        border-radius: 4px;
        cursor: pointer;
    }

    /* Nav inside panel */
    .main-nav {
        flex: 1;
        background: #ffffff;
    }

    .nav-list {
        flex-direction: column;
        gap: 0;
        background: #ffffff;
        width: 100%;
    }
    
    .nav-list > li {
        border-bottom: 1px solid var(--border-color);
        background: #ffffff;
        display: flex;
        flex-wrap: wrap;
        align-items: stretch;
    }
    
    .nav-list > li > a {
        padding: 18px 30px;
        border-radius: 0;
        justify-content: space-between;
        color: var(--text-dark) !important;
        text-decoration: none;
    }

    .submenu-arrow-toggle {
        background: none;
        border: none;
        cursor: pointer;
        font-size: 1.2rem;
        color: var(--text-dark);
        padding: 18px 20px;
        line-height: 1;
        opacity: 0.6;
        flex-shrink: 0;
        border-left: 1px solid var(--border-color);
    }

    .submenu-arrow-toggle:hover {
        opacity: 1;
        color: var(--primary-color);
    }

    .nav-list > li > a {
        justify-content: flex-start;
        flex: 1;
    }
    
    .nav-list > li > a:hover {
        background: var(--bg-light);
        color: var(--primary-color) !important;
        text-decoration: none;
    }

    /* Mobile bottom row: utility links */
    .mobile_bottom_row {
        background: var(--primary-color);
        padding: 16px 20px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .mobile_bottom_row a {
        display: block;
        background: var(--secondary-color);
        color: var(--text-on-secondary);
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        padding: 10px 18px;
        border-radius: 4px;
        transition: opacity 0.2s ease;
    }

    .mobile_bottom_row a:hover {
        opacity: 0.85;
        color: var(--text-on-secondary);
    }
    
    .drop_level2_wrapper {
        position: static;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        padding: 0;
        margin: 0;
        background: var(--bg-light);
        display: none;
        border-radius: 0;
        min-width: unset;
    }
    
    .has-dropdown.active > .drop_level2_wrapper {
        display: block;
    }

    .drop_level2_wrapper li .drop_level2_wrapper {
        position: static;
        display: block;
        opacity: 1;
        visibility: visible;
        box-shadow: none;
        padding-left: 15px;
        background: var(--bg-light);
    }

    .drop_level2_wrapper a {
        padding: 15px 30px 15px 50px;
        white-space: normal;
        text-decoration: none;
        color: var(--text-dark) !important;
    }
    
    .drop_level2_wrapper li:hover > a {
        background: rgba(0, 0, 0, 0.05);
        padding-left: 55px;
        text-decoration: none;
    }
    
    .nav-utility-mobile {
        display: flex;
        flex-direction: column;
        border-top: 2px solid var(--border-color);
        margin-top: 10px;
        padding-top: 10px;
    }

    .nav-utility-mobile > li > a {
        padding: 14px 30px;
        font-size: 0.95rem;
        color: var(--text-dark) !important;
        font-weight: 400;
        border-radius: 0;
        justify-content: flex-start;
    }

    .nav-utility-mobile > li > a:hover {
        background: var(--bg-light);
        color: var(--primary-color) !important;
    }

    body.menu-open {
        overflow: hidden;
    }
}


/* ============================================================
   INSIDE PAGE - RIGHT SIDE NAV (#right_within)
   ============================================================ */

#right_within {
    font-family: var(--font-primary);
}

#right_within a {
    text-decoration: none;
    transition: all 0.3s ease-in-out;
}

#right_within ul {
    padding: 0;
    margin: 0;
    list-style: none;
}

#right_within ul li {
    padding: 0 0 0 2rem;
}

#right_within #menu > ul > li {
    border-left: solid 2px var(--border-color);
    padding-bottom: 1rem;
}

#right_within #menu > ul > li > ul {
    padding-top: 0.5rem;
}

#right_within ul ul li a {
    font-size: 1rem;
    font-weight: normal;
    color: var(--text-dark);
}

#right_within ul ul ul li {
    padding: 0 0 0 2rem;
}

#right_within .inside_drop_arrow {
    padding: 0 10px;
    margin-right: -10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

#right_within .inside_drop_arrow svg {
    height: 10px;
    width: auto;
    vertical-align: middle;
    fill: var(--text-dark);
    opacity: 0.6;
    transition: transform 0.3s ease-in-out, fill 0.3s ease-in-out;
}

#right_within .inside_drop_arrow.active svg {
    transform: rotate(90deg);
}

#right_within .inside_lvl1_link_wrapper {
    display: flex;
    align-items: center;
}

#right_within #menu ul > li > a,
#right_within #menu ul > li > .inside_lvl1_link_wrapper > a {
    color: var(--text-dark);
    font-size: 1.125rem;
    font-weight: normal !important;
    position: relative;
}

#right_within #menu ul > li.default > a,
#right_within #menu ul > li.default > .inside_lvl1_link_wrapper > a {
    font-weight: 700 !important;
    color: var(--primary-color);
}

#right_within ul ul li a:hover,
#right_within ul ul li a.ln2_default,
#right_within ul ul li a.ln3_default {
    text-decoration: underline;
    text-decoration-color: var(--secondary-color);
    text-decoration-thickness: 2px;
    text-underline-position: under;
    color: var(--primary-color);
}

#right_within #menu ul > li.default > a::before,
#right_within #menu ul > li.default > .inside_lvl1_link_wrapper > a::before,
#right_within #menu ul > li > a:hover::before,
#right_within #menu ul > li > .inside_lvl1_link_wrapper > a:hover::before {
    content: "";
    position: absolute;
    left: -2rem;
    top: -2px;
    height: 100%;
    width: 6px;
    background: var(--secondary-color);
    display: block;
    transform: translateX(-4px);
}

#right_within ul ul li a::before {
    display: none !important;
}

#right_within .inside_drop_arrow:hover svg,
#right_within .inside_drop_arrow.active svg {
    fill: var(--secondary-color);
    opacity: 1;
}

@media (max-width: 960px) {
    /* Push the menu below sibling sidebar content on mobile.
       Aurora renders #menu and .right_per_detail as siblings inside #right_within
       (which is already display:flex; flex-direction:column;). */
    #right_within #menu,
    #right_within #inside_nav {
        order: 2;
        margin-top: 3rem;
    }
}

@media (min-width: 960px) {
    #right_within #menu + .right_per_detail,
    #right_within #inside_nav + .right_per_detail {
        margin-top: 3rem;
    }
}
