/**
 * Mobile Navigation Styles
 * Simple, Clean Design
 * CREST Olympiads
 */

:root {
    --navy: #0F5A7E;
    --navy-light: #1A7BA8;
    --navy-dark: #0A4560;
    --text-dark: #212121;
    --text-medium: #616161;
    --text-light: #9E9E9E;
    --bg-light: #FAFAFA;
    --border-color: #EEEEEE;
    --transition: 0.2s ease;
}

/* ===================================
   HAMBURGER BUTTON - Clean, no background
   =================================== */
button.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    background: none;
    background-color: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    outline: none;
    cursor: pointer;
    z-index: 1001;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

button.mobile-menu-btn:hover,
button.mobile-menu-btn:focus,
button.mobile-menu-btn:active {
    background: none;
    background-color: transparent;
    border: none;
    box-shadow: none;
    outline: none;
}

.navbar-header {
    position: relative;
    display: flex;
    align-items: center;
}

button.mobile-menu-btn .hamburger-icon {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--navy);
    position: relative;
}

button.mobile-menu-btn .hamburger-icon::before,
button.mobile-menu-btn .hamburger-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    background: var(--navy);
}

button.mobile-menu-btn .hamburger-icon::before { top: -6px; }
button.mobile-menu-btn .hamburger-icon::after { top: 6px; }

/* ===================================
   FULL-SCREEN MENU
   =================================== */
.mobile-fullscreen-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: #fff;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-fullscreen-menu,
.mobile-fullscreen-menu * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.mobile-fullscreen-menu ul,
.mobile-fullscreen-menu li {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-fullscreen-menu a,
.mobile-fullscreen-menu button {
    text-decoration: none;
    outline: none;
}

.mobile-fullscreen-menu.open {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   HEADER - Simple white bar
   =================================== */
.mobile-fullscreen-menu .mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #fff;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-fullscreen-menu .mobile-menu-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: 0.5px;
}

.mobile-fullscreen-menu .mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Hide auth buttons in menu header - they're in navbar */
.mobile-fullscreen-menu .mobile-header-btn {
    display: none;
}

/* Close Button - Simple X */
.mobile-fullscreen-menu .mobile-menu-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-light);
    border: none;
    border-radius: 50%;
    color: var(--text-medium);
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
}

/* ===================================
   MENU LIST - Compact
   =================================== */
.mobile-fullscreen-menu .mobile-menu-items {
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Section Headers */
.mobile-fullscreen-menu .mobile-menu-section-header {
    display: block;
    width: 100%;
    padding: 12px 16px 6px;
    margin: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    background: #fff;
    border: none;
}

/* Menu Items - Compact, full width */
.mobile-fullscreen-menu .mobile-menu-item {
    display: block;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    padding: 0;
}

.mobile-fullscreen-menu .mobile-menu-item:last-child {
    border-bottom: none;
}

.mobile-fullscreen-menu .mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin: 0;
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    background: #fff;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    min-height: 0;
    height: auto;
    line-height: 1.4;
    pointer-events: auto;
    position: relative;
    z-index: 1;
}

/* Ensure anchor links are clickable */
a.mobile-menu-link {
    text-decoration: none;
    color: inherit;
}

/* Ensure buttons are clickable */
button.mobile-menu-link {
    -webkit-appearance: none;
    appearance: none;
}

.mobile-fullscreen-menu .mobile-menu-link:active {
    background: var(--bg-light);
}

/* Hide icons */
.mobile-fullscreen-menu .menu-icon {
    display: none;
}

/* Menu link text */
.mobile-fullscreen-menu .mobile-menu-link > span:not(.arrow) {
    flex: 1;
}

