/* ----------------------------------------------------
   MAIN PAGE GRID LAYOUT
---------------------------------------------------- */
.home-page-container {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 100%;
    min-height: 100vh;
}

/* ----------------------------------------------------
   HEADER — FINAL STABLE
---------------------------------------------------- */
.home-page-header-container {
    display: flex;
    align-items: center;              /* 🔥 baseline alignment */
    justify-content: space-between;
    gap: 12px;

    background-color: aliceblue;
    padding: 6px 14px;
    border-bottom: 2px solid #ccc;

    width: 100%;
    box-sizing: border-box;
    z-index: 4000;
}

/* Every header item behaves as one unit */
.home-page-header-container > * {
    display: flex;
    align-items: center;
    min-width: 0;
}


.menu-btn { display: none; }

.logo-container img {
    width: 80px;
}

/* ----------------------------------------------------
   SEARCH
---------------------------------------------------- */
.search-area-container {
    position: relative;
    display: flex;
    gap: 10px;
}

.search-wrapper { position: relative; width: 200px; }

#searchInput {
    padding: 8px 8px 8px 32px;
    width: 150px;
    border: 1px solid #aaa;
    border-radius: 5px;
    background: url("../../images/search_icon.png") no-repeat 8px center / 18px;
}

.suggestions-box {
    position: absolute;
    top: 38px;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    max-height: 180px;
    overflow-y: auto;
    display: none;
    z-index: 4500;
}

.suggestions-box div {
   cursor: pointer;          /* 👈 HAND SYMBOL */
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

/* ----------------------------------------------------
   MENU BAR
---------------------------------------------------- */
.menucontainer {
    display: flex;
    gap: 30px;
    background: #f8f8f8;
    padding: 10px 20px;
    flex-wrap: wrap;
}

.menuitem a {
    text-decoration: none;
    font-size: 18px;
    color: #333;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 6px;
}

.menuitem a:hover { background: #e0e0e0; }

.tutorial-list-box {
    display: none;
    position: absolute;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    min-width: 200px;
    z-index: 99999;
}

.tutorial-list-box div {
    cursor: pointer;          /* 👈 HAND SYMBOL */
    padding: 8px;
    border-bottom: 1px solid #ddd;
}
.language-switcher {
    display: flex;
    align-items: center;
    margin-right: 16px;   /* 👈 adjust as needed */
}

.language-container {
    display: flex;
    flex-direction: column;   /* optional */
    align-items: center;
    gap: 2px;
}


/* ----------------------------------------------------
   LOGIN — STACKED ICON + TEXT (SINGLE UNIT)
---------------------------------------------------- */
.login-container {
    display: flex;
    align-items: center;      /* aligns with header row */
}

/* This is the vertical stack */
.login-btns {
    display: flex;
    flex-direction: column;   /* ✅ stack vertically */
    align-items: center;      /* center icon + text */
    gap: 2px;

    line-height: 1.1;
}

/* Icon */
#loginBtn img {
    width: 36px;
    height: 36px;
    display: block;
}

/* Optional label under icon */
.login-label {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}
/* =====================================================
   AUTH + PRACTICE MODALS — DEFAULT CLOSED (LOCKED 🔒)
===================================================== */

/* Default closed */
#practiceOverlay,
#practiceModal {
    display: none;
    pointer-events: none;
}

/* Open state (JS adds .show) */
#practiceOverlay.show,
#practiceModal.show {
    display: block;
    pointer-events: auto;   /* Restores interactivity */
}


/* Overlay — below modal box, above main content */
.practice-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);

    z-index: 7000;           /* 👈 LOWER than header & modal box */
    display: none;
}

/* Modal box — above overlay */
.practice-modal-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);

    width: 60%;
    max-width: 700px;
    max-height: 80vh;

    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 0 20px rgba(0,0,0,0.4);

    z-index: 7500;           /* 👈 ABOVE overlay */
    overflow-y: auto;

    pointer-events: auto;
}

/* Show state */
.practice-modal.show {
    display: block;
}
.practice-list-box div {
    cursor: pointer;          /* 👈 HAND SYMBOL */
    padding: 8px;
    border-bottom: 1px solid #ddd;
}

.practice-list-box div:hover {
    background-color: #eef3ff;
}


/* ----------------------------------------------------
   MAIN CONTENT LAYOUT
---------------------------------------------------- */
.main-container {
    display: flex;
    gap: 10px;
    background: #f5f7fa;
}

