﻿/* ==========================================================================
   Darsi Design System â€” flat, clean, Stripe/Linear/Vercel-inspired
   ========================================================================== */

:root {
  /* Brand emerald â€” single primary, no gradient scale needed beyond hover/active */
  --brand-800: #065f46;
  --brand-700: #047857;
  --brand-600: #059669;
  --brand-500: #10b981;
  --brand-400: #34d399;
  --brand-300: #6ee7b7;
  --brand-100: #d1fae5;
  --brand-50: #ecfdf5;

  /* Neutrals (slate) */
  --white: #ffffff;
  --gray-950: #020617;
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;

  /* Semantic (flat, low-saturation) */
  --green-700: #0f7a3d;
  --green-600: #16a34a;
  --green-100: #dcfce7;
  --green-50: #f0fdf4;
  --red-700: #b91c1c;
  --red-600: #dc2626;
  --red-100: #fee2e2;
  --red-50: #fef2f2;
  --amber-700: #92400e;
  --amber-600: #d97706;
  --amber-100: #fef3c7;
  --amber-50: #fffbeb;

  /* Surfaces */
  --bg-app: #f8fafc;
  --surface: var(--white);
  --border: var(--gray-200);
  --text: var(--gray-900);
  --text-muted: var(--gray-500);

  /* Spacing (8px system) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;

  /* Radius â€” soft, modern, rounded system built around a 14px card radius. */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --radius-full: 999px;
  --radius-btn: 10px;

  /* Shadows â€” soft, low-opacity, no color tint */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 24px 56px rgba(15, 23, 42, 0.16);
  --shadow-focus: 0 0 0 4px rgba(5, 150, 105, 0.15);

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 140ms;
  --t-base: 200ms;
  --t-slow: 320ms;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, Helvetica, Arial, sans-serif;
  --header-h: 68px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* ===========================================================================
   Page layouts that pair a main column with a sidebar.
   These used to be inline `style="grid-template-columns: ..."` on the element,
   which no media query can override (inline styles beat stylesheet rules), so
   they stayed multi-column on phones and crushed the content column.
   =========================================================================== */
.catalog-layout,
.detail-layout,
.cart-layout {
  display: grid;
  gap: var(--sp-5);
  align-items: start;
}

.catalog-layout { grid-template-columns: 260px 1fr; }
.detail-layout { grid-template-columns: 1fr 340px; }
.cart-layout { grid-template-columns: 1fr 320px; }

/* Grid items default to `min-width: auto`, i.e. they refuse to shrink below their content's
   intrinsic minimum. A single wide table (`.table-wrap table { min-width: 480px }`) was
   therefore stretching its whole track — and the page — past the viewport, instead of
   scrolling inside its own `.table-wrap`. Letting the items shrink puts the scroll back where
   it belongs: on the table, not the document. */
.grid > *,
.stat-grid > *,
.dash-layout > *,
.learn-layout > *,
.catalog-layout > *,
.detail-layout > *,
.cart-layout > * {
  min-width: 0;
}

/* Buy box / order summary that follows the reader on desktop. Turned off once the
   layout stacks, otherwise it sticks to a column that is now full width. */
.sticky-side {
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--bg-app);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[dir="rtl"] { text-align: right; }

h1, h2, h3, h4 { font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--sp-3); color: var(--text); }
h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3.4rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 0.9vw, 2rem); }
h3 { font-size: 1.15rem; letter-spacing: -0.01em; }
p { margin: 0 0 var(--sp-3); color: var(--text); }

a { color: var(--brand-600); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--brand-700); }

img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.icon {
  width: 1em;
  height: 1em;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  vertical-align: -0.15em;
}
.icon-lg { width: 1.5em; height: 1.5em; }
.icon-xl { width: 2em; height: 2em; }
.icon-sm { width: 0.8em; height: 0.8em; }

/* ==========================================================================
   Navbar â€” flat white, compact, tight spacing
   ========================================================================== */

.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.brand:hover { color: var(--text); }
.brand .brand-mark {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand .brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.navbar-primary-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.nav-link {
  padding: 7px 12px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--gray-600);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.nav-link:hover { background: var(--gray-100); color: var(--text); text-decoration: none; }
.nav-link.active { color: var(--brand-600); }

.search-form { flex: 0 1 240px; margin-inline-start: auto; }
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-box .icon {
  position: absolute;
  inset-inline-start: 12px;
  color: var(--gray-400);
  pointer-events: none;
  width: 15px;
  height: 15px;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--gray-50);
  font-size: 0.85rem;
  transition: box-shadow var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
[dir="rtl"] .search-box input { padding: 8px 34px 8px 12px; }
.search-box input:focus { background: var(--surface); border-color: var(--brand-400); box-shadow: var(--shadow-focus); }

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-inline-start: auto;
}

