:root {
  --primary: #102A43;
  --primary-end: #486581;
  --accent: #00D1B2;
  --bg: #F0F4F8;
  --surface: #FFFFFF;
  --text: #102A43;
  --text-muted: #486581;
  --text-tertiary: #829AB1;
  --border: #BCCCDC;
  --success: #16A34A;
  --warning: #EAB308;
  --error: #DC2626;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(16, 42, 67, 0.08);
  --shadow-lg: 0 20px 48px rgba(16, 42, 67, 0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma,
    'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary-end); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ─── Navbar ─── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  backdrop-filter: saturate(180%) blur(20px);
  background: rgba(255, 255, 255, 0.92);
}
.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.navbar .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  color: var(--text);
}
.navbar .logo img { width: 36px; height: 36px; border-radius: 10px; }
.navbar nav { display: flex; gap: 20px; align-items: center; }
.navbar nav a {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
}
.navbar nav a.active, .navbar nav a:hover {
  color: var(--primary); text-decoration: none;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* ─── Hero ─── */
.hero {
  padding: 72px 0 56px;
  text-align: center;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
}
.hero h1 {
  font-size: 44px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.hero p {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 28px;
}
.hero .ctas {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-end));
  color: white;
  box-shadow: 0 8px 20px rgba(16, 42, 67, 0.25);
}
.btn-primary:hover { box-shadow: 0 12px 28px rgba(16, 42, 67, 0.35); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 14px 26px; font-size: 16px; }

/* ─── Sections ─── */
section {
  padding: 56px 0;
}
section h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text);
}
section h2 + p {
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* ─── Course grid ─── */
.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.course-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.course-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.course-card .thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #6C63FF, #4158D0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 48px;
}
.course-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.course-card .body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.course-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text);
}
.course-card .instructor {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.course-card .price-row {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.course-card .price {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.course-card .price.free { color: var(--success); }
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(0, 209, 178, 0.12);
  color: var(--accent);
}

/* ─── Forms ─── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  max-width: 520px;
  margin: 0 auto;
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.08);
  background: var(--surface);
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
  min-height: 18px;
}

.file-drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg);
}
.file-drop:hover { border-color: var(--primary); background: rgba(16, 42, 67, 0.02); }
.file-drop .icon { font-size: 32px; margin-bottom: 8px; opacity: 0.6; }
.file-drop .hint { color: var(--text-tertiary); font-size: 12px; margin-top: 4px; }
.file-drop.has-file { border-color: var(--success); background: rgba(22, 163, 74, 0.04); }

/* ─── Alerts ─── */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-info {
  background: rgba(16, 42, 67, 0.06);
  color: var(--primary);
  border: 1px solid rgba(16, 42, 67, 0.12);
}
.alert-success {
  background: rgba(22, 163, 74, 0.08);
  color: var(--success);
  border: 1px solid rgba(22, 163, 74, 0.2);
}
.alert-error {
  background: rgba(220, 38, 38, 0.08);
  color: var(--error);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

/* ─── Payment methods list ─── */
.payment-methods { display: flex; flex-direction: column; gap: 10px; }
.payment-methods label {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
}
.payment-methods label:hover { border-color: var(--primary); }
.payment-methods input[type=radio]:checked + .method-info {
  color: var(--primary);
}
.payment-methods label:has(input:checked) {
  border-color: var(--primary);
  background: rgba(16, 42, 67, 0.03);
  box-shadow: 0 0 0 3px rgba(16, 42, 67, 0.06);
}
.method-info { flex: 1; }
.method-info .title { font-weight: 700; font-size: 15px; }
.method-info .lines { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* ─── Empty state ─── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.empty .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.6; }

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(16, 42, 67, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  padding: 32px 0;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

/* ─── Course detail ─── */
.course-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-end));
  color: white;
  padding: 48px 0 40px;
}
.course-hero h1 {
  font-size: 34px;
  font-weight: 800;
  margin-bottom: 10px;
}
.course-hero .meta {
  opacity: 0.85;
  font-size: 15px;
}
.course-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 28px;
  margin-top: -20px;
  position: relative;
}
.course-sidebar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 80px;
  height: fit-content;
}
.course-sidebar .price-tag {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 14px;
}
.course-main {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.course-main h2 { font-size: 20px; margin-bottom: 12px; }
.course-main p { color: var(--text-muted); }
.lesson-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.lesson-item:last-child { border-bottom: none; }
.lesson-item .num {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .course-layout { grid-template-columns: 1fr; }
  .course-sidebar { position: static; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 16px; }
  section { padding: 40px 0; }
  .navbar nav { gap: 10px; }
  .navbar nav a { font-size: 13px; }
}