/* ===========================
   MOBILE NAV & TOP BAR
   (max-width: 767px)
   =========================== */

@media only screen and (max-width: 767px) {

    /* ===== BODY OVERLAY STATE ===== */
    body.menu-open {
        overflow: hidden;
    }

    body.menu-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 500;
        /* below .navigation (z:1000) */
        pointer-events: none;
        /* overlay is visual only */
    }

    /* ===== MAIN DRAWER PANEL ===== */
    .navigation nav#main-navigation {
        position: fixed;
        top: 71px;
        right: 0;
        left: auto;
        width: 82vw;
        height: calc(100vh - 71px);
        background: #fffdf7;
        padding: 26px 20px 32px;
        display: none;
        /* closed by default */
        flex-direction: column;
        align-items: stretch;
        z-index: 9001;
        box-shadow: -14px 0 38px rgba(15, 23, 42, 0.28);
        overflow-y: auto;
        border-radius: 16px 0 0 0;
    }

    body.menu-open .navigation nav#main-navigation {
        display: flex !important;
    }

    /* ===== TOP-LEVEL ITEMS (Home, Courses, etc.) ===== */
    .navigation nav#main-navigation>.ds-nav-item {
        display: block;
        width: 100%;
        margin: 4px 0;
        padding: 8px 0;
        text-align: left;
        border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    }

    .navigation nav#main-navigation>.ds-nav-item:last-child {
        border-bottom: none;
    }

    .navigation nav#main-navigation>.ds-nav-item>a,
    .navigation nav#main-navigation>.ds-nav-item>.dropdown-label {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        margin-left: 5px;
        font-size: 1.1rem;
        font-weight: 600;
        letter-spacing: 0.02em;
        color: var(--Secondary-Color) !important;
        text-decoration: none;
        padding: 2px 0;
    }

    /* Force Pay Now button text white inside navigation */
    .navigation nav#main-navigation .ds-paynow-btn,
    .navigation nav#main-navigation .ds-paynow-btn:link,
    .navigation nav#main-navigation .ds-paynow-btn:visited,
    .navigation nav#main-navigation .ds-paynow-btn:hover,
    .navigation nav#main-navigation .ds-paynow-btn:focus {
        color: #ffffff !important;
    }

    /* ===== Courses parent: label + big block under it ===== */
    .navigation nav#main-navigation>.ds-nav-item.parent {
        padding-bottom: 0;
        /* submenu handles its own spacing */
        border-bottom: none;
        margin-bottom: 0;
    }

    .navigation nav#main-navigation>.ds-nav-item.parent::after {
        content: "";
        display: block;
        height: 1px;
        background: rgba(148, 163, 184, 0.25);
        margin-top: 10px;
    }

    .navigation nav#main-navigation>.ds-nav-item.parent>.dropdown-label,
    .navigation nav#main-navigation>.ds-nav-item.parent>.dropdown-label a {
        color: var(--Secondary-Color) !important;
        font-family: "Sen", sans-serif !important;
        font-size: 1.1rem !important;
        font-weight: 600 !important;
        letter-spacing: 0.02em;
        margin-left: revert-layer;
    }

    /* Arrow bhi same color me */
    .navigation nav#main-navigation>.ds-nav-item.parent>.dropdown-label .dropdown-arrow path {
        stroke: var(--Secondary-Color) !important;
    }

    /* Arrow rotation when open */
    .navigation .dropdown-label {
        gap: 8px;
    }

    .navigation .dropdown-parent .dropdown-arrow {
        transition: transform 0.2s ease;
    }

    .navigation .dropdown-parent.mobile-open .dropdown-arrow {
        transform: rotate(180deg);
    }

    /* ==============
       MOBILE SUBMENU
       LCPS-STYLE BLOCK
       ============== */

    /* sits directly under "Courses", full width, solid background */

    .navigation .submenu {
        position: static;
        top: auto;
        left: auto;
        transform: none;
        width: 100%;
        display: none;

        /* align with text, no weird inset */
        margin: 8px 0 10px;
        /* just vertical gap */
        padding: 16px 16px 18px;

        background: #e1479f;
        color: #ffffff;
        border-radius: 10px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        box-shadow: 0 16px 32px rgba(15, 23, 42, 0.25);
    }

    /* show when JS adds .mobile-open to parent */
    .navigation .dropdown-parent.mobile-open .submenu {
        display: block !important;
    }

    /* stack all columns vertically */
    .navigation .submenu .row {
        margin: 0;
        display: block;
    }

    .navigation .submenu .submenu-column {
        padding: 0;
        margin-bottom: 18px;
    }

    .navigation .submenu .submenu-column:last-child {
        margin-bottom: 0;
    }

    /* category headings (Undergraduate / Adult Care, etc.) */
    .navigation .submenu-heading {
        font-size: 0.85rem;
        font-weight: 700;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.9);
        margin: 0 0 6px;
    }

    .navigation .submenu-heading::after {
        content: "";
        display: block;
        width: 52px;
        height: 1px;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.7);
        margin-top: 5px;
    }

    /* course list */
    .navigation .submenu ul {
        list-style: none;
        padding: 0;
        margin: 6px 0 0;
    }

    .navigation .submenu ul li {
        padding: 1px 0;
        border-bottom: none;
    }

    .navigation .submenu ul li a,
    .navigation .submenu ul li a:link,
    .navigation .submenu ul li a:visited {
        display: block;
        font-size: 0.96rem;
        font-weight: 600;
        text-decoration: none;
        color: #ffffff;
        padding: 7px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 0;
        position: relative;
        transition:
            background-color 0.16s ease,
            color 0.16s ease,
            transform 0.16s ease;
    }

    .navigation .submenu ul li:last-child a {
        border-bottom: none;
    }

    /* remove small desktop bullet */
    .navigation .submenu ul li a::before {
        content: none;
    }

    .navigation .submenu ul li a:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #ffffff;
        transform: translateX(2px);
    }

    /* ============ HAMBURGER ============ */

    #nav-icon1 {
        width: 25px;
        height: 14px;
        position: relative;
        transform: rotate(0deg);
        transition: 0.5s ease-in-out;
        cursor: pointer;
        margin-left: auto;
        margin-top: auto;
        margin-bottom: auto;
        z-index: 9002;
    }

    #nav-icon1 span {
        display: block;
        position: absolute;
        height: 2px;
        width: 100%;
        background: var(--Primary-Color);
        border-radius: 9px;
        opacity: 1;
        left: 0;
        transform: rotate(0deg);
        transition: 0.25s ease-in-out;
    }

    #nav-icon1 span:nth-child(1) {
        top: 0px;
    }

    #nav-icon1 span:nth-child(2) {
        top: 6px;
    }

    #nav-icon1 span:nth-child(3) {
        top: 12px;
    }

    #nav-icon1.open span:nth-child(1) {
        top: 6px;
        transform: rotate(135deg);
    }

    #nav-icon1.open span:nth-child(2) {
        opacity: 0;
        left: -60px;
    }

    #nav-icon1.open span:nth-child(3) {
        top: 6px;
        transform: rotate(-135deg);
    }

    /* ===== TOP BAR + SOCIAL ICONS ===== */

    .facebook {
        background: url('/images/icons/facebook.png') no-repeat center center;
        background-size: cover;
        width: 30px;
        height: 30px;
        display: inline-block;
    }

    .instagram {
        background: url('/images/icons/instagram.png') no-repeat center center;
        background-size: cover;
        width: 30px;
        height: 30px;
        display: inline-block;
    }

    .tiktok {
        background: url('/images/icons/tiktok.png') no-repeat center center;
        background-size: cover;
        width: 30px;
        height: 30px;
        display: inline-block;
    }

    #top-bar {
        padding: 4px 0;
    }

    #top-bar .topbar-container {
        padding: 4px 10px;
    }

    #top-bar .topbar-container>div:first-child {
        text-align: center;
        font-size: 12px;
        font-weight: 600;
        line-height: 1.3;
    }

    #top-bar .row {
        margin-top: 4px;
    }

    #top-bar .row .col-12 {
        display: flex;
        justify-content: center !important;
        align-items: center;
    }

    #top-bar .contact-icons {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding-right: 0;
    }

    #top-bar .contact-icons a {
        padding: 0 4px;
    }

    #top-bar .icon-white {
        width: 18px;
        height: 18px;
        filter: invert(1);
    }

    #top-bar .contact-link .contact-text {
        display: none;
    }

    form.default .row {
        margin-top: 0;
    }

    /* ENROL dropdown base (desktop) */
    .enrol-submenu {
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        width: 360px;
        background: #fff;
        border: 1px solid rgba(15, 23, 42, .12);
        border-radius: 14px;
        box-shadow: 0 12px 30px rgba(2, 6, 23, .18);
        display: none;
        z-index: 9999;
    }

    .enrol-submenu.open {
        display: block;
    }

    /* Mobile menu fix */
    @media (max-width: 768px) {

        /* Button alignment inside mobile menu */
        .ds-enrol-item {
            margin-left: 0 !important;
            width: 100%;
        }

        .ds-enrol-btn {
            width: 100%;
            justify-content: center;
        }

        /* Dropdown should NOT be absolute in mobile menu */
        .enrol-submenu {
            position: static !important;
            width: 100% !important;
            margin-top: 10px;
            box-shadow: 0 10px 22px rgba(2, 6, 23, .14);
        }

        .enrol-submenu-inner {
            padding: 12px;
        }

        /* Results scroll inside, not outside screen */
        .enrol-results {
            max-height: 220px;
            overflow: auto;
        }
    }
}