.user-menu { position: relative; }
/* Sitewide nudge shown to signed-in users who have not confirmed their address yet.
   Sits directly under the navbar, above page content. */
.verify-banner {
  background: var(--amber-50, #fffbeb);
  border-bottom: 1px solid var(--amber-600, #d97706);
  color: #7c4a03;
  font-size: 0.88rem;
}

.verify-banner .container {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  padding-bottom: 10px;
}

.verify-banner a {
  color: #7c4a03;
  font-weight: 700;
  text-decoration: underline;
}
/* Cart button in the navbar. The count badge sits on the icon corner, so it needs a
   positioned parent and must stay clear of the RTL flip (hence inset-inline-end). */
.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  flex-shrink: 0;
}

.cart-link:hover,
.cart-link.active {
  border-color: var(--blue-600);
  color: var(--blue-700);
  background: var(--blue-50);
}

.cart-count {
  position: absolute;
  top: -5px;
  inset-inline-end: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--blue-600);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.83rem;
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease);
}
[dir="rtl"] .user-chip { padding: 4px 4px 4px 10px; }
.user-chip:hover { border-color: var(--gray-300); }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-600);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.76rem;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar-xl { width: 84px; height: 84px; font-size: 1.8rem; }

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), visibility var(--t-fast);
  z-index: 60;
}
.dropdown.open .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu a, .dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  text-align: start;
  cursor: pointer;
  font-family: inherit;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--gray-100); color: var(--text); text-decoration: none; }
.dropdown-menu .icon { color: var(--gray-400); }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 4px; }

.lang-switch { display: flex; gap: 1px; background: var(--gray-100); padding: 2px; border-radius: var(--radius-sm); }
.lang-switch a {
  padding: 5px 8px;
  border-radius: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--gray-500);
}
.lang-switch a:hover { color: var(--text); text-decoration: none; }
.lang-switch a.active { background: var(--surface); color: var(--brand-600); box-shadow: var(--shadow-xs); }

