/*
 * Navbar Fix - Ensures navigation bar stays visible when scrolling
 * This file can be included in any page that has navbar visibility issues
 *
 * @package   theme_remui_kids
 * @copyright 2025 Kodeit
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

/* ========================================
   GLOBAL NAVBAR FIX - ALWAYS STICKY
   (Excludes course view pages)
   ======================================== */

/* Make navbar fixed at top with high z-index - NOT on course pages */
body:not(.path-course-view) nav.navbar,
body:not(.path-course-view) .navbar.fixed-top,
body:not(.path-course-view) .navbar-fixed-top,
body:not(.path-course-view) header.navbar,
body:not(.path-course-view) nav[aria-label*="menu"],
body:not(.path-course-view) nav[class*="navbar"] {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 1100 !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
    will-change: transform !important;
    -webkit-backface-visibility: hidden !important;
    backface-visibility: hidden !important;
}

/* Ensure navbar content is visible - NOT on course pages */
body:not(.path-course-view) nav.navbar .navbar-nav,
body:not(.path-course-view) nav.navbar .navbar-brand,
body:not(.path-course-view) nav.navbar .usermenu,
body:not(.path-course-view) nav.navbar .primary-navigation {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Dropdown menus should be above everything - NOT on course pages */
body:not(.path-course-view) .navbar .dropdown-menu,
body:not(.path-course-view) .nav-item .dropdown-menu,
body:not(.path-course-view) .navbar-nav .dropdown-menu {
    z-index: 1200 !important;
}

/* ========================================
   PAGE CONTENT PADDING
   (Excludes course view pages)
   ======================================== */

/* Add proper padding to prevent content from being hidden under fixed navbar - NOT on course pages */
body:not(.path-course-view) {
    padding-top: 0 !important;
}

/* Dashboard pages - no extra padding (override standard padding) - NOT on course pages */
body.path-my:not(.path-course-view) #page-wrapper,
body.path-dashboard:not(.path-course-view) #page-wrapper,
body.has-student-sidebar:not(.path-course-view) #page-wrapper,
body.custom-dashboard-page:not(.path-course-view) #page-wrapper {
    padding-top: 0 !important;
}

body.path-my:not(.path-course-view) #page,
body.path-dashboard:not(.path-course-view) #page,
body.has-student-sidebar:not(.path-course-view) #page,
body.custom-dashboard-page:not(.path-course-view) #page {
    padding-top: 0 !important;
}

body.path-my:not(.path-course-view) .main-inner,
body.path-dashboard:not(.path-course-view) .main-inner,
body.has-student-sidebar:not(.path-course-view) .main-inner,
body.custom-dashboard-page:not(.path-course-view) .main-inner {
    padding-top: 0 !important;
}

/* Middle dashboard - 60px padding - NOT on course pages */
body.middle-dashboard:not(.path-course-view) {
    padding-top: 60px !important;
}

body.middle-dashboard:not(.path-course-view) #page-wrapper,
body.middle-dashboard:not(.path-course-view) #page,
body.middle-dashboard:not(.path-course-view) .main-inner {
    padding-top: 0 !important;
}

body:not(.path-course-view) #page {
    padding-top: 0 !important;
}

body:not(.path-course-view) .main-inner {
    padding-top: 0 !important;
}

/* Ensure page content is visible below navbar - NOT on course pages */
body:not(.path-course-view) #region-main,
body:not(.path-course-view) #region-main-box,
body:not(.path-course-view) .page-content {
    padding-top: 0 !important;
}

/* ========================================
   CUSTOM SIDEBAR PAGES (Teacher, Admin, etc.)
   (Excludes course view pages)
   ======================================== */

/* Pages with custom sidebars - NOT on course pages */
body:not(.path-course-view) .teacher-css-wrapper,
body:not(.path-course-view) .admin-sidebar-wrapper {
    padding-top: 0 !important;
}

/* Sidebar toggle buttons should be below navbar - NOT on course pages */
body:not(.path-course-view) .sidebar-toggle {
    top: 80px !important;
    z-index: 1001 !important;
}

/* Custom sidebars should start below navbar - 60px padding - NOT on course pages */
body:not(.path-course-view) .teacher-sidebar,
body:not(.path-course-view) .admin-sidebar {
    padding-top: 0px !important;
}

/* ========================================
   MOBILE RESPONSIVE
   (Excludes course view pages)
   ======================================== */

