/**
 * NIFC UI Customization Styles
 *
 * Sidebar always visible + Menu hover dropdown enhancements
 * for Edumy theme on Moodle 4.5.
 *
 * @package    local_nifc_ui
 * @copyright  2026 OES/NIFC
 */

/* ============================================================
   1. SIDEBAR ALWAYS VISIBLE (Desktop)
   ============================================================ */

/**
 * Override Edumy's dn-1199 class that hides sidebar on <1199px.
 * When plugin is active, sidebar should always be visible on desktop (≥992px).
 */
body.nifc-sidebar-pinned .dashboard_sidebar.dn-1199 {
    display: block !important;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--nifc-sidebar-width, 280px);
    height: 100vh;
    z-index: 1040;
    overflow-y: auto;
    background-color: #1b2345;
    transition: transform 0.3s ease-in-out;
    transform: translateX(0);
}

/* Push main content to the right when sidebar is pinned */
body.nifc-sidebar-pinned .our-dashbord {
    margin-left: var(--nifc-sidebar-width, 280px);
    transition: margin-left 0.3s ease-in-out;
}

/* Sidebar toggle button */
.nifc-sidebar-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1050;
    background: #2441e7;
    color: #fff;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
}

.nifc-sidebar-toggle:hover {
    background: #1a30b5;
    transform: scale(1.05);
}

.nifc-sidebar-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #fff;
    margin: 3px 0;
    transition: all 0.3s;
    border-radius: 2px;
}

/* When sidebar is hidden */
body.nifc-sidebar-hidden .dashboard_sidebar.dn-1199 {
    transform: translateX(-100%);
}

body.nifc-sidebar-hidden .our-dashbord {
    margin-left: 0;
}

/* Move toggle button when sidebar is open */
body.nifc-sidebar-pinned .nifc-sidebar-toggle {
    left: calc(var(--nifc-sidebar-width, 280px) + 10px);
}

body.nifc-sidebar-hidden .nifc-sidebar-toggle {
    left: 15px;
}


/* ============================================================
   2. MENU HOVER DROPDOWN
   ============================================================ */

/**
 * Dashboard sidebar navigation items - hover to expand sub-menus.
 */
body.nifc-menu-hover .dashbord_nav_list li {
    position: relative;
}

/* Submenu container */
body.nifc-menu-hover .dashbord_nav_list li .nifc-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 220px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.25s ease;
    z-index: 1060;
}

body.nifc-menu-hover .dashbord_nav_list li:hover > .nifc-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

/* Submenu items */
body.nifc-menu-hover .nifc-submenu a {
    display: block;
    padding: 10px 20px;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

body.nifc-menu-hover .nifc-submenu a:hover {
    background-color: #f0f4ff;
    color: #2441e7;
    border-left-color: #2441e7;
}

/* Arrow indicator for items with sub-menus */
body.nifc-menu-hover .dashbord_nav_list li.has-submenu > a::after {
    content: '\f054';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 10px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
    transition: all 0.2s ease;
}

body.nifc-menu-hover .dashbord_nav_list li.has-submenu:hover > a::after {
    opacity: 1;
    transform: translateY(-50%) translateX(3px);
}

/* Navigation items hover enhancement */
body.nifc-menu-hover .dashbord_nav_list li a {
    position: relative;
    transition: all 0.2s ease;
    padding-right: 35px;
}

body.nifc-menu-hover .dashbord_nav_list li a:hover {
    padding-left: 25px;
}


/* ============================================================
   3. GENERAL NAVIGATION ENHANCEMENTS
   ============================================================ */

/* Smooth scrollbar for sidebar */
.dashboard_sidebar::-webkit-scrollbar {
    width: 6px;
}

.dashboard_sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.dashboard_sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.dashboard_sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* Active navigation item highlight */
.dashbord_nav_list li.active > a {
    background-color: rgba(36, 65, 231, 0.15);
    border-left: 3px solid #2441e7;
}


/* ============================================================
   4. RESPONSIVE OVERRIDES
   ============================================================ */

/* On mobile, sidebar should overlay instead of push */
@media (max-width: 991px) {
    body.nifc-sidebar-pinned .dashboard_sidebar.dn-1199 {
        width: 280px;
    }

    body.nifc-sidebar-pinned .our-dashbord {
        margin-left: 0;
    }

    /* Add overlay background on mobile when sidebar is open */
    body.nifc-sidebar-pinned::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1035;
    }

    body.nifc-sidebar-pinned .dashboard_sidebar.dn-1199 {
        z-index: 1040;
    }

    body.nifc-sidebar-pinned .nifc-sidebar-toggle {
        left: 290px;
        z-index: 1050;
    }
}

/* Print: hide sidebar */
@media print {
    .dashboard_sidebar,
    .nifc-sidebar-toggle {
        display: none !important;
    }

    .our-dashbord {
        margin-left: 0 !important;
    }
}
