/* ============================================
   TEKQUORA LMS - TOP NAVBAR / STICKY HEADER CSS
   ============================================ */

body .header_area,
body header,
body .aoraeditor-header,
body .aoraeditor-skip {
    transform: none;
    perspective: none;
    filter: none;
}

.aoraeditor-header.aoraeditor-skip:first-child {
    margin: 0 !important;
    padding: 0 !important;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000 !important;
    width: 100%;
    background: #ffffff;
}

.header_area,
header {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    background: #ffffff;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    z-index: 10000 !important;
}

.header_area {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

body {
    padding-top: 88px;
}

html,
body {
    overflow-x: hidden;
    position: relative;
}

.aoraeditor-header,
.aoraeditor-skip {
    overflow: visible !important;
}

#sticky-header {
    width: 100%;
    background: #ffffff;
}

.header_area .header__wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 18px;
    gap: 14px;
}

.header_area .header__left {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 14px;
}

.header_area .logo_img {
    flex: 0 0 auto;
}

.header_area .logo_img img {
    height: 52px;
    width: auto;
    display: block;
    object-fit: contain;
}

.header_area .category_search {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

.header-search-form {
    flex: 1 1 auto;
    min-width: 0;
}

.categories_menu {
    background: #f8f9fa !important;
    border: 1px solid #dbe2ea !important;
    border-radius: 30px !important;
    padding: 10px 16px !important;
    color: #1e3a8a !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.categories_menu:hover {
    background: #1e3a8a !important;
    color: #ffffff !important;
}

.theme_search_field {
    background: #f8f9fa !important;
    border: 1px solid #dbe2ea !important;
    border-radius: 30px !important;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 220px;
    max-width: 430px;
}

.theme_search_field .btn {
    background: transparent !important;
    color: #6c757d !important;
    border: none !important;
    padding: 10px 14px !important;
}

.theme_search_field .form-control {
    background: transparent !important;
    border: none !important;
    color: #1e293b !important;
    font-size: 14px !important;
    padding: 10px 14px 10px 2px !important;
}

.theme_search_field .form-control:focus {
    box-shadow: none !important;
}

.main_menu {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    min-width: 0;
}

#mobile-menu {
    display: flex;
    align-items: center;
    gap: 14px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
}

#mobile-menu > li {
    white-space: nowrap;
}

#mobile-menu > li > a {
    color: #1e3a8a;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.2;
}

#mobile-menu > li > a:hover {
    color: #f39c12;
}

.header__right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 0 0 auto;
}

.header__right .desktop-only-auth {
    display: flex;
    align-items: center;
}

.theme_btn.small_btn2 {
    background: #1e3a8a;
    color: #ffffff;
    border-radius: 30px;
    padding: 10px 22px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.theme_btn.small_btn2:hover {
    background: #14295f;
}

.mobile_menu_toggle {
    display: none;
    background: transparent;
    border: none;
    color: #1e3a8a;
    font-size: 28px;
    line-height: 1;
    padding: 4px;
    cursor: pointer;
}

.desktop-only-search,
.desktop-only-auth {
    display: flex;
}

.mobile-only-search,
.mobile-only-auth {
    display: none;
}

.mobile-only-auth .mobile-auth-link {
    display: block;
    color: #1e3a8a;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    padding: 11px 0;
    border-bottom: 1px solid #edf1f6;
}

.mobile-only-auth .contact_btn,
.mobile-only-auth .theme_btn.small_btn2 {
    width: 100%;
    text-align: center;
}

@media (max-width: 1399px) {
    .theme_search_field {
        max-width: 360px;
    }

    #mobile-menu {
        gap: 10px;
    }
}