.mobile-nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.mobile-nav-panel {
  display: none;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.mobile-nav-panel.open { display: block; }

/* ==========================================================================
   Buttons â€” flat, Stripe/Linear style
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.89rem;
  line-height: 1;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  white-space: nowrap;
  position: relative;
}
.btn { will-change: transform; }

.btn-primary {
  background: var(--brand-600);
  color: var(--white);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--brand-700); color: var(--white); }

.btn-secondary {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }

.btn-danger {
  background: var(--red-600);
  color: var(--white);
  box-shadow: var(--shadow-xs);
}
.btn-danger:hover { background: var(--red-700); color: var(--white); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 26px; font-size: 0.98rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; border-radius: var(--radius-btn); }

.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; box-shadow: none !important; }

.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: white;
  animation: spin 0.7s linear infinite;
}
.btn-outline.is-loading::after, .btn-ghost.is-loading::after, .btn-secondary.is-loading::after {
  border: 2px solid var(--border);
  border-top-color: var(--brand-600);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group { margin-bottom: var(--sp-5); }
label, .field-label {
  display: block;
  font-weight: 600;
  margin-bottom: 7px;
  font-size: 0.85rem;
  color: var(--text);
}
.input-wrap { position: relative; }
.input-wrap .icon {
  position: absolute;
  inset-inline-start: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  pointer-events: none;
}
.input-wrap input { padding-inline-start: 40px; }
.input-wrap .input-suffix-btn {
  position: absolute;
  inset-inline-end: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
}
.input-wrap .input-suffix-btn:hover { color: var(--text); background: var(--gray-100); }

input, textarea, select {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--gray-400); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand-500); box-shadow: var(--shadow-focus); }
input:disabled, select:disabled, textarea:disabled { background: var(--gray-100); color: var(--text-muted); cursor: not-allowed; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-inline-end: 34px; }
[dir="rtl"] select { background-position: left 12px center; }

.form-group.has-error input, .form-group.has-error textarea, .form-group.has-error select { border-color: var(--red-600); }
.form-group.has-error .field-message { color: var(--red-600); }
.form-group.has-success input { border-color: var(--green-600); }
.field-message { font-size: 0.78rem; margin-top: 6px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.help-text { font-size: 0.8rem; color: var(--text-muted); margin-top: 5px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--brand-600); }

/* ==========================================================================
   Alerts
   ========================================================================== */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-4);
  font-size: 0.87rem;
  border: 1px solid transparent;
}
.alert .icon { margin-top: 2px; flex-shrink: 0; }
.alert-error { background: var(--red-50); color: var(--red-700); border-color: var(--red-100); }
.alert-success { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.alert-info { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.alert-warning { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }

/* ==========================================================================
   Cards / Grids
   ========================================================================== */

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: var(--sp-6);
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.card-flat { box-shadow: none; }
.card-hover:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ==========================================================================
   Badges
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.5;
}
.badge-blue { background: var(--brand-100); color: var(--brand-700); }
.badge-green { background: var(--green-100); color: var(--green-700); }
.badge-amber { background: var(--amber-100); color: var(--amber-700); }
.badge-red { background: var(--red-100); color: var(--red-700); }
.badge-gray { background: var(--gray-200); color: var(--gray-700); }
.badge-dark { background: var(--gray-900); color: var(--white); }
.badge-solid { background: var(--brand-600); color: white; }

/* ==========================================================================
   Course cards
   ========================================================================== */

.course-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
  display: flex;
  flex-direction: column;
  color: var(--text);
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--gray-300); text-decoration: none; }
.course-card .thumb {
  position: relative;
  height: 148px;
  background: var(--brand-50);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-600);
  font-weight: 800;
  font-size: 1.4rem;
  overflow: hidden;
}
.course-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--t-slow) var(--ease); }
.course-card:hover .thumb img { transform: scale(1.04); }
.course-card .thumb-badges { position: absolute; top: 10px; inset-inline-start: 10px; right: auto; display: flex; gap: 6px; }
[dir="rtl"] .course-card .thumb-badges { inset-inline-start: auto; inset-inline-end: 10px; }
.course-card .thumb-price {
  position: absolute;
  bottom: 10px;
  inset-inline-end: 10px;
  background: var(--white);
  color: var(--text);
  font-weight: 800;
  font-size: 0.82rem;
  padding: 4px 11px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
}
.course-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-card .cat-label { font-size: 0.72rem; font-weight: 700; color: var(--brand-600); text-transform: uppercase; letter-spacing: 0.03em; }
.course-card .title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--gray-900);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.course-card .instructor-row { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--text-muted); }
.course-card .meta-row { display: flex; align-items: center; gap: 12px; font-size: 0.78rem; color: var(--text-muted); flex-wrap: wrap; }
.course-card .meta-row span { display: inline-flex; align-items: center; gap: 4px; }
.course-card .rating-row { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; }
.course-card .rating-row .stars { color: var(--amber-600); font-weight: 700; }
.course-card .price-row { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); }
.course-card .price { font-weight: 800; font-size: 1.05rem; color: var(--text); }
.course-card .price.is-free { color: var(--green-600); }

/* ==========================================================================
   Hero / Landing
   ========================================================================== */

.hero { padding: var(--sp-16) 0; background: var(--bg-app); border-bottom: 1px solid var(--border); }
.hero-grid { display: grid; grid-template-columns: 1fr 0.85fr; gap: var(--sp-12); align-items: center; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-50);
  color: var(--brand-700);
  padding: 6px 13px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: var(--sp-5);
}
.hero h1 { color: var(--text); margin-bottom: var(--sp-4); max-width: 560px; }
.hero p.lead { font-size: 1.1rem; color: var(--text-muted); max-width: 480px; margin-bottom: var(--sp-6); }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: var(--sp-5); }
.hero-trust-line { font-size: 0.86rem; color: var(--text-muted); }

.hero-illustration {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--sp-10);
  height: 100%;
  min-height: 320px;
}
.hero-illustration svg { width: 100%; max-width: 340px; height: auto; }