@media (max-width: 768px) {

    /* Navbar stays fixed on mobile - NOT on course pages */
    body:not(.path-course-view) nav.navbar {
        position: fixed !important;
        top: 0 !important;
        z-index: 1100 !important;
    }

    /* Dashboard pages on mobile - no extra padding (override standard padding) - NOT on course pages */
    body.path-my:not(.path-course-view) #page-wrapper,
    body.path-dashboard:not(.path-course-view) #page-wrapper,
    body.has-student-sidebar:not(.path-course-view) #page-wrapper,
    body.custom-dashboard-page:not(.path-course-view) #page-wrapper {
        padding-top: 0 !important;
    }

    body.path-my:not(.path-course-view) #page,
    body.path-dashboard:not(.path-course-view) #page,
    body.has-student-sidebar:not(.path-course-view) #page,
    body.custom-dashboard-page:not(.path-course-view) #page {
        padding-top: 0 !important;
    }

    /* Middle dashboard on mobile - 60px padding - NOT on course pages */
    body.middle-dashboard:not(.path-course-view) {
        padding-top: 60px !important;
    }

    body.middle-dashboard:not(.path-course-view) #page-wrapper,
    body.middle-dashboard:not(.path-course-view) #page {
        padding-top: 0 !important;
    }


    body:not(.path-course-view) #page {
        padding-top: 0 !important;
    }

    /* Mobile sidebar toggles - NOT on course pages */
    body:not(.path-course-view) .sidebar-toggle {
        top: 65px !important;
    }
}

/* ========================================
   SCROLLED STATE ENHANCEMENT
   (Excludes course view pages)
   ======================================== */

/* Add shadow when page is scrolled - NOT on course pages */
body:not(.path-course-view) nav.navbar.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    background: rgba(255, 255, 255, 0.98) !important;
}

/* ========================================
   DARK MODE SUPPORT
   (Excludes course view pages)
   ======================================== */

body[data-theme="dark"]:not(.path-course-view) nav.navbar,
body.dark-mode:not(.path-course-view) nav.navbar {
    background: #1a1a1a !important;
    border-bottom-color: #333 !important;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    nav.navbar {
        position: static !important;
    }

    #page-wrapper,
    #page,
    .main-inner,
    .teacher-main-content,
    .admin-main-content {
        padding-top: 0 !important;
    }
}

/* ========================================
   HIGH SCHOOL DASHBOARD SPECIFIC FIX
   (Excludes course view pages)
   ======================================== */

/* HIGH SCHOOL DASHBOARD SPECIFIC FIX - Maximum Priority - NOT on course pages */
body:not(.path-course-view) .highschool-dashboard,
body:not(.path-course-view) .custom_dashboard .highschool-dashboard,
body.custom-dashboard-page:not(.path-course-view) .highschool-dashboard,
body.custom-dashboard-page:not(.path-course-view) .custom_dashboard .highschool-dashboard,
body:not(.path-course-view) div.highschool-dashboard,
body:not(.path-course-view) .custom_dashboard>div.highschool-dashboard,
body.custom-dashboard-page:not(.path-course-view) div.highschool-dashboard {
    margin-top: 60px !important;
    padding-top: 0px !important;
}

/* OVERRIDE ENHANCED SIDEBAR SPECIFIC SELECTORS - NOT on course pages */
body.has-student-sidebar.has-enhanced-sidebar:not(.path-course-view) .highschool-dashboard,
body.has-student-sidebar.has-enhanced-sidebar:not(.path-course-view) .analytics-dashboard,
body.has-student-sidebar.has-enhanced-sidebar:not(.path-course-view) .dashboard-metrics {
    margin-top: 60px !important;
    padding-top: 0px !important;
}

/* SIDEBAR FIX - Prevent cutting from top - NOT on course pages */
,
body.has-student-sidebar.has-enhanced-sidebar:not(.path-course-view) .student-sidebar,
body.has-enhanced-sidebar.student-sidebar:not(.path-course-view) .student-sidebar {
    margin-top: 80px !important;
    padding-top: 0px !important;
}

/* ========================================
   URL RESOURCE VIEW (mod/url/view.php)
   ======================================== */

body.path-mod-url .footer-container,
body.path-mod-url .footer-container.container,
body.path-mod-url #page-footer,
body.path-mod-url .page-footer,
body.path-mod-url div.footer-container,
body.path-mod-url footer,
body.path-mod-url #page-footer .container,
body.path-mod-url #page-footer .footer-content {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}