@media (max-width: 1199px) {
    body {
        padding-top: 84px;
    }

    .header_area .header__wrapper {
        padding: 10px 14px;
    }

    .header_area .logo_img img {
        height: 46px;
    }

    .desktop-only-search,
    .header__right .desktop-only-auth {
        display: none !important;
    }

    .mobile_menu_toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .main_menu {
        position: fixed;
        top: 84px;
        right: -100%;
        width: 320px;
        height: calc(100vh - 84px);
        background: #ffffff;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
        border-left: 1px solid #edf1f6;
        z-index: 9999;
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        overflow-y: auto;
        transition: right 0.25s ease;
    }

    .main_menu.active {
        right: 0;
    }

    .mobile-only-search,
    .mobile-only-auth {
        display: block;
    }

    .mobile-only-search {
        margin-bottom: 12px;
    }

    .mobile-only-auth {
        margin-bottom: 12px;
        padding-bottom: 12px;
        border-bottom: 1px solid #edf1f6;
    }

    .category_search_mobile {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .category_search_mobile form {
        flex: 1 1 auto;
        min-width: 0;
    }

    .category_search_mobile .theme_search_field {
        min-width: 0;
        max-width: 100%;
    }

    #mobile-menu {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    #mobile-menu > li {
        width: 100%;
        border-bottom: 1px solid #edf1f6;
        padding: 0;
    }

    #mobile-menu > li > a {
        display: block;
        width: 100%;
        padding: 12px 0;
    }
}

@media (max-width: 575px) {
    body {
        padding-top: 76px;
    }

    .header_area .header__wrapper {
        padding: 8px 12px;
    }

    .header_area .logo_img img {
        height: 40px;
    }

    .main_menu {
        top: 76px;
        height: calc(100vh - 76px);
        width: 100%;
        padding: 14px;
    }

    .categories_menu {
        padding: 10px 12px !important;
    }
}