/* Arrow */
.mobile-fullscreen-menu .mobile-menu-link .arrow {
    font-size: 10px;
    color: var(--text-light);
    margin-left: auto;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.mobile-fullscreen-menu .mobile-menu-link[aria-expanded="true"] {
    color: var(--navy);
    font-weight: 600;
}

.mobile-fullscreen-menu .mobile-menu-link[aria-expanded="true"] .arrow {
    transform: rotate(180deg);
    color: var(--navy);
}

/* ===================================
   SUBMENU - Compact
   =================================== */
.mobile-fullscreen-menu .mobile-submenu {
    max-height: 0;
    overflow: hidden;
    background: var(--bg-light);
    transition: max-height 0.25s ease;
    width: 100%;
}

.mobile-fullscreen-menu .mobile-submenu.open {
    max-height: 2000px;
}

.mobile-fullscreen-menu .mobile-submenu .mobile-menu-item {
    display: block;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    padding: 0;
}

.mobile-fullscreen-menu .mobile-submenu .mobile-menu-item:last-child {
    border-bottom: none;
}

.mobile-fullscreen-menu .mobile-submenu .mobile-menu-link {
    display: block;
    width: 100%;
    padding: 10px 16px 10px 28px;
    margin: 0;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-medium);
    background: var(--bg-light);
    min-height: 0;
    height: auto;
    line-height: 1.4;
}

.mobile-fullscreen-menu .mobile-submenu .mobile-menu-link::before {
    display: none;
}

.mobile-fullscreen-menu .mobile-submenu .mobile-menu-link:active {
    background: #EEEEEE;
    color: var(--navy);
}

/* Nested submenu (2nd level) */
.mobile-fullscreen-menu .mobile-submenu-nested {
    background: #fff;
}

.mobile-fullscreen-menu .mobile-submenu-nested .mobile-menu-link {
    padding-left: 44px;
    font-size: 12px;
    background: #fff;
}

.mobile-fullscreen-menu .mobile-submenu-nested .mobile-menu-link:active {
    background: var(--bg-light);
}

/* Submenu toggle button inside submenu */
.mobile-fullscreen-menu .mobile-submenu > .mobile-menu-item > button.mobile-menu-link {
    background: var(--bg-light);
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 992px) {
    button.mobile-menu-btn {
        display: flex;
    }
    #crest-navbar-collapsible {
        display: none;
    }
}

@media (max-width: 768px) {
    /* Show compact Register/Login buttons in navbar */
    .navbar-right.registration {
        display: flex;
        align-items: center;
        gap: 6px;
        position: absolute;
        right: 58px;
        top: 50%;
        transform: translateY(-50%);
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .navbar-right.registration > li {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .navbar-right.registration > li.dropdown > .dropdown-menu {
        display: none;
    }

    .navbar-right.registration > li.dropdown > .btn,
    .navbar-right.registration > li > a.btn-subscribe {
        padding: 6px 10px;
        font-size: 11px;
        font-weight: 600;
        background: var(--navy);
        color: #fff;
        border: none;
        border-radius: 16px;
        min-height: auto;
        height: auto;
        line-height: 1.3;
        box-shadow: none;
        text-transform: none;
        text-decoration: none;
    }

    .navbar-right.registration > li > a:not(.btn-subscribe) {
        padding: 6px 10px;
        font-size: 11px;
        font-weight: 600;
        color: var(--navy);
        background: #fff;
        border: 1.5px solid var(--navy);
        border-radius: 16px;
        white-space: nowrap;
        text-decoration: none;
    }

}

/* Extra small screens */
@media (max-width: 400px) {
    .navbar-right.registration {
        right: 54px;
        gap: 4px;
    }

    .navbar-right.registration > li.dropdown > .btn,
    .navbar-right.registration > li > a.btn-subscribe,
    .navbar-right.registration > li > a:not(.btn-subscribe) {
        padding: 5px 8px;
        font-size: 10px;
    }
}

/* ===================================
   UTILITY
   =================================== */
.body-no-scroll {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

@media (prefers-reduced-motion: reduce) {
    .mobile-fullscreen-menu,
    .mobile-submenu {
        transition: none;
    }
}
