/* =========================================
   🖥️ GLOBAL / DESKTOP STYLES (Always On)
   ========================================= */

/* --- Base Body Settings --- */
body { 
    margin: 0; 
    font-family: Arial, sans-serif; 
    background: #f4f6fb; 
    display: flex; 
    height: 100vh; 
    flex-direction: column; 
}

/* Prevent scrolling when mobile menu is open */
body.no-scroll { 
    overflow: hidden; 
}

/* --- 1. Top Bar (general_top_bar.php) --- */
.top-bar {
    background: #1f2937;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1000;
}

.logo-link { 
    display: flex; 
    align-items: center; 
    text-decoration: none; 
}
.logo-link img { 
    height: 30px; 
    margin-inline-end: 12px; 
    border-radius: 4px; 
}
.logo-link strong { 
    color: white; 
    font-size: 1.3em; 
    margin-inline-end: 30px; 
}

.nav-wrapper { 
    display: flex; 
    flex: 1; 
    justify-content: space-between; 
    align-items: center; 
}
.nav-links { 
    display: flex; 
    align-items: center; 
    gap: 20px; 
}
.nav-links a { 
    color: white; 
    text-decoration: none; 
    font-weight: bold; 
    transition: opacity 0.2s; 
}
.nav-links a:hover { 
    opacity: 0.8; 
}

.auth-area { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
}
.lang-switch { 
    color: white; 
    text-decoration: none; 
    font-size: 0.9em; 
    border: 1px solid rgba(255,255,255,0.3); 
    padding: 4px 8px; 
    border-radius: 4px; 
}
.profile-link { 
    color: white; 
    text-decoration: none; 
    font-weight: bold; 
    display: flex; 
    align-items: center; 
    gap: 5px; 
}
.btn-logout { 
    background: #ef4444; 
    padding: 6px 12px; 
    font-size: 0.9em; 
    color: white; 
    text-decoration: none; 
    border-radius: 4px; 
    font-weight: bold; 
}
.btn-signin { 
    color: #10b981; 
    text-decoration: none; 
    font-weight: bold; 
}

/* Hide mobile UI elements on desktop */
.mobile-toggle-btn, 
.mobile-close-btn, 
.mobile-menu-overlay { 
    display: none; 
}

/* --- 2. Teacher Workspace Layout --- */
.header { 
    background: #1e3a8a; 
    color: white; 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.workspace { 
    display: flex; 
    flex: 1; 
    overflow: hidden; 
}
.sidebar { 
    width: 250px; 
    background: white; 
    border-right: 1px solid #ddd; 
    display: flex; 
    flex-direction: column; 
}
.tab-btn { 
    display: block; 
    width: 100%; 
    text-align: left; 
    padding: 15px 20px; 
    border: none; 
    background: none; 
    border-bottom: 1px solid #eee; 
    font-size: 16px; 
    cursor: pointer; 
    color: #555; 
}
.tab-btn:hover { 
    background: #f9fafb; 
}
.tab-btn.active { 
    background: #eff6ff; 
    color: #1e3a8a; 
    font-weight: bold; 
    border-left: 4px solid #1e3a8a; 
}


/* =========================================
   📱 MOBILE RESPONSIVENESS (Screens under 768px)
   ========================================= */
@media (max-width: 768px) {
    
    /* --- 1. TOP BAR SLIDE MENU --- */
    .top-bar {
        padding: 12px 15px;
    }
    
    .mobile-toggle-btn {
        display: block;
        background: none;
        border: none;
        color: white;
        font-size: 24px;
        cursor: pointer;
        padding: 0;
    }

    .mobile-menu-overlay {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 998;
        display: block;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }
    .mobile-menu-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    .nav-wrapper {
        position: fixed;
        top: 0;
        right: -280px; /* Start hidden off-screen */
        width: 250px;
        height: 100vh;
        background: #1f2937;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        padding: 60px 20px 20px 20px;
        box-shadow: -4px 0 15px rgba(0,0,0,0.3);
        transition: right 0.3s ease;
        z-index: 1000;
    }
    .nav-wrapper.open {
        right: 0; /* Slide in */
    }

    .mobile-close-btn {
        display: block;
        position: absolute;
        top: 15px;
        right: 20px;
        background: none;
        border: none;
        color: white;
        font-size: 32px;
        cursor: pointer;
        line-height: 1;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 15px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
    .nav-links a { width: 100%; padding: 5px 0; }

    .auth-area {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 20px;
    }

    /* --- 2. WORKSPACE & SIDEBAR TRANSFORM --- */
    .workspace { 
        flex-direction: column; 
    }
    
    .sidebar { 
        width: 100%; 
        flex-direction: row; 
        overflow-x: auto; 
        border-right: none;
        border-bottom: 1px solid #ddd;
        scrollbar-width: none; 
    }
    .sidebar::-webkit-scrollbar { display: none; }

    .tab-btn { 
        width: auto; 
        white-space: nowrap; 
        padding: 12px 15px;
        border-bottom: none;
        border-left: none !important; 
        border-bottom: 3px solid transparent; 
    }
    .tab-btn.active {
        border-left: none !important;
        border-bottom: 3px solid #1e3a8a !important; 
    }

    /* --- 3. FORM INPUTS & BOX PADDING --- */
    .content-area, .editor-area { 
        padding: 15px; 
    }
    .box { 
        padding: 15px; 
        border-radius: 12px;
    }

    div[style*="display: flex; gap: 15px;"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
    div[style*="display: flex; gap: 10px;"] {
        flex-direction: column !important;
    }

    /* --- 4. COURSE CARDS --- */
    .course-grid {
        grid-template-columns: 1fr;
    }
}