/* ═══════════════════════════════════════════════════
   Uni-Course — ملف CSS الموحّد الرئيسي
   الترتيب:
     1. متغيرات الألوان والبُعد
     2. reset وعناصر مشتركة
     3. مكوّنات مشتركة (nav, logo, btn, toast…)
     4. صفحة index
     5. صفحة courses
     6. صفحة course
     7. لوحة التحكم (dashboard + admin)
     8. Responsive
   ═══════════════════════════════════════════════════ */

/* ── 1. متغيرات CSS المشتركة ── */
:root {
  --ink:          #0d1117;
  --surface:      #fff;
  --muted:        #f6f8fa;
  --border:       #e8edf2;
  --accent:       #2563eb;
  --accent2:      #1d4ed8;
  --accent-light: #eff6ff;
  --gold:         #f59e0b;
  --gold-light:   #fef3c7;
  --green:        #10b981;
  --green-light:  #d1fae5;
  --red:          #ef4444;
  --red-light:    #fee2e2;
  --purple:       #7c3aed;
  --purple-light: #ede9fe;
  --text:         #24292f;
  --text2:        #57606a;
  --text3:        #8c959f;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg:    0 8px 40px rgba(0,0,0,.12);
}

/* ── 2. Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html  { scroll-behavior: smooth; }
body  { font-family: 'Tajawal', sans-serif; background: var(--surface); color: var(--text); overflow-x: hidden; }
img   { max-width: 100%; display: block; }
a     { color: inherit; }

/* ── 3. مكوّنات مشتركة ── */

/* اللوجو */
.logo {
  font-family: 'Cairo', sans-serif;
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* صورة اللوجو — الحجم الطبيعي */
.logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 10px;
}
/* حجم صغير للشريط الجانبي */
.logo-img--sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.logo-text { color: var(--ink); }
/* فقرة الشريط الجانبي يبقى النص أبيض */
.sidebar .logo-text { color: #fff; }

/* الـ Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 66px;
}
.nav-links { display: flex; gap: 4px; list-style: none; }
.nav-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  transition: all .2s;
}
.nav-links a:hover,
.nav-links a.active { background: var(--accent-light); color: var(--accent); }
.nav-right { display: flex; gap: 10px; align-items: center; }

/* أزرار */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .2s;
  border: none;
  font-family: 'Tajawal', sans-serif;
}
.btn-ghost  { background: transparent; color: var(--text2); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--muted); color: var(--text); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.35); }
.btn-green  { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(.92); }
.btn-red    { background: var(--red); color: #fff; }
.btn-gold   { background: var(--gold); color: #fff; }
.btn-sm     { padding: 5px 12px; font-size: .8rem; }
.btn-lg     { padding: 13px 28px; font-size: 1rem; }

/* Toast */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: #fff;
  padding: 14px 28px;
  border-radius: 50px;
  font-size: .92rem;
  font-weight: 600;
  opacity: 0;
  transition: all .35s cubic-bezier(.34,1.56,.64,1);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  text-align: center;
}
.toast.show    { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.info    { background: var(--accent); }

/* Spinner */
.spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, #e8edf2 25%, #f6f8fa 50%, #e8edf2 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Fade-up animation */
.fade-up { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.fade-up.visible { opacity: 1; transform: translateY(0); }

/* Modal */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 18px;
  padding: 36px;
  width: 100%;
  max-width: 460px;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 32px; height: 32px;
  background: var(--muted);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}
.modal-close:hover { background: var(--border); }
.modal h2 { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.3rem; text-align: center; margin-bottom: 6px; color: var(--ink); }
.modal-sub { text-align: center; font-size: .85rem; color: var(--text2); margin-bottom: 24px; }
.tab-btns { display: flex; gap: 4px; background: var(--muted); padding: 4px; border-radius: 10px; margin-bottom: 24px; }
.tab-btn { flex: 1; padding: 9px; border: none; background: transparent; border-radius: 8px; cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--text2); transition: all .2s; font-family: 'Tajawal', sans-serif; }
.tab-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: .84rem; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .93rem;
  outline: none;
  transition: border .2s;
  font-family: 'Tajawal', sans-serif;
  color: var(--text);
  background: var(--surface);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--accent); }
.form-error { font-size: .8rem; color: var(--red); margin-top: 5px; display: none; }
.form-divider { text-align: center; font-size: .82rem; color: var(--text3); margin: 14px 0; }
.recaptcha-wrap { display: flex; justify-content: center; margin: 14px 0 4px; }