.hero-media {
  position: relative;
  height: 100%;
  min-height: 380px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--gray-100);
}
.hero-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(4, 120, 87, 0.35), rgba(15, 23, 42, 0.15) 60%);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.hero-media-card {
  position: absolute;
  left: var(--sp-5);
  bottom: var(--sp-5);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
}
[dir="rtl"] .hero-media-card { left: auto; right: var(--sp-5); }
.hero-media-card strong { display: block; font-size: 1.2rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.hero-media-card span { font-size: 0.76rem; color: var(--text-muted); }

.section { padding: var(--sp-16) 0; }
.section-header { text-align: center; max-width: 640px; margin: 0 auto var(--sp-10); }
.section-header .eyebrow { color: var(--brand-600); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; display: block; }
.section-header p { color: var(--text-muted); }
.section-header-row { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: var(--sp-8); gap: var(--sp-4); flex-wrap: wrap; }
.section-header-row h2 { margin: 0; }
.section-alt { background: var(--bg-app); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.prose { max-width: 720px; margin: 0 auto; }
.prose p { color: var(--text-muted); font-size: 1rem; margin-bottom: var(--sp-4); }
.prose p:last-child { margin-bottom: 0; }

.category-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--sp-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.category-card:hover { border-color: var(--brand-300); transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; color: var(--text); }
.category-card .icon-badge {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.category-card strong { font-size: 0.98rem; }
.category-card p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.step-card { display: flex; flex-direction: column; gap: 10px; padding: var(--sp-6); position: relative; }
.step-card .step-number {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand-600); color: white; font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.step-card p { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

.feature-card { display: flex; flex-direction: column; gap: 12px; padding: var(--sp-6); }
.feature-card .icon-badge {
  width: 42px; height: 42px; border-radius: var(--radius-md);
  background: var(--brand-50);
  color: var(--brand-600); display: flex; align-items: center; justify-content: center;
}
.feature-card p { margin: 0; color: var(--text-muted); font-size: 0.88rem; }

.experience-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-3); margin-top: var(--sp-6); }
.experience-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.86rem;
}
.experience-item .icon-badge {
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: var(--brand-50); color: var(--brand-600);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.instructor-section { display: grid; grid-template-columns: 1fr 0.8fr; gap: var(--sp-10); align-items: center; }
.instructor-section .icon-badge {
  width: 54px; height: 54px; border-radius: var(--radius-lg);
  background: var(--brand-600); color: white;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-5);
}
.instructor-benefits { display: flex; flex-direction: column; gap: var(--sp-4); }
.instructor-benefit { display: flex; gap: 12px; align-items: flex-start; }
.instructor-benefit .icon-badge {
  width: 34px; height: 34px; border-radius: var(--radius-md); margin: 0;
  background: var(--brand-50); color: var(--brand-600); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.instructor-benefit strong { display: block; font-size: 0.92rem; margin-bottom: 2px; }
.instructor-benefit p { margin: 0; font-size: 0.85rem; color: var(--text-muted); }

.faq-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  overflow: hidden;
}
.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: var(--sp-4) var(--sp-5);
  font-weight: 600;
  font-size: 0.94rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary .icon { color: var(--gray-400); transition: transform var(--t-fast) var(--ease); flex-shrink: 0; }
.faq-item[open] summary .icon { transform: rotate(180deg); }
.faq-item .faq-answer { padding: 0 var(--sp-5) var(--sp-5); color: var(--text-muted); font-size: 0.9rem; margin: 0; }

.cta-banner {
  border-radius: var(--radius-2xl);
  background: var(--brand-600);
  color: white;
  padding: var(--sp-12) var(--sp-10);
  text-align: center;
}
.cta-banner h2 { color: white; }
.cta-banner p { color: rgba(255, 255, 255, 0.85); max-width: 480px; margin-inline: auto; margin-bottom: var(--sp-6); }
.cta-banner .btn-primary { background: white; color: var(--brand-700); }
.cta-banner .btn-primary:hover { background: var(--gray-50); }
.cta-banner .btn-outline { border-color: rgba(255, 255, 255, 0.5); color: white; }
.cta-banner .btn-outline:hover { background: rgba(255, 255, 255, 0.12); }

/* ==========================================================================
   Auth
   ========================================================================== */

.auth-wrapper {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-10) 20px;
  background: var(--bg-app);
}
.auth-card { width: 100%; max-width: 420px; padding: var(--sp-8); }
.auth-card .auth-icon {
  width: 46px; height: 46px; border-radius: var(--radius-md);
  background: var(--brand-600);
  color: white; display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-4);
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: var(--sp-6); font-size: 0.9rem; }
.auth-card .switch-link { text-align: center; margin-top: var(--sp-5); font-size: 0.86rem; color: var(--text-muted); }

/* ==========================================================================
   Dashboard layout / sidebar
   ========================================================================== */

