/* Mobile Menu Fix - Bootstrap Native Implementation */
/* Modern topbar + topnav tuning */
html[data-layout=topnav] .app-topbar {
    background: linear-gradient(to right, #7a1fa2 0%, #4b1769 45%, #000 100%);
    border-bottom: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

html[data-layout=topnav] .logo-topbar {
    display: block !important;
    padding: 0.35rem 0.75rem;
}

html[data-layout=topnav] .logo-topbar .logo-light .logo-lg img,
html[data-layout=topnav] .logo-topbar .logo-light .logo-sm img {
    width: auto;
    object-fit: contain;
}

html[data-layout=topnav] .logo-topbar .logo-light .logo-lg img {
    height: 32px;
}

html[data-layout=topnav] .logo-topbar .logo-light .logo-sm img {
    height: 28px;
}

html[data-layout=topnav] .topnav {
    background: linear-gradient(to right, #7a1fa2 0%, #4b1769 45%, #000 100%);
    backdrop-filter: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

html[data-layout=topnav] .topnav .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.88);
    border-radius: 12px;
    margin: 0.25rem 0.2rem;
    transition: all 0.2s ease;
}

html[data-layout=topnav] .topnav .navbar-nav .nav-link:hover,
html[data-layout=topnav] .topnav .navbar-nav .nav-link.active {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

/* Keep first menu item aligned with others (Pendidikan) */
@media (min-width: 992px) {
    html[data-layout=topnav] .topnav .navbar-nav.me-auto .nav-item:first-of-type .nav-link {
        padding-left: calc(var(--ins-sidenav-item-padding-x) * 1.5) !important;
    }
}

html[data-layout=topnav] #yearFilterDropdown {
    border-radius: 999px;
    border: 1px solid rgba(15, 37, 69, 0.12);
    background: #ffffff;
    color: #000 !important;
}

html[data-layout=topnav] #yearFilterDropdown i,
html[data-layout=topnav] #yearFilterDropdown span {
    color: #000 !important;
}

html[data-layout=topnav] .navbar-nav.ms-auto .dropdown-menu .dropdown-item {
    color: #000;
}

@media (max-width: 375px) {
    html[data-layout=topnav] .logo-topbar {
        display: block !important;
    }
}

/* Ensure navbar toggler is visible on mobile */
@media (max-width: 991.98px) {
    .navbar-toggler,
    .navbar-toggle {
        display: block !important;
        border: 1px solid rgba(255, 255, 255, 0.3);
        padding: 0.5rem 0.75rem;
    }

    .navbar-toggler-icon {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
    }

    /* Collapsed menu styling */
    .navbar-collapse {
        background-color: #fff;
        border-radius: 0.25rem;
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        margin-top: 0.5rem;
        padding: 1rem;
    }

    /* Menu items in mobile */
    .navbar-nav .nav-item {
        border-bottom: 1px solid #f0f0f0;
    }

    .navbar-nav .nav-item:last-child {
        border-bottom: none;
    }

    .navbar-nav .nav-link {
        color: #333 !important;
        padding: 0.75rem 1rem !important;
        display: flex;
        align-items: center;
    }

    .navbar-nav .nav-link:hover {
        background-color: #f8f9fa;
        border-radius: 0.25rem;
    }

    .navbar-nav .nav-link i {
        margin-right: 0.5rem;
    }

    /* Year filter in mobile */
    .navbar-nav.ms-auto {
        margin-top: 1rem !important;
        padding-top: 1rem;
        border-top: 2px solid #e9ecef;
    }

    .navbar-nav.ms-auto .dropdown-menu {
        position: static !important;
        transform: none !important;
        width: 100%;
        margin-top: 0.5rem;
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    .navbar-nav.ms-auto .nav-link {
        background-color: #f8f9fa;
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
        justify-content: space-between;
    }
}

/* Desktop - hide toggler */
@media (min-width: 992px) {
    .navbar-toggler,
    .navbar-toggle {
        display: none !important;
    }
}

/* Touch-friendly targets */
@media (max-width: 991.98px) {
    .nav-link,
    .dropdown-item,
    .navbar-toggler,
    .navbar-toggle {
        min-height: 44px;
    }
}

/* Topnav collapse behavior fix on mobile */
@media (max-width: 991.98px) {
    html[data-layout=topnav] .topnav {
        max-height: none;
        overflow: visible;
    }

    html[data-layout=topnav] .topnav .navbar-collapse {
        max-height: calc(100vh - 140px);
        overflow-y: auto;
        overflow-x: hidden;
    }

    html[data-layout=topnav] .app-topbar {
        padding: 0.35rem 0.5rem;
    }

    html[data-layout=topnav] .topnav .navbar {
        padding: 0.35rem 0.5rem;
    }

    html[data-layout=topnav] .topnav .navbar-nav .nav-link {
        margin: 0.15rem 0;
        border-radius: 10px;
    }
}
