/* --- CSS VARIABLES & THEME CONFIGURATION --- */
:root {
  --primary: #D4AF37;
  --primary-hover: #B8912E;
  --bg-main: #F5EFE6;
  --bg-card: #FFFFFF;
  --bg-sidebar: #2C1E0F;
  --text-main: #2C1E0F;
  --text-muted: #8A7B5E;
  --text-sidebar: #F5EFE6;
  --border-color: #E7D8BC;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --whatsapp: #25d366;
  --sidebar-width: 260px;
  --radius: 12px;
  --transition: all 0.3s ease;
}

[data-theme="dark"] {
  --bg-main: #1A1206;
  --bg-card: #2C1E0F;
  --text-main: #F5EFE6;
  --text-muted: #B5A488;
  --border-color: #4A3B2C;
}

/* --- RESET & BASE STYLES --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Cairo', sans-serif;
}

html { overflow-x: hidden; max-width: 100%; }
body {
  background-color: var(--bg-main);
  color: var(--text-main);
  direction: rtl;
  overflow-x: hidden;
  transition: var(--transition);
}

/* --- LAYOUT STRUCTURE --- */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* Overlay for Mobile Sidebar */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  display: none;
}
.overlay.active { display: block; }

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.user-avatar img {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  margin-bottom: 0.5rem;
}

.sidebar-nav ul { list-style: none; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1rem 1.5rem;
  color: #B5A488;
  text-decoration: none;
  transition: var(--transition);
}
.sidebar-nav li.active a, .sidebar-nav li a:hover {
  background-color: var(--primary);
  color: #fff;
}

/* Mobile Sidebar Behavior */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
}

/* --- MAIN WRAPPER --- */
.main-wrapper {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-right: var(--sidebar-width);
  transition: margin 0.3s ease;
}
@media (max-width: 992px) {
  .main-wrapper { margin-right: 0; }
}

/* --- TOPBAR --- */
.topbar {
  height: 65px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky; top: 0;
  z-index: 80;
}

.topbar-left { display: flex; align-items: center; gap: 1rem; }
.hamburger-btn {
  background: none; border: none;
  font-size: 1.5rem; color: var(--text-main);
  cursor: pointer; display: none;
}
@media (max-width: 992px) { .hamburger-btn { display: block; } }

.logo { font-weight: 800; font-size: 1.2rem; }
.logo span { color: var(--primary); }

.topbar-right { display: flex; align-items: center; gap: 1rem; }
.theme-toggle, .icon-btn {
  background: none; border: 1px solid var(--border-color);
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-main); font-size: 1rem;
}

/* --- MAIN CONTENT & SPA SECTIONS --- */
.main-content {
  padding: 1.5rem;
  flex: 1;
}

