@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;700;900&display=swap');

:root {
    --primary: #2563EB;
    --secondary: #D97706;
    --bg-color: #f3f4f6;
    --surface: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --locked: #9ca3af;
}

body { margin: 0; font-family: 'Heebo', sans-serif; background: var(--bg-color); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; direction: rtl; }
a { text-decoration: none; color: inherit; transition: 0.2s; }
* { box-sizing: border-box; }

/* Navbar */
.nav { background: var(--surface); padding: 0 20px; height: 70px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border-bottom: 1px solid var(--border); flex-shrink: 0; z-index: 50; position: relative; }
.nav-right { display: flex; align-items: center; gap: 20px; }
.nav-logo { font-weight: 900; font-size: 20px; color: var(--primary); display: flex; align-items: center; gap: 10px; }
.nav-link-lobby { font-size: 14px; font-weight: 500; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.nav-link-lobby:hover { color: var(--primary); }
.user-menu { display: flex; align-items: center; gap: 15px; font-size: 14px; font-weight: 500; }
.btn-logout { color: #ef4444; background: #fee2e2; padding: 6px 14px; border-radius: 6px; font-size: 13px; }

/* Gamification Badge */
.xp-badge { background: #eff6ff; color: var(--primary); padding: 5px 12px; border-radius: 20px; font-size: 13px; font-weight: 700; border: 1px solid #bfdbfe; display: flex; align-items: center; gap: 5px; }
.rank-badge { color: var(--secondary); font-weight: 800; font-size: 14px; }

/* Mobile Menu Toggle */
.mobile-toggle { display: none; font-size: 20px; cursor: pointer; color: var(--text-main); margin-left: 15px; }

/* Lobby Grid */
.lobby-container { max-width: 1200px; margin: 40px auto; padding: 0 20px; width: 100%; overflow-y: auto; flex: 1; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 30px; }
.course-card { background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border: 1px solid var(--border); transition: transform 0.2s; display: flex; flex-direction: column; }
.course-card:hover { transform: translateY(-5px); box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }
.card-img { height: 180px; background-size: cover; background-position: center; position: relative; }
.card-body { padding: 25px; flex: 1; display: flex; flex-direction: column; }
.card-title { margin: 0 0 10px 0; font-size: 18px; font-weight: 700; line-height: 1.4; }
.card-desc { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; height: 42px; }

/* Progress Bar */
.progress-container { background: #e5e7eb; border-radius: 99px; height: 8px; width: 100%; margin-bottom: 15px; overflow: hidden; }
.progress-fill { background: var(--success); height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.progress-text { font-size: 12px; color: var(--text-muted); margin-bottom: 15px; display: flex; justify-content: space-between; }

.btn { display: block; text-align: center; background: var(--primary); color: white; padding: 12px; border-radius: 10px; font-weight: 600; margin-top: auto; }
.btn-locked { background: var(--locked); cursor: not-allowed; display: flex; align-items: center; justify-content: center; gap: 8px; color: white; border-radius: 10px; padding: 12px; font-weight: 600; margin-top: auto; }

/* Player Layout */
.player-layout { display: flex; flex: 1; overflow: hidden; height: calc(100vh - 70px); position: relative; }

/* Sidebar - Desktop Default */
.sidebar { width: 350px; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 40; }

.content-area { flex: 1; background: #f9fafb; padding: 40px; overflow-y: auto; display: flex; flex-direction: column; align-items: center; width: 100%; }
.video-wrapper { width: 100%; max-width: 900px; }

/* Modules Accordion */
.module-header { padding: 15px 20px; background: #f3f4f6; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border); color: var(--text-main); display: flex; justify-content: space-between; cursor: pointer; user-select: none; }
.module-header:first-child { border-top: none; }
.module-header i { transition: transform 0.3s; }
.module-header.collapsed i { transform: rotate(90deg); }
.lesson-list { list-style: none; padding: 0; margin: 0; display: block; }
.lesson-list.collapsed { display: none; }

.lesson-row { display: flex; align-items: center; padding: 12px 20px; border-bottom: 1px solid #f3f4f6; cursor: pointer; transition: 0.2s; font-size: 14px; color: var(--text-muted); text-decoration: none; }
.lesson-row:hover { background: #f9fafb; color: var(--primary); }
.lesson-row.active { background: #eff6ff; color: var(--primary); font-weight: 600; border-right: 4px solid var(--primary); }
.lesson-row.locked { opacity: 0.5; cursor: not-allowed; background: #f3f4f6; }
.status-icon { width: 20px; margin-left: 10px; display: flex; align-items: center; justify-content: center; }

/* Video & Content */
.video-box { aspect-ratio: 16/9; background: black; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.1); margin-bottom: 30px; }
.video-box iframe { width: 100%; height: 100%; }
.lesson-title { font-size: 28px; font-weight: 800; margin-bottom: 15px; }
.action-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--border); gap: 10px; }

/* Buttons */
.btn-nav { background: white; border: 1px solid var(--border); color: var(--text-main); padding: 10px 20px; border-radius: 8px; font-weight: 500; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: 0.2s; }
.btn-nav:hover { border-color: var(--primary); color: var(--primary); }
.btn-nav.disabled { opacity: 0.5; cursor: not-allowed; } 

.btn-complete { background: var(--surface); border: 2px solid var(--border); padding: 10px 20px; border-radius: 8px; font-weight: 600; cursor: pointer; transition: 0.2s; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.btn-complete:hover { border-color: var(--success); color: var(--success); }
.btn-complete.done { background: var(--success); border-color: var(--success); color: white; }

/* Toast Notification */
.toast { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 8px; padding: 16px; position: fixed; z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 15px; opacity: 0; transition: opacity 0.3s, bottom 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.toast.show { visibility: visible; opacity: 1; bottom: 50px; }

/* --- New Features CSS (Resume & In-Course Progress) --- */

/* Resume Banner */
.resume-banner { background: white; border-radius: 16px; padding: 25px; margin-bottom: 30px; border: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
.resume-info { display: flex; align-items: center; gap: 20px; }
.resume-thumb { width: 80px; height: 50px; background-size: cover; border-radius: 8px; background-color: #eee; }
.resume-btn { background: var(--primary); color: white; padding: 10px 20px; border-radius: 8px; font-weight: 600; font-size: 14px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.resume-btn:hover { background: #1d4ed8; }

/* In-Course Sidebar Progress */
.sidebar-progress { padding: 20px; border-bottom: 1px solid #e5e7eb; background: #f9fafb; }

/* Responsive Mobile Drawer */
@media (max-width: 900px) {
    .mobile-toggle { display: block; }
    .player-layout { flex-direction: row; } 
    
    .sidebar { 
        position: absolute; 
        top: 0; right: 0; bottom: 0; 
        width: 80%; max-width: 300px;
        transform: translateX(100%); 
        box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    }
    .sidebar.active { transform: translateX(0); }
    .sidebar-overlay { display: none; position: absolute; top:0; left:0; right:0; bottom:0; background: rgba(0,0,0,0.4); z-index: 30; backdrop-filter: blur(2px); }
    .sidebar-overlay.active { display: block; }
    .content-area { padding: 20px; width: 100%; }
    .lesson-title { font-size: 22px; }
    .nav-logo span { display: none; } 
    .user-menu span { display: none; }
    
    /* Resume Banner Mobile */
    .resume-banner { flex-direction: column; align-items: flex-start; gap: 15px; }
    .resume-btn { width: 100%; justify-content: center; }
}