.dash-layout { display: grid; grid-template-columns: 250px 1fr; gap: var(--sp-6); align-items: start; padding: var(--sp-6) 0 var(--sp-16); }
.dash-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  position: sticky;
  top: calc(var(--header-h) + 16px);
}
.dash-sidebar-group { margin-bottom: var(--sp-4); }
.dash-sidebar-group:last-child { margin-bottom: 0; }
.dash-sidebar-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-400); padding: 0 10px; margin-bottom: 6px; }
.dash-sidebar a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--gray-600);
  font-weight: 600;
  font-size: 0.87rem;
  margin-bottom: 1px;
  border-inline-start: 2px solid transparent;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.dash-sidebar a .icon { color: var(--gray-400); }
.dash-sidebar a:hover { background: var(--gray-50); color: var(--text); text-decoration: none; }
.dash-sidebar a.active { background: var(--brand-50); color: var(--brand-700); border-inline-start-color: var(--brand-600); }
.dash-sidebar a.active .icon { color: var(--brand-600); }
.dash-main { min-width: 0; }

.sidebar-backdrop { display: none; }
.lesson-edit-form { display: none; }
.lesson-edit-form.open { display: block; }

tr.collapsible-row { display: none; }
tr.collapsible-row.open { display: table-row; }

.dash-mobile-bar { display: none; margin-bottom: var(--sp-4); }
.dash-mobile-bar button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--surface); font-weight: 600; font-size: 0.85rem; color: var(--text); cursor: pointer;
}

/* ==========================================================================
   Stat cards
   ========================================================================== */

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--sp-5); margin-bottom: var(--sp-8); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.stat-card:hover { box-shadow: var(--shadow-sm); border-color: var(--gray-300); }
.stat-card-top { display: flex; align-items: center; justify-content: space-between; }
.stat-card .label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.stat-card .icon-badge { width: 34px; height: 34px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; background: var(--brand-50); color: var(--brand-600); }
.stat-card .value { font-size: 1.6rem; font-weight: 800; color: var(--gray-900); letter-spacing: -0.02em; }
.stat-card .value.blue { color: var(--brand-600); }
.stat-card .value.green { color: var(--green-600); }
.stat-card .trend { font-size: 0.78rem; font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.stat-card .trend.up { color: var(--green-600); }
.stat-card .trend.down { color: var(--red-600); }

/* ==========================================================================
   Tables / tabs / sections
   ========================================================================== */

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.87rem; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
th { color: var(--text-muted); font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; background: var(--gray-50); }
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.table-wrap.card { padding: 0; }
.table-wrap table { min-width: 480px; }

.section-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 var(--sp-5); letter-spacing: -0.01em; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-6); flex-wrap: wrap; gap: var(--sp-3); }
.page-header h1 { margin: 0; font-size: 1.4rem; }

.tabs { display: flex; gap: 2px; margin-bottom: var(--sp-6); flex-wrap: wrap; background: var(--gray-100); padding: 3px; border-radius: var(--radius-md); width: fit-content; }
.tabs a { padding: 7px 14px; color: var(--text-muted); font-weight: 600; font-size: 0.84rem; border-radius: var(--radius-sm); }
.tabs a.active { color: var(--brand-600); background: var(--surface); box-shadow: var(--shadow-xs); text-decoration: none; }

/* ==========================================================================
   Progress ring / bars
   ========================================================================== */

.progress-ring {
  --pct: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: conic-gradient(var(--brand-600) calc(var(--pct) * 1%), var(--gray-200) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.progress-ring-inner {
  width: 78%;
  height: 78%;
  border-radius: 50%;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--brand-700);
}
.progress-ring-lg { width: 104px; height: 104px; }
.progress-ring-lg .progress-ring-inner { font-size: 1.1rem; }

.progress-bar-track { background: var(--gray-200); border-radius: var(--radius-full); height: 8px; overflow: hidden; }
.progress-bar-fill { background: var(--brand-600); height: 100%; border-radius: var(--radius-full); transition: width var(--t-slow) var(--ease); }

/* ==========================================================================
   Continue-learning course progress card
   ========================================================================== */

.continue-card {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: var(--sp-5);
  align-items: center;
  padding: var(--sp-4);
}
.continue-card .thumb {
  width: 160px;
  height: 100px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--brand-50);
  display: flex; align-items: center; justify-content: center; color: var(--brand-600); font-weight: 800;
}
.continue-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.continue-card .info { min-width: 0; }
.continue-card .info h3 { margin: 0 0 4px; font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-card .info .meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.continue-card .actions { display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* ==========================================================================
   Empty states / skeletons
   ========================================================================== */

.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-6);
  color: var(--text-muted);
}
.empty-state .icon-badge {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--gray-100); color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--sp-4);
}
.empty-state h3 { color: var(--text); margin-bottom: 6px; }
.empty-state .btn { margin-top: var(--sp-4); }

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--gray-100);
  border-radius: var(--radius-md);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.img-frame { position: relative; background: var(--gray-100); overflow: hidden; }