/* Additional responsive tweaks for better mobile behavior */
@media (max-width: 991px) {
    /* Make search shrink and truncate text to avoid pushing elements */
    .theme_search_field {
        max-width: 220px;
        min-width: 0;
        flex: 1 1 auto;
    }
    .theme_search_field .form-control {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide desktop-only elements earlier to free space */
    .desktop-only-search,
    .header__right .desktop-only-auth {
        display: none !important;
    }

    /* Show mobile toggler */
    .mobile_menu_toggle {
        display: inline-flex;
    }

    /* Compact profile thumbnail and hide name to save space */
    .header__right .profile_info .studentProfileThumb {
        width: 36px !important;
        height: 36px !important;
    }
    .header__right .profile_info span.ms-2 {
        display: none !important;
    }

    /* Show only icon for categories on smaller screens */
    .categories_menu span {
        display: none;
    }

    /* Slightly reduce logo size */
    .header_area .logo_img img {
        height: 44px;
    }
}

/* Force compact profile container so it doesn't expand with the name */
@media (max-width: 1199px) {
    .header__right .profile_img {
        max-width: 48px !important;
        overflow: hidden !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .header__right .profile_img .studentProfileThumb {
        display: block !important;
        width: 36px !important;
        height: 36px !important;
        border-radius: 50% !important;
    }
    .mobile_menu_toggle {
        z-index: 10005 !important;
    }
}

@media (max-width: 480px) {
    .theme_search_field {
        max-width: 140px;
    }
    .header_area .logo_img img {
        height: 38px;
    }
    .header_area .header__wrapper {
        padding: 6px 10px;
        gap: 8px;
    }
}

/* Prevent avatar and hamburger overlap */
.header_area .header__wrapper {
    align-items: center;
}

.header__right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.header__right .profile_info {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 160px;
    overflow: hidden;
}

.header__right .profile_info .studentProfileThumb {
    flex: 0 0 auto;
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
}

.header__right .profile_info span.ms-2 {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.mobile_menu_toggle {
    z-index: 9999;
    margin-left: 6px;
    flex: 0 0 auto;
}

@media (max-width: 991px) {
    /* On smaller screens: hide the name and keep compact avatar */
    .header__right .profile_info span.ms-2 {
        display: none !important;
    }
    .header__right .profile_info {
        max-width: 48px;
    }
    .header__right .profile_info .studentProfileThumb {
        width: 36px !important;
        height: 36px !important;
    }
}

/* Extra safeguard: fully hide any profile/avatar remnants on mobile to prevent overlap */
@media (max-width: 1199px) {
    .header__right .profile_info,
    .header__right .studentProfileThumb,
    .header__right .profile_img {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* keep the mobile toggler visible and above other elements */
    .mobile_menu_toggle {
        display: inline-flex !important;
        position: relative !important;
        z-index: 10001 !important;
        margin-left: 6px !important;
    }

    /* ensure header right area doesn't push into the toggler */
    .header__right {
        min-width: 0 !important;
        gap: 6px !important;
    }
}

/* Layout override: place collapse toggle on left and profile on right for mobile */
@media (max-width: 1199px) {
    .header_area .header__wrapper {
        position: relative;
        padding-left: 64px; /* space for left collapse */
        padding-right: 64px; /* space for right profile */
    }

    .mobile_menu_toggle {
        position: absolute !important;
        left: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        z-index: 10002 !important;
        display: inline-flex !important;
        margin-left: 0 !important;
    }

    /* Show compact profile on right edge */
    .header__right {
        position: absolute !important;
        right: 12px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }

    /* Center the left area (logo) so logo remains centered between toggle and profile */
    .header__left {
        justify-content: center !important;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Ensure desktop-only auth section is visible (compact) on mobile */
    .header__right .desktop-only-auth {
        display: flex !important;
        align-items: center !important;
    }

    .header__right .profile_info,
    .header__right .studentProfileThumb,
    .header__right .profile_img {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .header__right .profile_info .studentProfileThumb {
        width: 36px !important;
        height: 36px !important;
    }

    .header__right .profile_info span.ms-2 {
        display: none !important;
    }

    /* Move category and search into collapse by hiding desktop variants */
    .desktop-only-search { display: none !important; }
    .categories_menu { display: none !important; }
}

/* Make sure any dropdown ULs inside the mobile panel render statically (no absolute overlays) */
@media (max-width: 1199px) {
    .main_menu .menu_dropdown,
    .main_menu .menu_dropdown > ul,
    .main_menu .menu_dropdown ul,
    .main_menu .menu_dropdown ul ul {
        position: static !important;
        left: auto !important;
        top: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: transparent !important;
        box-shadow: none !important;
        width: 100% !important;
    }

    .main_menu .menu_dropdown > ul {
        padding-left: 0 !important;
        margin: 0 0 12px 0 !important;
    }

    .main_menu .menu_dropdown > ul li a {
        padding-left: 8px !important;
    }
}

/* Ensure category dropdown and search render statically inside the mobile collapsed menu */
@media (max-width: 1199px) {
    /* Show mobile menu's category dropdown as normal list inside the panel */
    .main_menu .category_search_mobile .menu_dropdown {
        display: block !important;
        position: relative !important;
    }

    .main_menu .category_search_mobile .menu_dropdown > ul {
        position: static !important;
        top: auto !important;
        left: auto !important;
        opacity: 1 !important;
        visibility: visible !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 0 12px 0 !important;
        width: 100% !important;
        z-index: auto !important;
    }

    .main_menu .category_search_mobile .menu_dropdown > ul:after {
        display: none !important;
    }

    .main_menu .category_search_mobile .menu_dropdown > ul li a {
        color: #1e293b !important;
        padding: 10px 0 !important;
        display: block !important;
        border-right: none !important;
        white-space: normal !important;
    }

    /* Make search expand full width inside collapsed menu */
    .main_menu .category_search_mobile .theme_search_field,
    .main_menu .mobile-only-search .theme_search_field {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* Remove mega-dropdown inner panels on mobile to avoid large overlays */
    .main_menu .menu_dropdown .menu_dropdown_iner,
    .main_menu .menu_dropdown .mega_menu_dropdown .menu_dropdown_iner {
        display: none !important;
        position: static !important;
        box-shadow: none !important;
        background: transparent !important;
        width: 100% !important;
    }
}