/* ===== Mflow theme tokens (Phase 2 · T1) =====
   One source of truth for colors, radii, shadows, gradients, motion and z-index.
   Brand colors are fixed by Brand Brain: Primary #2563EB · Accent #10B981 · Text #0F172A · Surface #E5E7EB.
   The brand guide defines NO dark palette: the dark values below are DERIVED from the brand colors
   (checked with docs/dev/contrast_check.py, WCAG AA).
   Dark mode is active only when <html data-theme="dark"> (set by the no-flash script from T2:
   "system" is resolved to light/dark by that script). Old variable names (--c-*, --p/--a/--t/--s/--bg/--err)
   are mapped at the end so existing CSS keeps working. Load this file BEFORE the other Mflow CSS files (the old :root color definitions were removed from mflow-site.css and mflow-plain.css so these mappings are the only source). */
/* ===== Fonts (T19): declared here because this file is loaded by site, admin AND plain/auth layouts ===== */
@font-face{font-family:"Vazirmatn";src:url("/fonts/Vazirmatn-Variable.woff2") format("woff2");font-weight:100 900;font-display:swap}
@font-face{font-family:"Inter";src:url("/fonts/Inter-Variable.woff2") format("woff2");font-weight:100 900;font-display:swap}
:root{
  --font-fa:"Vazirmatn",Tahoma,"Segoe UI",system-ui,sans-serif;
  --font-en:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}
html[lang=fa] body{font-family:var(--font-fa)}
html[lang=en] body{font-family:var(--font-en)}
button,input,select,textarea{font-family:inherit}
/* links are never underlined (owner decision, T20); they stay recognisable by color */
a,a:hover,a:focus{text-decoration:none}