.img-frame.is-loading::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); transform: translateX(-100%); animation: shimmer 1.5s infinite; }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer {
  background: var(--gray-950);
  color: var(--gray-400);
  padding: var(--sp-16) 0 var(--sp-8);
  margin-top: var(--sp-16);
  font-size: 0.9rem;
}
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: var(--sp-8); margin-bottom: var(--sp-10); }
.footer-brand .brand { color: white; margin-bottom: var(--sp-3); }
.footer-brand p { color: var(--gray-400); font-size: 0.86rem; max-width: 280px; }
.footer h4 { color: white; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--sp-4); }
.footer-links { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-links a, .footer a { color: var(--gray-400); font-size: 0.87rem; }
.footer-links a:hover, .footer a:hover { color: white; }
.footer-social { display: flex; gap: 8px; margin-top: var(--sp-4); }
.footer-social a {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-800);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-300);
}
.footer-social a:hover { background: var(--brand-600); color: white; }
.footer-bottom { border-top: 1px solid var(--gray-800); padding-top: var(--sp-6); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--gray-500); font-size: 0.82rem; }

/* ==========================================================================
   Learn / player
   ========================================================================== */

.learn-layout { display: grid; grid-template-columns: 1fr 340px; gap: var(--sp-5); padding: var(--sp-5) 0 var(--sp-16); align-items: start; }
.player video, .player .text-lesson { width: 100%; border-radius: var(--radius-lg); background: black; }

/* Positioning context for the watermark and the custom fullscreen button. `line-height: 0` stops
   the inline <video> from leaving a descender gap under the frame. */
.player-frame { position: relative; line-height: 0; }
.player-frame video { display: block; }

/* Per-viewer watermark. Faint enough to ignore while studying, but it rides on top of the picture
   so any screen recording carries it. `pointer-events: none` keeps the controls underneath
   clickable; the transition makes the 30s reposition a drift rather than a jump. */
.video-watermark {
  position: absolute;
  top: 12%;
  left: 8%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 3px 7px;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: #fff;
  opacity: 0.06;
  /* The dark shadow is what keeps it legible over a bright frame — white-on-white at 6% would
     otherwise vanish completely on light footage. */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95);
  transition: top 1.4s ease, left 1.4s ease;
}
.curriculum-list { max-height: 82vh; overflow-y: auto; position: sticky; top: calc(var(--header-h) + 16px); }
.chapter-block { margin-bottom: var(--sp-3); }
.chapter-block h4 { margin: 0 0 8px; font-size: 0.76rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 700; }
.chapter-block-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.lesson-link { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; border-radius: var(--radius-md); font-size: 0.86rem; color: var(--text); gap: 8px; }
.lesson-link:hover { background: var(--gray-50); text-decoration: none; }
.lesson-link.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.lesson-link.done { color: var(--green-600); }

/* ==========================================================================
   Community
   ========================================================================== */

.post-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); margin-bottom: var(--sp-4); background: var(--surface); }
.post-card.pinned { border-color: var(--brand-200); background: var(--brand-50); }
.post-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment { padding: 10px 0; border-top: 1px solid var(--gray-100); font-size: 0.9rem; }

/* ==========================================================================
   Quiz
   ========================================================================== */

.question-block { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); margin-bottom: var(--sp-4); background: var(--surface); }
.option-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-md); transition: background var(--t-fast) var(--ease); }
.option-row:hover { background: var(--gray-50); }
/* Scoped to the tick box itself. As a bare `.option-row input` this also hit the answer text
   box in the quiz builder, squashing it to 16x16 so there was nothing to type into. */
.option-row input[type="checkbox"],
.option-row input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-600);
  flex-shrink: 0;
}

