/* Portably design system: tokens, base, components.
   Every page loads this file first. Colors are tokens only: never hard-code
   a color in page CSS, use var(--*) so both themes stay in sync. */

:root {
  --brand: #2f5deb;
  --brand-600: #244bd0;
  --brand-700: #1c3ba8;
  --brand-300: #8aa6ff;
  --brand-soft: rgba(47, 93, 235, .10);
  --brand-ring: rgba(47, 93, 235, .35);
  --accent: #19c3a6;

  --bg: #f6f8fc;
  --bg-2: #eef2fb;
  --surface: #ffffff;
  --surface-2: #f3f5fb;
  --surface-glass: rgba(255, 255, 255, .72);
  --border: #e2e7f2;
  --border-strong: #cfd6e6;
  --text: #0b1220;
  --text-2: #4a5670;
  --text-3: #7a859e;
  --on-brand: #ffffff;

  --success: #12a865;
  --success-soft: rgba(18, 168, 101, .12);
  --warning: #e08a00;
  --warning-soft: rgba(224, 138, 0, .12);
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, .12);
  --info: #2f5deb;
  --info-soft: rgba(47, 93, 235, .12);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow: 0 4px 16px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .05);
  --shadow-lg: 0 24px 60px -12px rgba(23, 38, 92, .18), 0 8px 20px -8px rgba(23, 38, 92, .10);
  --glow: 0 10px 40px -10px rgba(47, 93, 235, .55);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --font: "Inter", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Plus Jakarta Sans", "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
  --container: 1200px;
  --header-h: 78px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #4d78ff;
    --brand-600: #3a66f5;
    --brand-700: #2f5deb;
    --brand-300: #9db5ff;
    --brand-soft: rgba(77, 120, 255, .14);
    --brand-ring: rgba(77, 120, 255, .45);
    --bg: #060a14;
    --bg-2: #0a1020;
    --surface: #0d1426;
    --surface-2: #131c33;
    --surface-glass: rgba(10, 16, 32, .72);
    --border: #1d2741;
    --border-strong: #2a3657;
    --text: #edf1fc;
    --text-2: #a3aec8;
    --text-3: #6f7b98;
    --success-soft: rgba(18, 168, 101, .18);
    --warning-soft: rgba(224, 138, 0, .18);
    --danger-soft: rgba(229, 72, 77, .18);
    --info-soft: rgba(77, 120, 255, .18);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 6px 20px rgba(0, 0, 0, .35);
    --shadow-lg: 0 30px 70px -14px rgba(0, 0, 0, .7);
    --glow: 0 10px 40px -8px rgba(77, 120, 255, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #4d78ff;
  --brand-600: #3a66f5;
  --brand-700: #2f5deb;
  --brand-300: #9db5ff;
  --brand-soft: rgba(77, 120, 255, .14);
  --brand-ring: rgba(77, 120, 255, .45);
  --bg: #060a14;
  --bg-2: #0a1020;
  --surface: #0d1426;
  --surface-2: #131c33;
  --surface-glass: rgba(10, 16, 32, .72);
  --border: #1d2741;
  --border-strong: #2a3657;
  --text: #edf1fc;
  --text-2: #a3aec8;
  --text-3: #6f7b98;
  --success-soft: rgba(18, 168, 101, .18);
  --warning-soft: rgba(224, 138, 0, .18);
  --danger-soft: rgba(229, 72, 77, .18);
  --info-soft: rgba(77, 120, 255, .18);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 20px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 70px -14px rgba(0, 0, 0, .7);
  --glow: 0 10px 40px -8px rgba(77, 120, 255, .6);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
[dir="rtl"] body { font-family: "IBM Plex Sans Arabic", var(--font); }
/* an icon with no size of its own stays text-sized (without this, an icon in plain text fills the width);
   :where() keeps it weaker than any rule that sizes icons */
:where(svg.ic) { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; color: var(--text); }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 { font-family: "IBM Plex Sans Arabic", var(--font-display); letter-spacing: 0; }
p { margin: 0 0 1em; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--brand); color: var(--on-brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .container { padding-inline: 24px; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }

/* ---------- logo ---------- */
.logo { display: inline-flex; align-items: center; }
.logo img { height: 48px; width: auto; }
@media (max-width: 640px) { .logo img { height: 40px; } }
.logo .logo-dark { display: none; }
:root[data-theme="dark"] .logo .logo-light { display: none; }
:root[data-theme="dark"] .logo .logo-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo .logo-dark { display: block; }
}

/* ---------- buttons ---------- */
.btn {
  --_bg: var(--surface-2); --_fg: var(--text); --_bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: var(--radius);
  border: 1px solid var(--_bd); background: var(--_bg); color: var(--_fg);
  font-weight: 600; font-size: 14.5px; white-space: nowrap; cursor: pointer;
  transition: transform .15s var(--ease), background .2s, border-color .2s, box-shadow .2s, color .2s;
  text-decoration: none;
}
.btn:hover { border-color: var(--border-strong); color: var(--_fg); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { --_bg: var(--brand); --_fg: var(--on-brand); --_bd: transparent; box-shadow: var(--glow); }
.btn-primary:hover { --_bg: var(--brand-600); --_fg: var(--on-brand); }
.btn-ghost { --_bg: transparent; --_bd: transparent; }
.btn-ghost:hover { --_bg: var(--surface-2); }
.btn-outline { --_bg: transparent; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; }
/* a disabled button swallows clicks itself: no pointer-events: none, or the click would reach the row behind it */
.btn[disabled], .btn.loading { opacity: .65; cursor: default; }
a.btn.loading { pointer-events: none; }
button.loading:not(.btn) { opacity: .55; cursor: progress; }
.btn.loading::after {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: border-color .2s, box-shadow .2s, background .2s; outline: none;
}
.textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.input.invalid, .select.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-start: 42px; }
.input-wrap > svg { position: absolute; inset-inline-start: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.input-wrap .input-action { position: absolute; inset-inline-end: 6px; top: 50%; translate: 0 -50%; }
.input-wrap .input-action + .input, .input-wrap .input.has-action { padding-inline-end: 46px; }
.field-error { color: var(--danger); font-size: 12.5px; min-height: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); margin: 2px 0 0; flex: none; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-size: 5px 5px; background-repeat: no-repeat; background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; padding-inline-end: 36px; }
[dir="rtl"] .select { background-position: 15px 50%, 20px 50%; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--brand-soft); color: var(--brand);
}
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge svg { width: 14px; height: 14px; }
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); font-size: 14px; border: 1px solid transparent; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.success { background: var(--success-soft); color: var(--success); }
.alert.info { background: var(--info-soft); color: var(--info); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: var(--surface-glass); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color .2s, background .2s;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.site-header .container { height: 100%; display: flex; align-items: center; gap: 20px; }
.site-nav { display: none; gap: 4px; margin-inline: auto; }
.site-nav a { padding: 8px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; font-size: 14.5px; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.header-actions .desk { display: none; }
@media (min-width: 1024px) {
  .site-nav { display: flex; }
  .site-nav + .header-actions { margin-inline-start: 0; }
  .header-actions .desk { display: inline-flex; }
  .header-actions .burger { display: none; }
}

/* dropdown (language / currency) */
.dd { position: relative; }
.dd-btn { gap: 6px; padding: 0 10px; font-size: 13.5px; }
.dd-btn .chev { width: 14px; height: 14px; opacity: .6; }
.dd-menu {
  position: absolute; top: calc(100% + 8px); inset-inline-end: 0; min-width: 168px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .18s var(--ease); z-index: 60;
}
.dd.open .dd-menu { opacity: 1; visibility: visible; transform: none; }
.dd-menu button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 9px;
  background: none; cursor: pointer; font-size: 14px; color: var(--text); text-align: start;
}
.dd-menu button:hover { background: var(--surface-2); }
.dd-menu button.active { color: var(--brand); font-weight: 600; }
.dd-menu button .tag { margin-inline-start: auto; font-size: 12px; color: var(--text-3); }

/* mobile drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(4, 8, 20, .5); opacity: 0; visibility: hidden; transition: .25s; z-index: 70; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(340px, 88vw); z-index: 80;
  background: var(--surface); border-inline-start: 1px solid var(--border); padding: 18px;
  display: flex; flex-direction: column; gap: 14px; transform: translateX(105%); transition: transform .3s var(--ease); overflow-y: auto;
}
[dir="rtl"] .drawer { transform: translateX(-105%); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer nav { display: grid; gap: 2px; }
.drawer nav a { padding: 12px; border-radius: 10px; color: var(--text); font-weight: 500; }
.drawer nav a:hover { background: var(--surface-2); }
.drawer .seg { display: flex; gap: 6px; }
.drawer .seg button { flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-weight: 600; font-size: 13px; }
.drawer .seg button.active { background: var(--brand); color: var(--on-brand); border-color: transparent; }
.drawer-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-top: 6px; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 18px; inset-inline: 16px; display: grid; justify-items: center; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 16px;
  border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toastIn .3s var(--ease);
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.error svg { color: var(--danger); }
.toast.success svg { color: var(--success); }

/* ---------- animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
.btn-danger { --_bg: var(--danger); --_fg: #fff; --_bd: transparent; }
.btn-danger:hover { --_bg: #c9363b; --_fg: #fff; }

/* Maintenance banner (landing and reseller panel) */
.maint-banner { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--warning-soft, #fff4e0); color: var(--warning, #b26a00); font-size: 14px; font-weight: 600; border-bottom: 1px solid currentColor; }
.maint-banner .ic { width: 18px; height: 18px; flex: none; }
.maint-banner.site { justify-content: center; position: relative; z-index: 60; }

/* new release ready (service worker) */
.new-ver { position: fixed; z-index: 200; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; max-width: calc(100vw - 32px); }
.new-ver button { border: 0; border-radius: 10px; padding: 8px 14px; background: var(--brand); color: #fff; font-weight: 700; cursor: pointer; }

/* phone with country code: the code list is a real <select> laid over the "🇲🇦 +212" pill */
.phone-in { position: relative; display: flex; gap: 8px; align-items: stretch; }
.phone-in .ph-cc { position: absolute; top: 0; left: 0; width: 112px; height: 100%; opacity: 0; cursor: pointer; z-index: 1; }
.phone-in .ph-dial { flex: none; width: 112px; display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--border-strong, var(--border)); border-radius: var(--radius, 12px); background: var(--surface-2); font-weight: 600; font-size: 14.5px; white-space: nowrap; color: var(--text); }
.phone-in .ph-cc:focus-visible + .ph-dial { outline: 2px solid var(--brand-ring); outline-offset: 1px; }
.phone-in .ph-num { flex: 1; min-width: 0; }