:root{
  color-scheme:light;

  /* --- color tokens (light) --- */
  /* H5: light palette = brand blue/green tints instead of flat white; cards (surface) stay white so they stand out */
  --mf-bg:#F1F5FB;
  --mf-bg-soft:#E7EEF9;
  --mf-surface:#FFFFFF;
  --mf-surface-2:#EAF0F8;
  --mf-border:#D8E1EE;
  --mf-border-strong:#BCC9DC;
  --mf-input-border:#7B8AA0;
  --mf-text:#0F172A;
  --mf-text-2:#334155;
  --mf-muted:#5B6A80;

  --mf-primary:#2563EB;
  --mf-primary-hover:#1D4ED8;
  --mf-on-primary:#FFFFFF;
  --mf-link:#1D4ED8;
  --mf-primary-soft:#E5EEFE;
  --mf-primary-soft-2:#CDDEFB;

  --mf-accent:#10B981;
  --mf-accent-text:#047857;
  --mf-accent-soft:#E2F6EC;
  --mf-accent-border:#A7F3D0;

  --mf-success-text:#065F46;
  --mf-danger:#B91C1C;
  --mf-danger-soft:#FEF2F2;
  --mf-danger-border:#FECACA;
  --mf-warn:#92400E;
  --mf-warn-soft:#FFFBEB;
  --mf-warn-border:#FDE68A;

  --mf-ring:#2563EB;
  --mf-glass:rgba(241,245,251,.84);
  --mf-overlay:rgba(15,23,42,.55);
  --mf-skeleton-a:#E6ECF5;
  --mf-skeleton-b:#D6DFEE;

  /* admin sidebar (dark in both themes, deeper in dark mode) */
  --mf-side-bg:#0F172A;
  --mf-side-text:#CBD5E1;
  --mf-side-muted:#94A3B8;
  --mf-side-hover:#1E293B;
  --mf-side-border:#334155;

  /* --- gradients (hero is dark navy in BOTH themes, per the brand guide mockup) --- */
  --mf-grad-brand:linear-gradient(135deg,#2563EB 0%,#10B981 100%);
  --mf-grad-text:linear-gradient(90deg,#2563EB,#0E9F6E);
  --mf-hero-bg:#0B1220;
  --mf-hero-mesh:
    radial-gradient(60% 55% at 15% 10%,rgba(37,99,235,.38),transparent 70%),
    radial-gradient(45% 40% at 88% 18%,rgba(16,185,129,.24),transparent 70%),
    radial-gradient(50% 45% at 60% 100%,rgba(37,99,235,.22),transparent 70%),
    linear-gradient(180deg,#0B1220,#0F172A);
  --mf-hero-text:#F1F5F9;
  --mf-hero-muted:#B6C2D6;

  /* --- shape --- */
  --mf-r-xs:6px;--mf-r-sm:8px;--mf-r-md:12px;--mf-r-lg:20px;--mf-r-xl:28px;--mf-r-pill:999px;

  /* --- elevation --- */
  --mf-shadow-xs:0 1px 2px rgba(15,23,42,.06);
  --mf-shadow-sm:0 1px 2px rgba(15,23,42,.06),0 4px 12px rgba(15,23,42,.06);
  --mf-shadow-md:0 1px 2px rgba(15,23,42,.06),0 8px 24px rgba(15,23,42,.08);
  --mf-shadow-lg:0 2px 4px rgba(15,23,42,.06),0 20px 48px rgba(15,23,42,.14);
  /* H4a: primary-button gradient = logo gradient (blue to green); the green end is deepened to #05835C so white text keeps AA contrast (4.76:1) */
  --mf-grad-btn:linear-gradient(135deg,#2563EB 0%,#05835C 100%);
  --mf-glow:0 6px 20px rgba(37,99,235,.32),0 4px 18px rgba(16,185,129,.24);
  --mf-glow-hover:0 8px 28px rgba(37,99,235,.42),0 6px 24px rgba(16,185,129,.34);

  /* --- motion --- */
  --mf-dur-fast:120ms;
  --mf-dur:220ms;
  --mf-dur-slow:480ms;
  --mf-ease:cubic-bezier(.2,.7,.2,1);
  --mf-ease-in-out:cubic-bezier(.65,0,.35,1);
  --mf-ease-spring:cubic-bezier(.34,1.56,.64,1);
  --mf-reveal-distance:18px;
  --mf-stagger:70ms;

  /* --- layering --- */
  --mf-z-header:50;--mf-z-drawer:60;--mf-z-overlay:80;--mf-z-toast:90;

  /* --- legacy names (public site: mflow-site/cms/shop/learning/services/digital) --- */
  --c-primary:var(--mf-primary);--c-primary-700:var(--mf-link);--c-primary-50:var(--mf-primary-soft);--c-primary-100:var(--mf-primary-soft-2);
  --c-accent:var(--mf-accent);--c-accent-700:var(--mf-accent-text);--c-accent-50:var(--mf-accent-soft);
  --c-text:var(--mf-text);--c-text-2:var(--mf-text-2);--c-muted:var(--mf-muted);
  --c-surface:var(--mf-border);--c-soft:var(--mf-bg-soft);--c-bg:var(--mf-bg);
  --c-danger:var(--mf-danger);--c-warn:var(--mf-warn);
  --r-sm:var(--mf-r-sm);--r:var(--mf-r-md);--r-lg:var(--mf-r-lg);
  --shadow:var(--mf-shadow-md);
  /* --- legacy names (admin / plain / installer: mflow-plain/admin) --- */
  --p:var(--mf-primary);--a:var(--mf-accent);--t:var(--mf-text);--s:var(--mf-border);--bg:var(--mf-bg-soft);--err:var(--mf-danger);
}

/* ===== dark theme (derived from the brand colors) ===== */
:root[data-theme="dark"]{
  color-scheme:dark;

  --mf-bg:#0B1220;
  --mf-bg-soft:#0E1627;
  --mf-surface:#111A2E;
  --mf-surface-2:#17223B;
  --mf-border:#24304A;
  --mf-border-strong:#33415E;
  --mf-input-border:#5B6B88;
  --mf-text:#E6EBF5;
  --mf-text-2:#CBD5E1;
  --mf-muted:#94A3B8;

  --mf-primary:#2563EB;
  --mf-primary-hover:#1D4ED8;
  --mf-on-primary:#FFFFFF;
  --mf-link:#60A5FA;
  --mf-primary-soft:#14244A;
  --mf-primary-soft-2:#1E3A78;

  --mf-accent:#34D399;
  --mf-accent-text:#34D399;
  --mf-accent-soft:#0B2A26;
  --mf-accent-border:#14574A;

  --mf-success-text:#6EE7B7;
  --mf-danger:#F87171;
  --mf-danger-soft:#2A1216;
  --mf-danger-border:#5B2229;
  --mf-warn:#FBBF24;
  --mf-warn-soft:#2B2110;
  --mf-warn-border:#5B4516;

  --mf-ring:#60A5FA;
  --mf-glass:rgba(11,18,32,.78);
  --mf-overlay:rgba(2,6,15,.7);
  --mf-skeleton-a:#141E34;
  --mf-skeleton-b:#1C2842;

  --mf-side-bg:#0A101D;
  --mf-side-text:#CBD5E1;
  --mf-side-muted:#94A3B8;
  --mf-side-hover:#141E34;
  --mf-side-border:#24304A;

  --mf-grad-text:linear-gradient(90deg,#60A5FA,#34D399);

  --mf-shadow-xs:0 1px 2px rgba(0,0,0,.35);
  --mf-shadow-sm:0 1px 2px rgba(0,0,0,.35),0 4px 12px rgba(0,0,0,.3);
  --mf-shadow-md:0 1px 2px rgba(0,0,0,.4),0 8px 24px rgba(0,0,0,.38);
  --mf-shadow-lg:0 2px 4px rgba(0,0,0,.4),0 20px 48px rgba(0,0,0,.5);
  --mf-glow:0 6px 22px rgba(37,99,235,.45),0 4px 20px rgba(16,185,129,.30);
  --mf-glow-hover:0 8px 30px rgba(59,130,246,.55),0 6px 26px rgba(16,185,129,.42);
}

/* ===== reduced motion: every duration token becomes instant ===== */
@media (prefers-reduced-motion:reduce){
  :root{--mf-dur-fast:0ms;--mf-dur:0ms;--mf-dur-slow:0ms;--mf-stagger:0ms;--mf-reveal-distance:0px}
  html{scroll-behavior:auto}
}

/* ===== theme switch button (site header + admin top bar) ===== */
.theme-btn{display:none}
html[data-theme-pref] .theme-btn{display:inline-flex}
:root .theme-btn{align-items:center;justify-content:center;width:38px;height:38px;padding:0;margin:0;border:1px solid var(--mf-border);border-radius:var(--mf-r-pill);background:transparent;color:var(--mf-text-2);cursor:pointer;line-height:0;transition:background-color var(--mf-dur) var(--mf-ease),border-color var(--mf-dur) var(--mf-ease),color var(--mf-dur) var(--mf-ease),transform var(--mf-dur-fast) var(--mf-ease)}
:root .theme-btn:hover{background:var(--mf-surface-2);border-color:var(--mf-border-strong);color:var(--mf-text)}
:root .theme-btn:active{transform:scale(.94)}
.theme-btn .ti{display:none}
html[data-theme-pref="light"] .theme-btn .ti-light,html[data-theme-pref="dark"] .theme-btn .ti-dark,html[data-theme-pref="system"] .theme-btn .ti-system{display:block}
/* short colour cross-fade while switching (skipped by the script under prefers-reduced-motion) */
html.theme-anim *,html.theme-anim *::before,html.theme-anim *::after{transition:background-color var(--mf-dur-slow) var(--mf-ease),border-color var(--mf-dur-slow) var(--mf-ease),color var(--mf-dur-slow) var(--mf-ease),fill var(--mf-dur-slow) var(--mf-ease),stroke var(--mf-dur-slow) var(--mf-ease)!important}

/* logo image (T21): used in admin sidebar, auth pages, footer */
.logo-img{display:block;height:auto;width:auto;max-width:100%;max-height:44px}

/* Reduced motion (T25): one catch-all for every stylesheet loaded after the tokens. Slow spinners stay so that loading is still visible. */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;animation-delay:0s!important;transition-duration:.01ms!important;transition-delay:0s!important;scroll-behavior:auto!important}
  .mf-spinner,.btn.is-loading::before,body.auth .btn.is-loading::before{animation-duration:2s!important;animation-iteration-count:infinite!important}
}