/* The answer field takes whatever width is left beside the tick box and the remove button. */
.option-row input[type="text"] {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
.correct-answer { color: var(--green-600); font-weight: 600; }
.wrong-answer { color: var(--red-600); font-weight: 600; }

/* ==========================================================================
   Certificate
   ========================================================================== */

.certificate {
  max-width: 900px;
  margin: var(--sp-10) auto;
  padding: var(--sp-16) var(--sp-12);
  background: var(--white);
  border: 3px solid var(--brand-600);
  border-radius: var(--radius-lg);
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-lg);
}
.certificate::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid var(--brand-100);
  border-radius: var(--radius-md);
  pointer-events: none;
}
.certificate h1 { color: var(--text); font-size: 2rem; }
.certificate .student-name { font-size: 1.9rem; font-weight: 800; margin: 20px 0; color: var(--brand-600); }

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination { display: flex; gap: 6px; margin-top: var(--sp-6); flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--text);
}
.pagination a:hover { background: var(--gray-50); text-decoration: none; }
.pagination a.active, .pagination span.active { background: var(--brand-600); border-color: var(--brand-600); color: white; }

/* ==========================================================================
   Utilities / animations
   ========================================================================== */

.fade-in { animation: fadeIn var(--t-slow) var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.slide-up { animation: fadeUp var(--t-slow) var(--ease); }

/* Answer rows in the quiz builder: checkbox, answer text (takes the slack), remove button. */
.option-row [data-remove-option] {
  flex-shrink: 0;
  padding: 6px 10px;
  line-height: 1;
}

.option-row [data-remove-option][disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Unread ones are called out with a brand-coloured edge rather than a different background,
   which stays legible in both reading directions. */
.notification-item.is-unread {
  border-inline-start: 3px solid var(--brand-600);
  background: var(--brand-50);
}

.notification-body { flex: 1 1 auto; min-width: 0; }
.notification-body p { margin: 4px 0; color: var(--text-muted); font-size: 0.9rem; }
.notification-body .help-text { margin: 0; font-size: 0.78rem; }

@media (max-width: 520px) {
  .notification-item { flex-wrap: wrap; }
  .notification-item .btn { width: 100%; }
}

/* ==========================================================================
   Video quality picker
   ========================================================================== */

.quality-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.quality-option {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
}

.quality-option:hover { border-color: var(--brand-500); color: var(--text); }

.quality-option.active {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}

/* ==========================================================================
   Cookie notice + legal pages
   ========================================================================== */

.cookie-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 300;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.1);
  transition: transform var(--t-base) var(--ease), opacity var(--t-base) var(--ease);
}

.cookie-banner.is-dismissed {
  transform: translateY(100%);
  opacity: 0;
}

.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp-4) 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
}

.cookie-banner-inner p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  max-width: 70ch;
}

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.legal-page h2 {
  font-size: 1.25rem;
  margin-top: var(--sp-8);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}

.legal-page h3 {
  font-size: 1rem;
  margin-top: var(--sp-5);
  color: var(--text);
}

.legal-page p,
.legal-page li {
  color: var(--text-muted);
  line-height: 1.7;
}

.legal-page ul {
  padding-inline-start: var(--sp-5);
}

.legal-page code {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.85em;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-illustration { max-width: 420px; margin: var(--sp-8) auto 0; min-height: 260px; order: -1; }
  .instructor-section { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }

  /* Course page and cart drop their sidebar under the content. The summary/buy box goes
     first on the cart and checkout so the total and the pay button stay above the fold. */
  .detail-layout,
  .cart-layout { grid-template-columns: 1fr; }
  .cart-layout > :last-child { order: -1; }
  .sticky-side { position: static; }
}

@media (max-width: 860px) {
  .dash-layout, .learn-layout { grid-template-columns: 1fr; }
  /* Filters move above the results rather than eating 260px of a phone screen. */
  .catalog-layout { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: fixed;
    inset-inline-start: -280px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 200;
    border-radius: 0;
    transition: inset-inline-start var(--t-base) var(--ease);
    overflow-y: auto;
  }
  .dash-sidebar.open { inset-inline-start: 0; }
  .sidebar-backdrop.open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 190;
  }
  .curriculum-list { position: static; max-height: none; }
  .continue-card { grid-template-columns: 100px 1fr; }
  .continue-card .actions { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
  .dash-mobile-bar { display: block; }
}

/* The navbar has to collapse well before the rest of the page does. Brand, four primary links,
   the search box and the account controls are all `flex-shrink: 0`, so once their combined
   width passes the viewport they simply push the document sideways — which is what happened on
   tablets, where the old 720px breakpoint had not kicked in yet. The links move into the mobile
   panel here; the search box survives until 720px. */