.main-center {
    flex: 0 0 70%;
    padding: 10px;
    flex-direction: row;
    border: 1px solid #ccc;
    gap:10px;
}

.main-right {
    flex: 0 0 10%;
    border: 1px solid #ccc;
}

/* ----------------------------------------------------
   COURSE CARDS
---------------------------------------------------- */
.mitem {
    width: 280px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 0 8px rgba(0,0,0,0.2);
    transition: 0.2s;
}

.mitem:hover { transform: scale(1.02); }

/* ----------------------------------------------------
   MODALS / LOGIN
---------------------------------------------------- */
.overlay,
.practice-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 9000;
}

.modal-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 360px;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    z-index: 10000;
}
/* =====================================================
   SIDEBAR — FINAL LOCKED CSS 🔒
===================================================== */

/* Sidebar container */
.sidebar-menu {
    flex: 0 0 20%;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    z-index: 3000;
}
.sidebar-menu ul li a{
    text-decoration: none;
}
/* Tree reset */
.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Folder behavior */
#sidebar li.folder > ul {
    display: none;
}

#sidebar li.folder.expanded > ul {
    display: block;
}


#sidebar li.folder.expanded ul {
    display: block !important;
}


/* Folder label */
li.folder > .label {
    display: block;
    font-weight: bold;
    color: #34069f;
    cursor: pointer;
    padding: 6px 12px;
    line-height: 1.4;
    word-break: break-word;
}

/* Leaf links */
li.leaf a {
    display: block;
    padding: 6px 12px 6px 24px;
    text-decoration: none;
    color: #140c0c;
    line-height: 1.4;
    word-break: break-word;
}

/* Hover */
.sidebar-menu li:hover {
    background-color: #f0f0f0;
}
.sidebar-menu a.active {
    font-weight: bold;
    color: #007bff;
}


.prev-next-nav {
    display: flex;
    justify-content: space-between;
    margin: 20px 0;
    gap: 12px;
}

.prev-next-nav a {
    padding: 8px 14px;
    background: #eef3ff;
    border: 1px solid #c7d6ff;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    color: #003366;
}

.prev-next-nav a:hover {
    background: #dbe6ff;
}

/* =========================================
   FORCE SIDEBAR EXPANSION (FINAL FIX)
========================================= */
#sidebar li.folder.expanded > ul {
    display: block !important;
}

/* ----------------------------------------------------
   MOBILE SIDEBAR
---------------------------------------------------- */
@media (max-width: 498px) {
    .main-center{
    width: 95%;            /* almost full width */
    padding: 12px;         /* slightly smaller padding */
    font-size: 0.95rem; 

    }
}
@media (max-width: 768px) {

    .home-page-header-container {
        gap: 8px;
        padding: 6px 8px;
        flex-wrap: wrap;   /* 🔥 prevent breaking rows */
    }

   

    /* LOGO SMALLER */
    .logo-container img {
        width: 40px;
    }

    

    /* SEARCH — SHRINK */
    .search-wrapper {
        width: auto;
    }

    #searchInput {
        width: 110px;
        padding: 6px 6px 6px 28px;
        font-size: 14px;
        background-size: 16px;
    }

   

    /* LANGUAGE */
    .language-switcher {
        margin-right: 6px;
    }

    .language-container {
       width:50px;
    }

    /* LOGIN ICON */
    #loginBtn img {
        width: 30px;
        height: 30px;
    }

    .login-label {
        font-size: 11px;
    }
    .main-center{
    width: 95%;            /* almost full width */
    padding: 12px;         /* slightly smaller padding */
    font-size: 0.95rem; 
    }

   .sidebar-menu {
        position: fixed;
        top: 0;
        left: -300px;
        width: 280px;
        height: 100%;
        transition: left 0.3s ease;
        z-index: 5002;
    }

    .sidebar-menu.open {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 5001;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.show {
        opacity: 1;
        visibility: visible;
    }

    #menuBtn,
    .menu-btn {
        display: block;
        font-size: 26px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 100000;
    }
    .menu-label {
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
   }
}
/* ===== FINAL SIDEBAR FIX ===== */

/* hide children by default */
#sidebar li.folder > ul {
    display: none;
}

/* show children ONLY when expanded */
#sidebar li.folder.expanded > ul {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    opacity: 1 !important;
}