/* ── 4. الرئيسية (index) ── */

/* Hero */
.hero {
  background: linear-gradient(135deg, #0d1117 0%, #1a2744 55%, #0d1117 100%);
  padding: 100px 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% -20%, rgba(37,99,235,.28) 0%, transparent 70%);
}
.hero-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 60px 60px;
}
.hero-inner { max-width: 1000px; margin: 0 auto; text-align: center; position: relative; z-index: 1; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(37,99,235,.15);
  border: 1px solid rgba(37,99,235,.3);
  color: #93c5fd;
  font-size: .82rem;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 50px;
  margin-bottom: 28px;
}
.hero h1 { font-family: 'Cairo', sans-serif; font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 900; color: #fff; line-height: 1.2; margin-bottom: 20px; }
.hero h1 span { color: #60a5fa; }
.hero p { font-size: 1.1rem; color: #94a3b8; max-width: 560px; margin: 0 auto 40px; }
.hero-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 64px; }
.hero-stats { display: flex; gap: 48px; justify-content: center; flex-wrap: wrap; }
.hero-stat strong { display: block; font-family: 'Cairo', sans-serif; font-size: 2rem; font-weight: 900; color: #fff; }
.hero-stat span { font-size: .85rem; color: #64748b; }

/* Sections */
.section { padding: 80px 24px; }
.section-inner { max-width: 1200px; margin: 0 auto; }
.section-head { text-align: center; margin-bottom: 48px; }
.section-tag { display: inline-block; background: var(--accent-light); color: var(--accent); font-size: .78rem; font-weight: 700; padding: 4px 14px; border-radius: 50px; margin-bottom: 12px; letter-spacing: .5px; }
.section-title { font-family: 'Cairo', sans-serif; font-size: 2rem; font-weight: 900; color: var(--ink); margin-bottom: 10px; }
.section-sub { color: var(--text2); font-size: .97rem; max-width: 500px; margin: 0 auto; }

/* Categories grid */
.cats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .25s;
  text-decoration: none;
  color: var(--text);
  display: block;
}
.cat-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.cat-icon { font-size: 2.2rem; margin-bottom: 12px; display: block; }
.cat-card h3 { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .95rem; color: var(--ink); margin-bottom: 6px; }
.cat-count { font-size: .8rem; color: var(--text3); }

/* How steps */
.how-bg { background: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; position: relative; }
.steps::before { content: ''; position: absolute; top: 27px; right: 10%; left: 10%; height: 2px; background: linear-gradient(90deg, var(--accent), var(--gold)); border-radius: 1px; }
.step { text-align: center; position: relative; }
.step-num { width: 54px; height: 54px; background: var(--surface); border: 2px solid var(--accent); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 1.1rem; color: var(--accent); position: relative; z-index: 1; }
.step h3 { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .95rem; color: var(--ink); margin-bottom: 8px; }
.step p { font-size: .84rem; color: var(--text2); line-height: 1.6; }

/* CTA */
.cta-section { background: linear-gradient(135deg, var(--ink), #1a2744); padding: 80px 24px; text-align: center; position: relative; overflow: hidden; }
.cta-section::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse 80% 60% at 50% 50%, rgba(37,99,235,.15) 0%, transparent 70%); }
.cta-inner { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.cta-section h2 { font-family: 'Cairo', sans-serif; font-size: 2.2rem; font-weight: 900; color: #fff; margin-bottom: 14px; }
.cta-section p { color: #94a3b8; margin-bottom: 32px; }

/* Footer */
footer { background: var(--ink); color: #57606a; padding: 56px 0 24px; }
.footer-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 48px; margin-bottom: 40px; }
.footer-brand h3 { font-family: 'Cairo', sans-serif; font-size: 1.2rem; font-weight: 900; color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: .87rem; line-height: 1.7; }
.footer-col h4 { font-family: 'Cairo', sans-serif; font-weight: 700; color: #fff; margin-bottom: 16px; font-size: .9rem; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col ul li a { color: #57606a; text-decoration: none; font-size: .87rem; transition: color .2s; }
.footer-col ul li a:hover { color: #60a5fa; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.07); padding: 20px 24px 0; text-align: center; font-size: .82rem; max-width: 1200px; margin: 0 auto; }

/* ── 5. صفحة Courses ── */

.page-hero { background: linear-gradient(135deg, var(--ink) 0%, #1a2744 100%); padding: 48px 24px; }
.page-hero-inner { max-width: 1200px; margin: 0 auto; }
.breadcrumb { font-size: .8rem; color: #64748b; margin-bottom: 14px; }
.breadcrumb a { color: #94a3b8; text-decoration: none; }
.page-hero h1 { font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 2rem; color: #fff; margin-bottom: 8px; }
.page-hero p { color: #94a3b8; font-size: .97rem; }

.page-layout { max-width: 1200px; margin: 0 auto; padding: 32px 24px; display: grid; grid-template-columns: 256px 1fr; gap: 28px; }
.sidebar-filters { display: flex; flex-direction: column; gap: 14px; }
.filter-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.filter-card h3 { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .9rem; color: var(--ink); margin-bottom: 14px; }
.filter-item { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 8px; border-radius: 8px; transition: background .15s; }
.filter-item:hover { background: var(--muted); }
.filter-item input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.filter-item label { font-size: .86rem; color: var(--text2); cursor: pointer; flex: 1; }
.filter-item .cnt { font-size: .73rem; color: var(--text3); background: var(--muted); padding: 2px 7px; border-radius: 20px; }
.price-radios { display: flex; gap: 6px; flex-wrap: wrap; }
.price-radios label { display: flex; align-items: center; gap: 5px; font-size: .83rem; color: var(--text2); cursor: pointer; padding: 5px 12px; border: 1.5px solid var(--border); border-radius: 20px; transition: all .2s; }
.price-radios input[type=radio] { display: none; }
.price-radios input[type=radio]:checked + label { border-color: var(--accent); background: var(--accent-light); color: var(--accent); font-weight: 600; }
.search-inp { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .9rem; font-family: 'Tajawal', sans-serif; outline: none; transition: border .2s; }
.search-inp:focus { border-color: var(--accent); }

.courses-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.result-count { font-size: .86rem; color: var(--text2); }
.sort-sel { padding: 8px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .85rem; font-family: 'Tajawal', sans-serif; outline: none; cursor: pointer; }
.no-results { grid-column: 1/-1; text-align: center; padding: 56px 20px; }
.no-results span { font-size: 3rem; display: block; margin-bottom: 12px; }
.no-results h3 { font-family: 'Cairo', sans-serif; font-size: 1.1rem; color: var(--ink); margin-bottom: 8px; }

/* ── بطاقة الكورس (مشتركة بين index و courses) ── */
.courses-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.courses-grid--2col { grid-template-columns: repeat(2, 1fr); gap: 18px; }

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all .25s;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.course-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.course-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #1e3a5f, #0d1117);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  overflow: hidden;
}
.course-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.badge-price { position: absolute; top: 10px; right: 10px; background: var(--gold); color: #fff; font-weight: 700; font-size: .82rem; padding: 3px 12px; border-radius: 20px; }
.badge-free  { position: absolute; top: 10px; right: 10px; background: var(--green); color: #fff; font-weight: 700; font-size: .82rem; padding: 3px 12px; border-radius: 20px; }
.play-btn { position: absolute; bottom: 10px; left: 10px; width: 36px; height: 36px; background: rgba(255,255,255,.9); border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; font-size: .85rem; }
.course-card:hover .play-btn { opacity: 1; }
.course-body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.course-cat-label { font-size: .73rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 7px; }
.course-title { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: 1rem; color: var(--ink); margin-bottom: 8px; line-height: 1.4; }
.course-desc { font-size: .84rem; color: var(--text2); margin-bottom: 12px; flex: 1; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.course-meta { display: flex; gap: 10px; font-size: .78rem; color: var(--text3); margin-bottom: 12px; flex-wrap: wrap; }
.stars { color: var(--gold); }
.course-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid var(--border); }
.course-price { font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 1.05rem; }

/* ── 6. صفحة Course ── */

.course-hero { background: linear-gradient(135deg, var(--ink) 0%, #1a2744 100%); padding: 40px 24px; }
.course-hero-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr 360px; gap: 48px; align-items: start; }
.hero-cat { font-size: .75rem; font-weight: 700; color: #60a5fa; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }
.hero-title { font-family: 'Cairo', sans-serif; font-weight: 900; font-size: 1.85rem; color: #fff; line-height: 1.3; margin-bottom: 14px; }
.hero-desc { color: #94a3b8; font-size: .95rem; line-height: 1.7; margin-bottom: 20px; }
.hero-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: .83rem; color: #94a3b8; }
.instructor-mini { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.08); }
.inst-av { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--gold)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }
.inst-name { font-size: .88rem; font-weight: 600; color: #fff; }
.inst-role { font-size: .76rem; color: #64748b; }
.purchase-card { background: var(--surface); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-lg); position: sticky; top: 80px; }
.preview-thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #1e3a5f, var(--ink)); display: flex; align-items: center; justify-content: center; font-size: 5rem; position: relative; cursor: pointer; }
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.play-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); }
.play-circle { width: 60px; height: 60px; background: rgba(255,255,255,.92); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.card-body { padding: 22px; }
.price-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.price-main { font-family: 'Cairo', sans-serif; font-size: 2rem; font-weight: 900; color: var(--ink); }
.price-old  { font-size: 1.05rem; color: var(--text3); text-decoration: line-through; }
.disc-badge { background: var(--gold-light); color: #92400e; font-size: .75rem; font-weight: 700; padding: 2px 10px; border-radius: 20px; }
.includes { margin-top: 18px; }
.includes h4 { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .85rem; margin-bottom: 10px; }
.inc-item { display: flex; align-items: center; gap: 9px; font-size: .83rem; color: var(--text2); margin-bottom: 7px; }
.guarantee { text-align: center; margin-top: 14px; padding: 11px; background: var(--green-light); border-radius: var(--radius-sm); font-size: .8rem; color: #065f46; }
.course-main { max-width: 1200px; margin: 0 auto; padding: 36px 24px; display: grid; grid-template-columns: 1fr 360px; gap: 36px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.tab-link { padding: 10px 18px; border: none; background: transparent; cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--text2); border-bottom: 2px solid transparent; transition: all .2s; font-family: 'Tajawal', sans-serif; }
.tab-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── 7. لوحات التحكم (Dashboard + Admin) ── */

body.dashboard-body,
body.admin-body {
  background: var(--muted);
  display: flex;
  min-height: 100vh;
}

/* الشريط الجانبي */
.sidebar {
  width: 240px;
  background: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
}
.sidebar--wide { width: 256px; }
.sidebar-logo { padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-user { padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,.07); display: flex; gap: 10px; align-items: center; }
.user-av { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--gold)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: .9rem; flex-shrink: 0; }
.user-name { font-size: .85rem; font-weight: 600; color: #fff; }
.user-role  { font-size: .72rem; color: #64748b; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-sec { padding: 7px 15px 3px; font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: #4a5568; font-weight: 600; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 17px;
  color: #94a3b8;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  transition: all .2s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  font-family: 'Tajawal', sans-serif;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.nav-item.active { background: rgba(37,99,235,.15); color: #60a5fa; border-right: 3px solid var(--accent); }
.sidebar-bottom { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.btn-logout { display: flex; align-items: center; gap: 8px; padding: 8px 13px; color: #64748b; border: none; background: transparent; font-family: 'Tajawal', sans-serif; font-size: .84rem; cursor: pointer; border-radius: 8px; width: 100%; transition: all .2s; }
.btn-logout:hover { background: rgba(239,68,68,.1); color: #f87171; }

/* المنطقة الرئيسية */
.main { margin-right: 240px; flex: 1; display: flex; flex-direction: column; }
.main--wide { margin-right: 256px; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 24px; height: 60px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 40; }
.topbar-title { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1.02rem; color: var(--ink); }
.page-content { padding: 24px; flex: 1; }

/* Panels */
.panel { display: none; }
.panel.active { display: block; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 7px; }
.stat-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; }
.stat-num { font-family: 'Cairo', sans-serif; font-size: 1.7rem; font-weight: 900; color: var(--ink); }
.stat-label { font-size: .78rem; color: var(--text2); }

/* Card */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-title { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .93rem; color: var(--ink); margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; }

/* My-courses grid */
.my-courses-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.my-course { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: all .2s; text-decoration: none; color: var(--text); }
.my-course:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.my-course-thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #1e3a5f, var(--ink)); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; overflow: hidden; position: relative; }
.my-course-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.my-course-body { padding: 14px; }
.my-course-title { font-family: 'Cairo', sans-serif; font-weight: 700; font-size: .88rem; color: var(--ink); margin-bottom: 9px; line-height: 1.4; }
.prog-bar { height: 5px; background: var(--border); border-radius: 3px; margin-bottom: 5px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.prog-label { font-size: .73rem; color: var(--text3); display: flex; justify-content: space-between; }
.empty-state { text-align: center; padding: 44px 20px; }
.empty-state span { font-size: 2.8rem; display: block; margin-bottom: 10px; }
.empty-state h3 { font-family: 'Cairo', sans-serif; font-size: 1.05rem; color: var(--ink); margin-bottom: 7px; }
.empty-state p { color: var(--text2); font-size: .86rem; }

/* Messages */
.msg-bubble-out { background: var(--muted); border-radius: 12px 12px 4px 12px; padding: 12px 16px; margin-bottom: 10px; }
.msg-bubble-in  { background: linear-gradient(135deg, #eff6ff, #dbeafe); border-radius: 12px 12px 12px 4px; padding: 12px 16px; margin-bottom: 10px; border-right: 3px solid var(--accent); }
.msg-type-btn { padding: 10px; border: 1.5px solid var(--border); border-radius: 8px; text-align: center; cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--text2); transition: all .2s; }
.msg-type-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.msg-type-btn:hover { background: var(--muted); }

/* Table (admin) */
table { width: 100%; border-collapse: collapse; }
th { text-align: right; padding: 11px 14px; font-size: .78rem; color: var(--text3); font-weight: 600; border-bottom: 1px solid var(--border); background: var(--muted); }
td { padding: 13px 14px; font-size: .85rem; color: var(--text); border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--muted); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: .73rem; font-weight: 600; }
.bg-green   { background: var(--green-light); color: #065f46; }
.bg-gold    { background: var(--gold-light); color: #92400e; }
.bg-red     { background: var(--red-light); color: #991b1b; }
.bg-purple  { background: var(--purple-light); color: #5b21b6; }
.bg-accent  { background: var(--accent-light); color: var(--accent); }
.bg-orange  { background: #fff7ed; color: #c2410c; }
.bg-gray    { background: #f1f5f9; color: #475569; }

/* Detail Modal (admin) */
.detail-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.detail-box { background: #fff; border-radius: 16px; width: 100%; max-width: 580px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.detail-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; border-radius: 16px 16px 0 0; z-index: 1; }
.detail-header h3 { font-family: 'Cairo', sans-serif; font-weight: 800; font-size: 1rem; color: var(--ink); }
.detail-close { width: 32px; height: 32px; border: none; background: var(--muted); border-radius: 50%; cursor: pointer; font-size: 1rem; }
.detail-body { padding: 22px; }
.detail-avatar { width: 64px; height: 64px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--gold)); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 1.5rem; margin: 0 auto 14px; }
.detail-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.info-item { background: var(--muted); border-radius: 8px; padding: 11px 13px; }
.info-label { font-size: .7rem; color: var(--text3); font-weight: 600; margin-bottom: 3px; }
.info-value { font-size: .86rem; font-weight: 600; color: var(--ink); }
.action-btns { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ── 8. Responsive ── */

@media (max-width: 1100px) {
  .course-hero-inner,
  .course-main { grid-template-columns: 1fr; }
  .purchase-card { position: static; }
}
@media (max-width: 1000px) {
  .cats-grid           { grid-template-columns: repeat(3, 1fr); }
  .courses-grid        { grid-template-columns: repeat(2, 1fr); }
  .steps               { grid-template-columns: repeat(2, 1fr); }
  .steps::before       { display: none; }
  .footer-inner        { grid-template-columns: 1fr 1fr; }
  .stats-grid          { grid-template-columns: repeat(2, 1fr); }
  .my-courses-grid     { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .page-layout         { grid-template-columns: 1fr; }
  .sidebar-filters     { display: none; }
  .courses-grid--2col  { grid-template-columns: 1fr; }
  .sidebar             { display: none; }
  .main                { margin-right: 0; }
  .main--wide          { margin-right: 0; }
  .stats-grid          { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .cats-grid           { grid-template-columns: repeat(2, 1fr); }
  .courses-grid        { grid-template-columns: 1fr; }
  .steps               { grid-template-columns: 1fr; }
  .footer-inner        { grid-template-columns: 1fr; }
  .nav-links           { display: none; }
  .hero-stats          { gap: 24px; }
  .my-courses-grid     { grid-template-columns: 1fr; }
}
