@media (max-width: 991.98px) {
    .topbar {
        display: none !important;
    }
    .topbar-mobile {
        display: block !important;
    }
    
    .mega-menu-wrapper {
        display: none !important;
    }
    
    .mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 10px 15px;
        min-height: 70px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .navbar-collapse {
        display: none !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
}

.topbar-mobile {
    background: linear-gradient(135deg, var(--dark-blue) 0%, var(--primary-blue) 100%);
    color: white;
    padding: 10px 0;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (min-width: 992px) {
    .mobile-only {
        display: none !important;
    }
    
    .mobile-header {
        display: none !important;
    }
    
    .topbar-mobile {
        display: none !important;
    }
    
    .topbar {
        display: block !important;
    }
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100vw;
    height: 100vh;
    background: #275ca5;
    z-index: 1100;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-sidebar.active {
    left: 0;
}

.mobile-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1099;
    display: none;
    backdrop-filter: blur(2px);
}

.mobile-backdrop.active {
    display: block;
}

.sidebar-header {
    padding: 15px 20px;
    background: #18427C;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 70px;
    flex-shrink: 0;
}

.sidebar-header .back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .title {
    color: white;
    font-size: 18px;
    font-weight: 600;
    margin: 0 auto;
    text-align: center;
}

.sidebar-logo {
    height: 35px;
}

.close-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #18427C;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #FFFFFF1A;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #FFFFFF8A;
    border-radius: 3px;
}

.sidebar-content {
    scrollbar-width: thin;
    scrollbar-color: #FFFFFF8A #FFFFFF1A;
}

.menu-level {
    display: none;
    animation: slideIn 0.3s ease;
}

.menu-level.active {
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

.grade-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.grade-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.grade-link:hover {
    color: #c2ee57;
    padding-left: 10px;
}

.grade-link i {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
}

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

.subject-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.subject-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: white;
    position: relative;
}

.subject-name {
    font-weight: 600;
    font-size: 17px;
}

.subject-icon {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.subject-header:not(.expanded) .subject-icon .fa-chevron-down {
    display: none;
}

.subject-header:not(.expanded) .subject-icon .fa-chevron-right {
    display: block;
}

.subject-header.expanded .subject-icon .fa-chevron-down {
    display: block;
    transform: rotate(0deg);
}

.subject-header.expanded .subject-icon .fa-chevron-right {
    display: none;
}

.subject-header.expanded .subject-icon {
    color: #c2ee57;
}

.topic-list-container {
    display: none;
    padding-left: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.topic-list-container.expanded {
    display: block;
}

.mobile-topic-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    max-height: 250px;
    overflow-y: auto;
    border-radius: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
}

.mobile-topic-list::-webkit-scrollbar {
    width: 4px;
}

.mobile-topic-list::-webkit-scrollbar-track {
    background: #FFFFFF1A;
    border-radius: 2px;
}

.mobile-topic-list::-webkit-scrollbar-thumb {
    background: #FFFFFF8A;
    border-radius: 2px;
}

.mobile-topic-list {
    scrollbar-width: thin;
    scrollbar-color: #FFFFFF8A #FFFFFF1A;
}

.mobile-topic-list li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-topic-list li:last-child {
    border-bottom: none;
}

.mobile-topic-list li a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    display: block;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.2s ease;
}

.mobile-topic-list li a:hover {
    background: rgba(194, 238, 87, 0.1);
    color: #c2ee57;
    padding-left: 16px;
}

.sidebar-social {
    margin-top: 20px;
}

.sidebar-social h6 {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-social-links {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.sidebar-social-icon {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.1);
    color: white !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    font-size: 18px;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-social-icon:hover {
    background: #c2ee57;
    color: #18427C !important;
    transform: translateY(-3px) scale(1.1);
    border-color: #c2ee57;
}

.sidebar-footer {
    padding: 20px;
    background: #18427C;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-download-btn {
    width: 260px;
    height: 55px;
    background: #c2ee57;
    box-shadow: 0px 2.92px 0px #6ec63d;
    border-radius: 33px;
    font-weight: 700;
    color: #18427C !important;
    padding: 12px 28px;
    transition: all 0.3s ease;
    border: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    margin: 0 auto;
    margin-top: 30px;
}

.sidebar-download-btn:hover {
    background: #c2ee57;
    color: #18427C !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(194, 238, 87, 0.4);
}

.sidebar-download-btn i {
    font-size: 18px;
    margin-right: 12px;
}

.mobile-header button.navbar-toggler {
    border: 0;
    background: transparent;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-header .mobile-download-btn {
    width: 100px;
    height: 40px;
    background: #c2ee57;
    box-shadow: 0px 2px 0px #6ec63d;
    border-radius: 25px;
    font-weight: 700;
    font-size: 16px;
    color: #275CA5 !important;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 15px;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.mobile-header .mobile-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(194, 238, 87, 0.3);
}

.mdcat-item .grade-link i {
    display: none;
}

.subject-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 18px;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
}

.subject-link:hover {
    color: #c2ee57;
    padding-left: 10px;
}

.back-link {
    display: none;
}

.grade-section {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 15px;
}

.grade-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    color: white;
    padding: 0;
    cursor: pointer;
}

.grade-section-title {
    font-weight: 600;
    font-size: 17px;
}

.grade-section-header:not(.expanded) .section-icon .fa-chevron-down {
    display: none;
}

.grade-section-header:not(.expanded) .section-icon .fa-chevron-right {
    display: block;
}

.grade-section-header.expanded .section-icon .fa-chevron-down {
    display: block;
}

.grade-section-header.expanded .section-icon .fa-chevron-right {
    display: none;
}

.grade-section-header.expanded .section-icon {
    color: #c2ee57;
}

.section-icon {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.grade-section-content {
    display: none;
    margin-top: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.grade-section-content.expanded {
    display: block;
}

.page-title {
    color: white;
    margin-bottom: 25px;
    font-weight: 600;
    font-size: 22px;
    text-align: center;
}

.topbar-mobile {
    background: #18427C;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar-mobile .container {
    padding: 0 15px;
}

.topbar-mobile .topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.topbar-mobile .quick-links {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-right: 10px;
}

.topbar-mobile .quick-links::-webkit-scrollbar {
    display: none;
}

.topbar-mobile .quick-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 0;
    transition: color 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-mobile .quick-links a:hover {
    color: #c2ee57;
}

.topbar-mobile .divider {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    flex-shrink: 0;
}

.login-btn-mobile {
    background: #c2ee57 !important;
    color: #18427C !important;
    border-radius: 33px;
    padding: 8px 20px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    border: none !important;
    transition: all 0.3s ease !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    box-shadow: 0px 2.92px 0px #6ec63d !important;
}

.login-btn-mobile:hover {
    background: #c2ee57 !important;
    color: #18427C !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 25px rgba(194, 238, 87, 0.4) !important;
}

.login-btn-mobile i {
    font-size: 14px !important;
}

.mobile-header {
    margin-top: 0;
    position: relative;
    z-index: 100;
}

@media (max-width: 576px) {
    .topbar-mobile .quick-links {
        gap: 8px;
    }
    
    .topbar-mobile .quick-links a {
        font-size: 12px;
    }
    
    .login-btn-mobile {
        padding: 7px 16px !important;
        font-size: 13px !important;
    }
    
    .topbar-mobile .container {
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .login-btn-mobile {
        padding: 6px 14px !important;
        font-size: 12px !important;
    }
    
    .login-btn-mobile i {
        font-size: 12px !important;
    }
    
    .topbar-mobile .quick-links a {
        font-size: 11px;
    }
    
    .topbar-mobile .divider {
        font-size: 10px;
    }
}