/* ===========================
   MOBILE ACCORDION SKILLS MENU (PREMIUM)
   (Inside @media max-width: 767px logic mostly, or global override)
   =========================== */

@media only screen and (max-width: 991px) {

    /* Main Mobile Dropdown Container */
    .navigation nav#main-navigation .submenu.mega-menu {
        max-height: 75vh !important;
        /* Requested: 75vh */
        overflow-y: auto !important;
        background: #fff;
        /* White background for clean look */
        padding: 0 !important;
        margin-top: 10px;
        border-radius: 8px;
        width: 100% !important;
        left: 0 !important;
        transform: none !important;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }

    /* Reset Desktop Panel Styles */
    .mega-menu-inner {
        padding: 0 !important;
        background: transparent !important;
        border-radius: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        box-shadow: none !important;
        border: none !important;
    }

    .mega-section {
        padding: 0 !important;
        border-bottom: 1px solid #f1f5f9;
    }

    /* Header Row (Flex) */
    .mobile-cat-header {
        padding: 16px 20px;
        /* Tappable area */
        cursor: pointer;
        background: #fff;
    }

    /* Active State (Optional) */
    .mobile-cat-header[aria-expanded="true"] {
        background: #f8fafc;
    }

    .submenu-heading-wrapper {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .submenu-heading {
        margin-bottom: 0;
        padding-bottom: 0;
        gap: 10px;
        display: flex;
        align-items: center;
    }

    /* Icon on mobile */
    .category-icon {
        color: var(--Primary-Color, #E1479F) !important;
        font-size: 16px;
        width: 24px;
        text-align: center;
    }

    .submenu-heading-link {
        color: #0f172a !important;
        font-size: 15px;
        font-weight: 600;
        text-transform: capitalize;
    }

    /* Mobile Chevron Rotation */
    .mobile-chevron {
        color: #cbd5e1;
        transition: transform 0.3s ease;
        font-size: 12px;
    }

    .mobile-cat-header[aria-expanded="true"] .mobile-chevron {
        transform: rotate(180deg);
        color: var(--Primary-Color, #E1479F);
    }

    /* Hide count badge on mobile */
    .course-count-badge {
        display: none;
    }

    /* Collapsible Content */
    .mobile-cat-collapse .mega-menu-list {
        padding: 10px 20px 20px 20px !important;
        margin-top: 0;
        background: #f8fafc;
        /* Subtle offset for expanded area */
    }

    /* Mobile Link Styling */
    .mega-menu-list .submenu-link {
        padding: 10px 0;
        color: #475569;
        font-size: 14px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.03);
        /* Separator */
        border-radius: 0;
        display: block;
        /* Full width */
        margin-bottom: 0;
    }

    .mega-menu-list li:last-child .submenu-link {
        border-bottom: none;
    }

    .mega-menu-list .submenu-link:hover {
        background: transparent;
        color: var(--Primary-Color, #E1479F);
        transform: none;
        padding-left: 5px;
        /* Slight nudge */
        box-shadow: none;
    }

    /* Hide circle background on mobile */
    .link-icon-circle {
        background: transparent;
        width: 20px;
        height: auto;
        justify-content: flex-start;
        display: none;
        /* Hide icon entirely for clean list? Or keep? Request says "View more must navigate... mobile show in accordion". Let's keep simpler clean list. */
    }

    /* Let's keep the icon but simplify */
    .mega-menu-list .submenu-link .link-icon-circle {
        display: inline-flex;
        width: 20px;
        color: #cbd5e1;
    }

    /* Mobile View More Link */
    .view-more-link {
        display: block;
        margin-left: 0;
        padding: 12px 0 0 0;
        font-size: 14px;
        border-top: 1px dashed #e2e8f0;
        margin-top: 8px;
    }
}