.app-section {
  display: none;
  animation: fadeIn 0.4s ease;
}
.app-section.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- UI COMPONENTS & BUTTONS --- */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-secondary { background-color: #8A7B5E; color: #fff; }
.btn-success { background-color: var(--success); color: #fff; }
.btn-danger { background-color: var(--danger); color: #fff; }
.btn-whatsapp { background-color: var(--whatsapp); color: #fff; text-decoration: none; display: inline-block; }
.btn-outline { border: 1px solid var(--border-color); background: transparent; color: var(--text-main); }

/* --- GRID SYSTEM FOR COURSES --- */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.course-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-badge {
  position: absolute; top: 12px; left: 12px;
  background: var(--danger); color: #fff;
  padding: 2px 8px; border-radius: 4px; font-size: 0.8rem;
}

/* --- DRILL DOWN NAVIGATION --- */
.drill-level.hidden { display: none; }
.btn-back {
  background: none; border: none;
  color: var(--primary); font-weight: 700;
  cursor: pointer; margin-bottom: 1rem;
}

/* --- TABS SYSTEM --- */
.tabs-header {
  display: flex; gap: 10px;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1rem;
}
.tab-btn {
  background: none; border: none;
  padding: 10px 20px; font-weight: 700;
  color: var(--text-muted); cursor: pointer;
}
.tab-btn.active {
  color: var(--primary);
  border-bottom: 3px solid var(--primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

.video-container {
  position: relative; padding-bottom: 56.25%; height: 0;
  overflow: hidden; border-radius: var(--radius);
}
.video-container iframe {
  position: absolute; top:0; left:0; width:100%; height:100%;
}

/* --- EXAM INTERFACE --- */
.exam-header {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-card); padding: 1rem; border-radius: var(--radius);
  margin-bottom: 1rem; border: 1px solid var(--border-color);
}

.exam-timer {
  background: #fef2f2; color: var(--danger);
  padding: 6px 12px; border-radius: 8px; font-weight: 800;
}
.exam-timer.pulse { animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.exam-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
}
@media (max-width: 768px) {
  .exam-layout { grid-template-columns: 1fr; }
}

.question-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.q-btn {
  padding: 10px; border-radius: 6px; border: 1px solid var(--border-color);
  background: var(--bg-card); color: var(--text-main); cursor: pointer;
}
.q-btn.current { background: var(--warning); color: #fff; }
.q-btn.answered { background: var(--success); color: #fff; }

.question-card {
  background: var(--bg-card); padding: 1.5rem;
  border-radius: var(--radius); border: 1px solid var(--border-color);
}
.options-group { display: flex; flex-direction: column; gap: 10px; margin-top: 1rem; }
.option-label {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border: 1px solid var(--border-color);
  border-radius: 8px; cursor: pointer;
}

/* --- ACCORDION FAQ --- */
.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 8px; margin-bottom: 8px; overflow: hidden;
}
.accordion-header {
  width: 100%; padding: 1rem; text-align: right;
  background: var(--bg-card); border: none; font-weight: 700;
  color: var(--text-main); cursor: pointer;
}
.accordion-content {
  padding: 0 1rem; max-height: 0; overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  background: var(--bg-main);
}
.accordion-item.open .accordion-content {
  padding: 1rem; max-height: 200px;
}

/* --- MODALS --- */
.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; opacity: 0; pointer-events: none; transition: var(--transition);
}
.modal.open { opacity: 1; pointer-events: all; }
.modal-content {
  background: var(--bg-card); padding: 2rem; border-radius: var(--radius);
  width: 90%; max-width: 400px; position: relative;
}
.close-modal-btn {
  position: absolute; top: 10px; left: 10px; background: none;
  border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-main);
}
.modal-input {
  width: 100%; padding: 10px; margin: 1rem 0;
  border: 1px solid var(--border-color); border-radius: 6px;
}




/* --- COURSE HERO CARD HEADER --- */
.course-hero-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.hero-title { font-size: 1.6rem; color: #2C1E0F; font-weight: 800; margin-bottom: 6px; }
.hero-subtitle { color: #8A7B5E; font-size: 0.95rem; margin-bottom: 1.5rem; }

.hero-stats {
  display: flex; gap: 2rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.stat-box { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: 1.4rem; font-weight: 800; color: #B8912E; } /* لون برتقالي مثل الصورة */
.stat-label { font-size: 0.85rem; color: #8A7B5E; font-weight: 600; }

.hero-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meta-date, .meta-tag {
  background: #F4ECDC; padding: 6px 14px; border-radius: 6px;
  font-size: 0.85rem; color: #6B5B43; font-weight: 600;
}
.btn-back-hero {
  background: #F4ECDC; border: 1px solid #D9C9A8; color: #4A3B2C;
  padding: 6px 20px; border-radius: 8px; font-weight: 700; cursor: pointer;
}

.hero-image img {
  width: 180px; height: auto; border-radius: 12px; object-fit: cover;
}

@media (max-width: 768px) {
  .course-hero-card { flex-direction: column-reverse; text-align: center; gap: 1rem; }
  .hero-stats { justify-content: center; gap: 1rem; }
  .hero-footer { justify-content: center; }
}

/* --- COURSE CONTENT ACCORDION LIST --- */
.course-content-box {
  background: #fff; border: 1px solid var(--border-color);
  border-radius: 16px; padding: 1.5rem;
}
.box-title {
  font-size: 1.4rem; font-weight: 800; color: #B8912E; margin-bottom: 1.5rem;
  border-bottom: 2px solid #F0E3C0; padding-bottom: 8px;
}

.lectures-accordion-list { display: flex; flex-direction: column; gap: 12px; }

/* بطاقة المحاضرة المتاحة */
.lecture-card {
  border: 1px solid #E7D8BC; border-radius: 10px;
  background: #ffffff; transition: var(--transition);
  overflow: hidden;
}
.lecture-card.unlocked { cursor: pointer; }
.lecture-card.unlocked:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

.lecture-header {
  padding: 1rem 1.2rem; display: flex;
  justify-content: space-between; align-items: center; font-weight: 700;
}

/* بطاقة المحاضرة المغلقة (مثل الصورة تماماً) */
.lecture-card.locked {
  background: #fff5f5; border-color: #fed7d7; cursor: not-allowed;
}
.lecture-header .lock-status {
  color: #e53e3e; font-size: 0.9rem; display: flex; align-items: center; gap: 6px;
}
.locked-warning-box {
  padding: 10px 1.2rem; background: #fff5f5;
  border-top: 1px solid #fe202020; color: #c53030;
  font-size: 0.85rem; font-weight: 600; display: flex; align-items: center; gap: 8px;
}


/* --- EXAMS OVERVIEW STYLES --- */
.exams-header-title h2 { font-size: 1.8rem; font-weight: 800; color: #2C1E0F; }
.exams-header-title p { color: #8A7B5E; font-size: 0.9rem; margin-bottom: 1.5rem; }

/* Grid Cards (الشهيرة بالأعلى) */
.exams-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-overview-card {
  background: #ffffff;
  border: 1px solid #E7D8BC;
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon-wrapper {
  width: 42px; height: 42px; border-radius: 10px;
  background: #F4ECDC; display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
}
.stat-icon-wrapper.red { background: #fef2f2; color: #ef4444; }
.stat-icon-wrapper.blue { background: #FAF3DE; color: #B8912E; }
.stat-icon-wrapper.green { background: #ecfdf5; color: #10b981; }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: #2C1E0F; }
.stat-value.red { color: #ef4444; }
.stat-value.blue { color: #B8912E; }
.stat-value.green { color: #10b981; }
.stat-label { font-size: 0.9rem; font-weight: 700; color: #2C1E0F; }
.stat-sublabel { font-size: 0.75rem; color: #B5A488; }

/* Filter Bar */
.exams-filter-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}

.search-input-box {
  flex: 1; min-width: 280px; position: relative;
}
.search-input-box input {
  width: 100%; padding: 10px 38px 10px 12px; border-radius: 8px;
  border: 1px solid #E7D8BC; background: #FAF5EA; outline: none;
}
.search-icon { position: absolute; right: 12px; top: 10px; color: #B5A488; }

.filter-actions { display: flex; gap: 10px; align-items: center; }
.select-dropdown {
  padding: 8px 14px; border-radius: 8px; border: 1px solid #E7D8BC;
  background: #fff; font-weight: 600; color: #6B5B43;
}

.view-switcher { display: flex; border: 1px solid #E7D8BC; border-radius: 8px; overflow: hidden; }
.switcher-btn {
  padding: 8px 14px; border: none; background: #fff; cursor: pointer; font-weight: 600;
}
.switcher-btn.active { background: #4A3B2C; color: #fff; }

/* Exam Item Card */
.exams-cards-container { display: flex; flex-direction: column; gap: 1rem; }

.exam-item-card {
  background: #ffffff; border: 1px solid #E7D8BC; border-radius: 12px; padding: 1.5rem;
}

.card-top-bar { margin-bottom: 8px; }
.status-badge {
  padding: 4px 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 700;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fee2e2; color: #b91c1c; }

.exam-item-title { font-size: 1.2rem; font-weight: 800; color: #2C1E0F; margin-bottom: 4px; }
.exam-breadcrumb { font-size: 0.85rem; color: #8A7B5E; margin-bottom: 8px; }
.exam-item-desc { font-size: 0.9rem; color: #6B5B43; margin-bottom: 1rem; }

.exam-meta-row {
  display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: 0.85rem; color: #8A7B5E;
  border-top: 1px dotted #E7D8BC; padding-top: 12px; margin-bottom: 1rem;
}
.score-highlight { font-weight: 800; color: #2C1E0F; }

.card-footer-action { display: flex; justify-content: flex-end; }
.btn-blue { background-color: #B8912E; color: #fff; padding: 8px 18px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; }
.btn-green { background-color: #16a34a; color: #fff; padding: 8px 18px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; }

/* --- EXAM REVIEW PAGE STYLES --- */
.review-top-nav { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.btn-back-outline {
  border: 1px solid #D9C9A8; background: #fff; padding: 6px 16px; border-radius: 8px;
  font-weight: 700; cursor: pointer; color: #4A3B2C;
}

.review-summary-card {
  background: #ffffff; border: 1px solid #E7D8BC; border-radius: 16px;
  padding: 2rem; text-align: center; margin-bottom: 1.5rem;
}

.review-title { font-size: 1.5rem; font-weight: 800; color: #2C1E0F; }
.review-subtitle { color: #8A7B5E; font-size: 0.9rem; margin-bottom: 1rem; }

.result-pill {
  display: inline-block; padding: 6px 20px; border-radius: 50px;
  font-weight: 800; font-size: 0.95rem; margin-bottom: 1.5rem;
}
.result-pill.fail { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }

.result-stats-boxes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 1.5rem;
}
@media (max-width: 600px) { .result-stats-boxes { grid-template-columns: 1fr; } }

.res-box {
  background: #FAF5EA; border: 1px solid #E7D8BC; border-radius: 12px; padding: 1.2rem;
  display: flex; align-items: center; justify-content: center; gap: 1rem;
}
.res-box-icon {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.res-box-icon.green { background: #dcfce7; color: #16a34a; }
.res-box-icon.blue { background: #F7E9BE; color: #B8912E; }

.res-box-content { display: flex; flex-direction: column; text-align: right; }
.res-label { font-size: 0.85rem; color: #8A7B5E; font-weight: 600; }
.res-val { font-size: 1.3rem; font-weight: 800; color: #2C1E0F; }

.review-notice-banner {
  background: #FAF3DE; border: 1px solid #E7D8BC; color: #8A6D1F;
  padding: 1rem; border-radius: 10px; font-weight: 600; font-size: 0.95rem; margin-bottom: 1rem;
}

.review-submission-date { font-size: 0.85rem; color: #B5A488; }

/* Question Navigator Card */
.question-nav-card {
  background: #ffffff; border: 1px solid #E7D8BC; border-radius: 12px;
  padding: 1.5rem; margin-bottom: 1.5rem;
}

.q-nav-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 10px;
}
.btn-filter-wrong {
  border: 1px solid #D9C9A8; background: #FAF5EA; padding: 8px 14px;
  border-radius: 8px; font-weight: 700; color: #4A3B2C; cursor: pointer;
}

.questions-numbers-grid {
  display: flex; flex-wrap: wrap; gap: 8px; direction: ltr; justify-content: flex-end;
}
.q-num-pill {
  width: 34px; height: 34px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 0.85rem; cursor: pointer;
}
.q-num-pill.correct { background: #dcfce7; color: #16a34a; border: 1px solid #86efac; }
.q-num-pill.wrong { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }

/* Questions Review List */
.q-review-item {
  background: #fff; border: 1px solid #E7D8BC; border-radius: 12px;
  padding: 1.2rem; margin-bottom: 1rem;
}
.q-review-header { display: flex; justify-content: space-between; margin-bottom: 10px; }
.q-badge.success { color: #16a34a; font-weight: 700; }
.q-badge.danger { color: #dc2626; font-weight: 700; }

/* --- MODERN LECTURE VIEW & TABS STYLES --- */

/* هيدر المحاضرة */
.lecture-view-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 1.5rem;
}

.btn-back-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  transition: var(--transition);
}
.btn-back-link:hover {
  color: var(--primary-hover);
  transform: translateX(4px);
}

.current-lecture-head {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
}

/* شريط التبويبات الحديث */
.tabs-nav-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 6px;
  display: flex;
  max-width: 100%;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.tabs-header {
  display: flex;
  gap: 6px;
  border-bottom: none !important; /* إلغاء الخط السفلي القديم */
}

.tab-btn {
  background: transparent;
  border: none !important;
  outline: none !important;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-main);
  background: var(--bg-main);
}

/* التبويب النشط */
.tab-btn.active {
  background: var(--primary) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.25);
}

/* كارت بدء الامتحان الاحترافي */
.exam-start-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  flex-wrap: wrap;
}

.exam-start-icon {
  width: 65px;
  height: 65px;
  border-radius: 14px;
  background: #ecfdf5;
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}

.exam-start-details {
  flex: 1;
}

.exam-start-details h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.exam-start-details p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.exam-meta-pills {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-pill {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main);
}

.exam-start-action .btn-lg {
  padding: 12px 28px;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

/* كارت مشغل الفيديو */
.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

@media (max-width: 768px) {
  .exam-start-card {
    flex-direction: column;
    text-align: center;
  }
  .exam-start-icon {
    margin: 0 auto;
  }
  .exam-meta-pills {
    justify-content: center;
  }
  .exam-start-action {
    width: 100%;
  }
  .exam-start-action button {
    width: 100%;
  }
}

/* --- PROFESSIONAL PROFILE SETTINGS STYLES --- */

.profile-card-container {
  max-width: 850px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.profile-card-header {
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.profile-card-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.profile-card-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-section-block {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1.2rem;
}

/* Grids for inputs */
.form-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

.form-grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .form-grid-2col, .form-grid-3col {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Inputs with Icons */
.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper .input-icon {
  position: absolute;
  right: 14px;
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 2;
}

.input-icon-wrapper .form-control {
  padding-right: 42px !important;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-main);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary);
  background-color: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.1);
}

.divider-line {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 2rem 0;
}

/* Actions Footer */
.profile-actions-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.profile-actions-footer .btn-lg {
  padding: 12px 32px;
  font-size: 1rem;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

/* Logout Danger Zone */
.logout-danger-zone {
  margin-top: 2.5rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

[data-theme="dark"] .logout-danger-zone {
  background: #2c1a1d;
  border-color: #4a2428;
}

.danger-info h4 {
  color: #dc2626;
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 2px;
}

[data-theme="dark"] .danger-info h4 {
  color: #f87171;
}

.danger-info p {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- SLIDE DOWN ANIMATION FOR EXAM REVIEW --- */

.exam-item-card.expandable {
  position: relative;
  transition: all 0.3s ease;
}

/* حاوية التفاصيل المنزلقة */
.review-slide-container {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.5s cubic-bezier(0, 1, 0, 1), opacity 0.4s ease;
}

.exam-item-card.expanded .review-slide-container {
  transition: max-height 0.6s ease-in-out, opacity 0.4s ease;
  margin-top: 1.5rem;
  border-top: 1px dashed var(--border-color);
  padding-top: 1rem;
}

.toggle-review-btn .arrow-icon {
  display: inline-block;
  transition: transform 0.3s ease;
}

.exam-item-card.expanded .toggle-review-btn .arrow-icon {
  transform: rotate(180deg);
}

/* --- MODERN SUPPORT & FAQ STYLES --- */

.support-header-title h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}
.support-header-title p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.8rem;
}

/* Support Channels Grid */
.support-channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

.support-channel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  transition: var(--transition);
}

.support-channel-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.04);
}

.whatsapp-card { border-top: 4px solid var(--whatsapp); }
.telegram-card { border-top: 4px solid #0088cc; }

.channel-icon {
  width: 50px; height: 50px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
}
.whatsapp-card .channel-icon { background: #dcfce7; }
.telegram-card .channel-icon { background: #e0f2fe; }

.channel-info h3 {
  font-size: 1.2rem; font-weight: 800; color: var(--text-main); margin-bottom: 4px;
}
.channel-info p {
  font-size: 0.88rem; color: var(--text-muted); margin-bottom: 8px;
}
.work-hours {
  font-size: 0.8rem; font-weight: 700; color: var(--success); display: inline-block;
}

.btn-telegram {
  background-color: #0088cc; color: #fff; text-decoration: none;
}

/* FAQ Accordion Styling */
.faq-section-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.8rem;
  margin-bottom: 2.5rem;
}

.faq-header h3 {
  font-size: 1.3rem; font-weight: 800; color: var(--text-main); margin-bottom: 4px;
}
.faq-header p {
  color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.2rem;
}

.accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--bg-card);
  transition: var(--transition);
}

.accordion-header {
  width: 100%;
  padding: 1.1rem 1.3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: none;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.accordion-header:hover {
  background: var(--bg-main);
}

.accordion-header .q-title {
  display: flex; align-items: center; gap: 10px;
}
.accordion-header .q-title i {
  font-style: normal; font-size: 1.1rem;
}

.accordion-arrow {
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  background: var(--bg-main);
  padding: 0 1.3rem;
  border-top: 0px solid transparent;
}

.accordion-item.open .accordion-content {
  padding: 1.1rem 1.3rem;
  max-height: 300px;
  border-top: 1px solid var(--border-color);
}

.accordion-content p {
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.6;
}

/* Support Ticket Form Card */
.support-ticket-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.8rem;
}

.support-ticket-card h3 {
  font-size: 1.2rem; font-weight: 800; color: var(--text-main); margin-bottom: 1.2rem;
}

.ticket-submit-row {
  display: flex; justify-content: flex-end; margin-top: 1.2rem;
}
/* ============================================================
   تنسيقات الوضع الليلي لقسم الامتحانات والمراجعة
   ============================================================ */

/* استهداف العناوين والنصوص الأساسية */
[data-theme="dark"] #results .exams-header-title h2,
[data-theme="dark"] #results .exams-header-title p {
  color: var(--text-main);
}

/* كروت الإحصائيات */
[data-theme="dark"] .stat-overview-card {
  background-color: var(--bg-card); 
  border-color: var(--border-color);
}

[data-theme="dark"] .stat-overview-card .stat-label {
  color: var(--text-main);
}

[data-theme="dark"] .stat-overview-card .stat-sublabel {
  color: var(--text-muted);
}

[data-theme="dark"] .stat-icon-wrapper {
  background-color: var(--bg-main);
}

/* شريط البحث والفلترة */
[data-theme="dark"] .search-input-box input,
[data-theme="dark"] .filter-actions .select-dropdown {
  background-color: var(--bg-main);
  color: var(--text-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .search-input-box input::placeholder {
  color: var(--text-muted);
}

[data-theme="dark"] .switcher-btn {
  background-color: var(--bg-card);
  color: var(--text-muted);
  border-color: var(--border-color);
}

[data-theme="dark"] .switcher-btn.active {
  background-color: var(--primary);
  color: #fff;
}

/* كروت الامتحانات */
[data-theme="dark"] .exam-item-card {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .exam-item-title,
[data-theme="dark"] .review-title,
[data-theme="dark"] .section-heading,
[data-theme="dark"] .score-highlight {
  color: var(--text-main);
}

[data-theme="dark"] .exam-breadcrumb,
[data-theme="dark"] .exam-item-desc {
  color: var(--text-muted);
}

[data-theme="dark"] .exam-meta-row span {
  color: var(--text-muted);
}

[data-theme="dark"] .exam-meta-row {
  border-color: var(--border-color);
}

/* الحاوية المنزلقة للمراجعة */
[data-theme="dark"] .review-summary-card,
[data-theme="dark"] .question-nav-card,
[data-theme="dark"] .q-review-item {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

/* ألوان الإحصائيات داخل المراجعة */
[data-theme="dark"] .res-box {
  background-color: var(--bg-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .res-label {
  color: var(--text-muted);
}

[data-theme="dark"] .res-val {
  color: var(--text-main);
}

/* شريط الملاحظة (Banner) */
[data-theme="dark"] .review-notice-banner {
  background-color: rgba(212, 175, 55, 0.1); /* لون أزرق خفيف */
  color: #D4AF37;
  border-color: rgba(212, 175, 55, 0.3);
}

[data-theme="dark"] .review-submission-date {
  color: var(--text-muted);
}

/* قائمة الأسئلة والخيارات */
[data-theme="dark"] .q-text,
[data-theme="dark"] .q-nav-label {
  color: var(--text-main);
}

[data-theme="dark"] .choice-item {
  background-color: var(--bg-main);
  color: var(--text-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .btn-filter-wrong {
  background-color: var(--bg-main);
  border-color: var(--border-color);
  color: var(--text-main);
}

/* تظبيط ألوان الإجابات في الوضع الليلي */
[data-theme="dark"] .choice-item.correct,
[data-theme="dark"] .choice-item.right-answer {
  background-color: rgba(16, 185, 129, 0.15); /* لون أخضر شفاف */
  color: var(--success);
  border-color: var(--success);
}

[data-theme="dark"] .choice-item.wrong-user {
  background-color: rgba(239, 68, 68, 0.15); /* لون أحمر شفاف */
  color: var(--danger);
  border-color: var(--danger);
}

[data-theme="dark"] .choice-item.opacity-50 {
  opacity: 0.6;
}

[data-theme="dark"] .exam-item-card.expanded .review-slide-container {
  border-color: var(--border-color);
}
/* ============================================================
   تنسيقات الوضع الليلي لقسم تفاصيل الكورس والمحاضرات (Level 2)
   ============================================================ */

/* الهيدر العلوي للكورس (Hero Card) */
[data-theme="dark"] .course-hero-card {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  box-shadow: none; 
}

[data-theme="dark"] .hero-title {
  color: var(--text-main);
}

[data-theme="dark"] .hero-subtitle {
  color: var(--text-muted);
}

/* الإحصائيات (الأرقام والنصوص) */
[data-theme="dark"] .stat-num {
  color: var(--warning); /* لون برتقالي/أصفر مناسب للوضع الليلي ليتماشى مع التصميم */
}

[data-theme="dark"] .stat-label {
  color: var(--text-muted);
}

/* معلومات الاشتراك (التاج والتاريخ) */
[data-theme="dark"] .meta-date,
[data-theme="dark"] .meta-tag {
  background-color: var(--bg-main);
  color: var(--text-muted);
}

/* زر العودة */
[data-theme="dark"] .btn-back-hero {
  background-color: var(--bg-main);
  border-color: var(--border-color);
  color: var(--text-main);
}

[data-theme="dark"] .btn-back-hero:hover {
  background-color: var(--border-color);
}

/* صندوق محتوى الكورس (Accordion Box) */
[data-theme="dark"] .course-content-box {
  background-color: var(--bg-card);
  border-color: var(--border-color);
}

[data-theme="dark"] .box-title {
  color: var(--warning);
  border-bottom-color: rgba(245, 158, 11, 0.2); /* خط سفلي خفيف ليتماشى مع العنوان */
}

/* ----------------------------------------------------
   تنسيقات كروت المحاضرات (التي سيتم توليدها بـ JavaScript)
   ---------------------------------------------------- */
   
[data-theme="dark"] .lecture-card {
  background-color: var(--bg-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .lecture-card.unlocked:hover {
  border-color: var(--primary);
}

/* المحاضرة المغلقة (Locked) */
[data-theme="dark"] .lecture-card.locked {
  background-color: rgba(239, 68, 68, 0.05); /* خلفية حمراء داكنة جداً وشفافة */
  border-color: rgba(239, 68, 68, 0.2);
}

[data-theme="dark"] .lecture-header {
  color: var(--text-main);
}

[data-theme="dark"] .lecture-header .lock-status {
  color: #f87171; /* لون أحمر فاتح للوضع الليلي */
}

[data-theme="dark"] .locked-warning-box {
  background-color: rgba(239, 68, 68, 0.05);
  border-top-color: rgba(239, 68, 68, 0.1);
  color: #fca5a5; /* لون أحمر هادئ للنص */
}



















.files-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.8rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

.files-card-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.files-card-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.pdf-files-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pdf-file-item {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  transition: var(--transition);
}

.pdf-file-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.pdf-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: #fee2e2;
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.pdf-info {
  flex: 1;
}

.pdf-info h4 {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 2px;
}

.pdf-info span {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.pdf-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 600px) {
  .pdf-file-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .pdf-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
/* ==================== Phase 9 Student Portal Additions ==================== */

/* Toast notifications */
.toast-container { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #2C1E0F; color: #F5EFE6; padding: 12px 22px; border-radius: 10px; font-weight: 700; font-size: 0.92rem; box-shadow: 0 8px 24px rgba(0,0,0,0.18); border-right: 4px solid var(--primary); max-width: 90vw; }
.toast.success { border-right-color: #16a34a; }
.toast.error { border-right-color: #dc2626; }
.toast.warning { border-right-color: #d97706; }

/* Sidebar notifications badge */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #dc2626; color: #fff; font-size: 0.75rem; font-weight: 800; margin-inline-start: 6px; }

/* Empty state */
.empty-state { text-align: center; color: #8A7B5E; font-weight: 700; padding: 2rem 1rem; }

/* Course cards (available/enrolled) */
.course-meta { font-size: 0.82rem; color: #8A7B5E; font-weight: 700; margin: 6px 0 4px; }
.course-desc { font-size: 0.88rem; color: #6B5B43; line-height: 1.7; min-height: 2.6em; }
.course-price { font-weight: 800; color: #2C1E0F; margin: 10px 0; }
.course-lessons { font-weight: 700; color: #8A7B5E; font-size: 0.82rem; margin-inline-start: 8px; }

/* Progress bar */
.progress-bar-container { height: 8px; background: #F0E7D4; border-radius: 8px; overflow: hidden; margin: 10px 0 4px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, #D4AF37, #B8912E); border-radius: 8px; transition: width 0.5s ease; }
.progress-text { font-size: 0.82rem; color: #8A7B5E; font-weight: 700; }

/* Lecture list */
.lecture-open-hint { color: var(--primary); font-weight: 700; }
.lecture-meta { font-size: 0.8rem; color: #8A7B5E; font-weight: 700; margin-top: 6px; }

/* Exam interface */
.exam-sidebar { background: #FAF5EA; border: 1px solid #E7D8BC; border-radius: 12px; padding: 1rem; min-width: 190px; }
.exam-main { flex: 1; }
.question-number { font-weight: 700; color: #8A7B5E; margin-bottom: 10px; }
.question-text { font-size: 1.15rem; font-weight: 800; color: #2C1E0F; line-height: 1.8; margin-bottom: 1rem; }
.exam-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 1.2rem; }
.btn-full { width: 100%; margin-top: 1rem; }
.essay-input { width: 100%; background: #FAF5EA; border: 1px solid #E7D8BC; border-radius: 10px; color: #2C1E0F; font-family: 'Cairo', sans-serif; font-size: 0.95rem; padding: 12px; }

/* Result pill pending */
.result-pill.pass { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.result-pill.pending { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }

/* More badges */
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-danger { background: #fee2e2; color: #b91c1c; }

/* Review additions */
.review-questions-section { margin-top: 1.5rem; }
.questions-review-list { display: flex; flex-direction: column; gap: 1rem; }
.q-choices { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.choice-item.correct { background: #dcfce7; color: #15803d; padding: 9px 12px; border-radius: 8px; font-weight: 700; }
.choice-item.wrong-user { background: #fee2e2; color: #dc2626; padding: 9px 12px; border-radius: 8px; font-weight: 700; }
.q-explanation { margin-top: 10px; padding: 8px 12px; background: #FAF5EA; border-radius: 8px; font-size: 0.85rem; color: #6B5B43; font-weight: 600; }
.q-answer-text { font-size: 0.9rem; color: #2C1E0F; font-weight: 600; margin-top: 6px; }
.q-answer-text.correct { color: #15803d; }

/* Notifications */
.notifications-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.unread-count { font-weight: 800; color: #8A7B5E; }
.notifications-list { display: flex; flex-direction: column; gap: 0.75rem; }
.notification-item { background: #fff; border: 1px solid #E7D8BC; border-radius: 12px; padding: 1rem 1.2rem; cursor: pointer; transition: all 0.25s ease; }
.notification-item:hover { border-color: var(--primary); }
.notification-item.unread { background: #FAF0D9; border-color: #E4C96A; }
.notification-content h4 { font-weight: 800; color: #2C1E0F; margin-bottom: 4px; }
.notification-content p { font-size: 0.9rem; color: #6B5B43; line-height: 1.7; }
.notification-date { font-size: 0.78rem; color: #B5A488; font-weight: 700; }

/* Profile forms + messages */
.profile-form { display: flex; flex-direction: column; gap: 1.2rem; }
.form-msg { min-height: 1.4em; text-align: center; font-weight: 700; font-size: 0.9rem; margin-top: 0.6rem; }
.form-msg.error { color: #ef4444; }
.form-msg.success { color: #10b981; }

/* Question grid nav buttons in exam */
.q-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid #E7D8BC; background: #fff; color: #2C1E0F; font-weight: 800; cursor: pointer; }
.q-btn.current { border-color: var(--primary); background: var(--primary); color: #fff; }
.q-btn.answered { background: #F0E7D4; border-color: #D4AF37; }