@media (max-width: 900px) {
  .navbar-primary-links { display: none; }
  .mobile-nav-toggle { display: inline-flex; }
  .navbar-inner { height: 60px; gap: var(--sp-3); }
}

@media (max-width: 720px) {
  .search-form { display: none; }
  .cookie-banner-inner { flex-direction: column; align-items: stretch; padding: var(--sp-4) 16px; gap: var(--sp-3); }
  .cookie-banner-actions { justify-content: stretch; }
  .cookie-banner-actions .btn, .cookie-banner-actions form { flex: 1 1 auto; }
  .cookie-banner-actions .btn { width: 100%; }
  .navbar-inner { height: 58px; }
  .section { padding: var(--sp-10) 0; }
  .footer-grid { grid-template-columns: 1fr; }

  /* Reclaim 16px of horizontal space on every page. */
  .container { padding: 0 16px; }

  /* 16px is the threshold below which iOS Safari zooms the whole page in when a field
     takes focus, then leaves it zoomed. The 0.9rem default was tripping that on every form. */
  input, textarea, select { font-size: 16px; }

  /* Generous desktop padding leaves almost no room for the content itself on a phone. */
  .certificate { padding: var(--sp-8) var(--sp-5); margin: var(--sp-5) auto; border-width: 2px; }
  .empty-state { padding: var(--sp-10) var(--sp-4); }
  .card { padding: var(--sp-4); }
  .auth-card { padding: var(--sp-5); }

  /* The lesson list is its own scroll area on desktop; on mobile it is just part of the page. */
  .curriculum-list { max-height: none; overflow-y: visible; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: var(--sp-3); }
  .stat-card { padding: var(--sp-4); }

  /* A row of tabs wider than the screen scrolls instead of pushing the page sideways. */
  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tabs::-webkit-scrollbar { height: 0; }

  .page-header { align-items: flex-start; }
  .hero-ctas .btn { flex: 1 1 auto; }
}

/* Phones proper. Anything still assuming two things fit side by side gets stacked. */
@media (max-width: 520px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  /* Navbar has to fit brand + menu + language + cart + avatar on ~360px. Dropping the
     first-name label and tightening the language switch buys back roughly 90px. */
  .navbar-inner { gap: var(--sp-2); }
  .user-chip-name { display: none; }
  .user-chip { padding: 4px; }
  .lang-switch a { padding: 4px 6px; font-size: 0.7rem; }
  .cart-link { width: 34px; height: 34px; }

  /* Thumbnail on top, details underneath — 100px of image plus text is unreadable here. */
  .continue-card { grid-template-columns: 1fr; }
  .continue-card .thumb { width: 100%; height: 140px; }
  .continue-card .actions { flex-direction: row; justify-content: space-between; align-items: center; width: 100%; }

  .lesson-link { flex-wrap: wrap; }
  .option-row { align-items: flex-start; }
  .post-card { padding: var(--sp-4); }
  .instructor-benefit { flex-direction: column; gap: 8px; }

  /* Long unbroken tokens (payment references, certificate codes, pasted URLs) would
     otherwise force the page wider than the viewport. */
  .badge, .help-text, .post-meta, .comment { overflow-wrap: anywhere; }

  .btn { padding: 10px 14px; }
  .pagination a { min-width: 34px; justify-content: center; }
}

/* Small phones. The header is the tightest part of the page and the hardest case is a
   signed-out visitor, whose actions area carries the language switch plus a Log in and a Sign up
   button — noticeably wider in Arabic than in English. It sheds the wordmark (the brand mark
   alone stays recognisable), the dropdown chevron, and some button padding. */
@media (max-width: 430px) {
  .brand span:not(.brand-mark) { display: none; }
  .user-chip .icon { display: none; }
  .navbar-inner { gap: 6px; }
  .navbar-actions { gap: 6px; }
  .navbar-actions .btn { padding: 8px 10px; font-size: 0.78rem; }
  .lang-switch a { padding: 3px 5px; font-size: 0.68rem; }
}

/* 320px — the narrowest screen still worth supporting (iPhone SE 1st gen, older Android).
   "Log in" and "Sign up" side by side no longer fit here once the labels are translated
   ("Connexion"/"Inscription", "تسجيل الدخول"/"إنشاء حساب" are wider than the English). The
   secondary ghost button drops out; both links remain in the mobile menu behind the toggle,
   so nothing becomes unreachable. */
@media (max-width: 380px) {
  .container { padding: 0 12px; }
  .navbar-actions .btn-ghost { display: none; }
}
