/**
 * MFT OS UI — L5.3 Enterprise Unification layer
 * Bridges --px-*, --ep-*, and legacy --color-* into one premium surface language.
 * Do NOT link from IELTS / coding / MCQ exam runners.
 */

:root {
  /* ── Spacing scale ─────────────────────────────────────────── */
  --mft-space-1: 4px;
  --mft-space-2: 8px;
  --mft-space-3: 12px;
  --mft-space-4: 16px;
  --mft-space-5: 20px;
  --mft-space-6: 24px;
  --mft-space-8: 32px;
  --mft-space-10: 40px;
  --mft-space-12: 48px;
  --mft-space-16: 64px;

  /* ── Radius ────────────────────────────────────────────────── */
  --mft-radius-sm: 10px;
  --mft-radius-md: 14px;
  --mft-radius-lg: 18px;
  --mft-radius-xl: 24px;
  --mft-radius-full: 999px;

  /* ── Brand / primary (indigo–violet enterprise) ────────────── */
  --mft-primary: #4f46e5;
  --mft-primary-hover: #4338ca;
  --mft-primary-soft: #eef2ff;
  --mft-accent: #7c3aed;
  --mft-accent-soft: #f5f3ff;
  --mft-success: #059669;
  --mft-warning: #d97706;
  --mft-danger: #dc2626;
  --mft-info: #0284c7;

  /* ── Surfaces ──────────────────────────────────────────────── */
  --mft-bg: #f4f6fb;
  --mft-bg-elevated: #ffffff;
  --mft-bg-muted: #eef2ff;
  --mft-border: #e2e8f0;
  --mft-border-strong: #cbd5e1;
  --mft-text: #0f172a;
  --mft-text-muted: #64748b;
  --mft-text-subtle: #94a3b8;

  /* ── Shadows ───────────────────────────────────────────────── */
  --mft-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --mft-shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --mft-shadow-lg: 0 18px 50px rgba(15, 23, 42, 0.12);
  --mft-shadow-glow: 0 12px 40px rgba(79, 70, 229, 0.22);

  /* ── Motion ────────────────────────────────────────────────── */
  --mft-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mft-dur-fast: 140ms;
  --mft-dur: 220ms;
  --mft-dur-slow: 380ms;

  /* ── Type ──────────────────────────────────────────────────── */
  --mft-font: "Vazirmatn", "Vazir", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mft-font-en: system-ui, "Segoe UI", "Inter", sans-serif;
  --mft-font-mono: ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Bridge legacy tokens used across shells */
  --color-primary: var(--mft-primary);
  --color-primary-dark: var(--mft-primary-hover);
  --color-bg: var(--mft-bg);
  --color-surface: var(--mft-bg-elevated);
  --color-text: var(--mft-text);
  --color-muted: var(--mft-text-muted);
  --color-border: var(--mft-border);
  --radius-md: var(--mft-radius-md);
  --radius-lg: var(--mft-radius-lg);
  --shadow-md: var(--mft-shadow-md);
  --shadow-lg: var(--mft-shadow-lg);
  --space-4: var(--mft-space-4);
  --space-8: var(--mft-space-8);

  --ep-color-primary: var(--mft-primary);
  --ep-color-bg: var(--mft-bg);
  --ep-color-surface: var(--mft-bg-elevated);
  --ep-color-text: var(--mft-text);
  --ep-color-text-muted: var(--mft-text-muted);
  --ep-color-border: var(--mft-border);
  --ep-radius-md: var(--mft-radius-md);
  --ep-shadow-md: var(--mft-shadow-md);

  --px-primary: var(--mft-primary);
  --px-bg: var(--mft-bg);
  --px-surface: var(--mft-bg-elevated);
  --px-text: var(--mft-text);
  --px-text-muted: var(--mft-text-muted);
  --px-border: var(--mft-border);
}

[dir="ltr"] body {
  font-family: var(--mft-font-en);
}
[dir="rtl"] body {
  font-family: var(--mft-font);
}

/* ── Utility components ──────────────────────────────────────── */
.mft-container {
  width: min(1180px, calc(100% - 2 * var(--mft-space-4)));
  margin-inline: auto;
}
.mft-card {
  background: var(--mft-bg-elevated);
  border: 1px solid var(--mft-border);
  border-radius: var(--mft-radius-lg);
  box-shadow: var(--mft-shadow-sm);
  transition: transform var(--mft-dur) var(--mft-ease), box-shadow var(--mft-dur) var(--mft-ease);
}
.mft-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--mft-shadow-md);
}
.mft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.7rem 1.2rem;
  border-radius: var(--mft-radius-full);
  border: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--mft-dur-fast) var(--mft-ease), box-shadow var(--mft-dur) var(--mft-ease),
    background var(--mft-dur) var(--mft-ease);
}
.mft-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--mft-primary) 45%, white);
  outline-offset: 2px;
}
.mft-btn-primary {
  background: linear-gradient(135deg, var(--mft-primary), var(--mft-accent));
  color: #fff;
  box-shadow: var(--mft-shadow-glow);
}
.mft-btn-primary:hover {
  transform: translateY(-1px);
}
.mft-btn-secondary {
  background: var(--mft-primary-soft);
  color: var(--mft-primary-hover);
}
.mft-btn-ghost {
  background: transparent;
  color: inherit;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
}
.mft-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: var(--mft-radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--mft-primary-soft);
  color: var(--mft-primary-hover);
}
.mft-skeleton {
  background: linear-gradient(90deg, #eef2ff 0%, #f8fafc 50%, #eef2ff 100%);
  background-size: 200% 100%;
  animation: mft-shimmer 1.2s ease-in-out infinite;
  border-radius: var(--mft-radius-md);
}
@keyframes mft-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── Premium sticky navbar ───────────────────────────────────── */
.navbar {
  position: sticky !important;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  background: color-mix(in srgb, var(--mft-bg-elevated) 82%, transparent) !important;
  border-bottom: 1px solid color-mix(in srgb, var(--mft-border) 80%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4) inset, var(--mft-shadow-sm);
}
.home-page .navbar {
  background: color-mix(in srgb, #0f172a 55%, transparent) !important;
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.home-page .navbar-brand-text,
.home-page .pill-nav-link {
  color: rgba(255, 255, 255, 0.92) !important;
}
.home-page .pill-nav-link:hover,
.home-page .pill-nav-link.active {
  color: #fff !important;
}
.home-page .pill-nav-links {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--mft-radius-full);
  padding: 4px;
}
.pill-nav-link {
  border-radius: var(--mft-radius-full) !important;
  font-weight: 700 !important;
  transition: background var(--mft-dur-fast) var(--mft-ease), color var(--mft-dur-fast) var(--mft-ease) !important;
}
.pill-nav-cta {
  border-radius: var(--mft-radius-full) !important;
  background: linear-gradient(135deg, var(--mft-primary), var(--mft-accent)) !important;
  color: #fff !important;
  box-shadow: var(--mft-shadow-glow) !important;
  font-weight: 800 !important;
}
.navbar-lang-switch .l5-lang-switch,
.footer-lang .l5-lang-switch,
.ep-lang-switch.l5-lang-switch {
  background: color-mix(in srgb, var(--mft-primary) 8%, transparent);
  border-color: color-mix(in srgb, var(--mft-primary) 16%, transparent);
}
.home-page .l5-lang-btn {
  color: rgba(255, 255, 255, 0.85);
}
.home-page .l5-lang-btn.is-active {
  background: #fff;
  color: #1e1b4b;
}

/* ── Executive homepage upgrades ─────────────────────────────── */
.home-page {
  --hp-max: 1180px;
}
.hp-hero {
  isolation: isolate;
}
.hp-hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto;
  height: 70%;
  background:
    radial-gradient(circle at 20% 30%, rgba(124, 58, 237, 0.35), transparent 40%),
    radial-gradient(circle at 80% 20%, rgba(79, 70, 229, 0.28), transparent 42%);
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
  animation: hp-aurora 12s ease-in-out infinite alternate;
}
@keyframes hp-aurora {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  to { transform: translate3d(2%, 3%, 0) scale(1.05); opacity: 1; }
}
.hp-btn {
  min-height: 48px;
  border-radius: var(--mft-radius-full) !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em;
  transition: transform var(--mft-dur-fast) var(--mft-ease), box-shadow var(--mft-dur) var(--mft-ease) !important;
}
.hp-btn-primary {
  background: linear-gradient(135deg, #fb923c, #f59e0b 40%, #a78bfa) !important;
  color: #1e1b4b !important;
  box-shadow: 0 12px 30px rgba(251, 146, 60, 0.28) !important;
}
.hp-btn:hover {
  transform: translateY(-2px);
}
.hp-cap {
  border-radius: var(--mft-radius-xl) !important;
  border: 1px solid var(--mft-border) !important;
  box-shadow: var(--mft-shadow-sm) !important;
  transition: transform var(--mft-dur) var(--mft-ease), box-shadow var(--mft-dur) var(--mft-ease),
    border-color var(--mft-dur) var(--mft-ease) !important;
  position: relative;
  overflow: hidden;
}
.hp-cap::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--mft-primary), var(--mft-accent));
  opacity: 0;
  transition: opacity var(--mft-dur) var(--mft-ease);
}
.hp-cap:hover {
  transform: translateY(-4px);
  box-shadow: var(--mft-shadow-lg) !important;
  border-color: color-mix(in srgb, var(--mft-primary) 28%, var(--mft-border)) !important;
}
.hp-cap:hover::after {
  opacity: 1;
}
.hp-cap-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--mft-primary-soft);
  font-size: 1.35rem;
  margin-bottom: 0.85rem;
}
.hp-section-label {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.75rem !important;
  color: var(--mft-primary) !important;
  font-weight: 900 !important;
}
.hp-section-title {
  letter-spacing: -0.03em;
  font-weight: 900 !important;
}
.hp-trust-card {
  border-radius: var(--mft-radius-xl) !important;
  box-shadow: var(--mft-shadow-md) !important;
  border: 1px solid var(--mft-border) !important;
}
.hp-trust-item strong {
  background: linear-gradient(120deg, var(--mft-primary), var(--mft-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Showcase strips */
.hp-show {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0;
}
.hp-show-grid {
  display: grid;
  gap: var(--mft-space-6);
  max-width: var(--hp-max);
  margin: 0 auto;
  padding: 0 var(--mft-space-4);
}
@media (min-width: 900px) {
  .hp-show-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .hp-show-grid.cols-2 {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
  }
}
.hp-show-card {
  background: var(--mft-bg-elevated);
  border: 1px solid var(--mft-border);
  border-radius: var(--mft-radius-xl);
  padding: var(--mft-space-6);
  box-shadow: var(--mft-shadow-sm);
  min-height: 160px;
}
.hp-show-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.hp-show-card p {
  margin: 0;
  color: var(--mft-text-muted);
  line-height: 1.75;
  font-size: 0.95rem;
}
.hp-logo-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mft-space-3);
  justify-content: center;
  align-items: center;
}
.hp-logo-chip {
  min-width: 120px;
  min-height: 48px;
  display: grid;
  place-items: center;
  padding: 0.6rem 1rem;
  border-radius: var(--mft-radius-md);
  border: 1px dashed var(--mft-border-strong);
  color: var(--mft-text-subtle);
  font-weight: 800;
  font-size: 0.8rem;
  background: color-mix(in srgb, var(--mft-bg-elevated) 80%, var(--mft-bg-muted));
}
.hp-cta-band {
  margin: var(--mft-space-10) auto;
  max-width: var(--hp-max);
  padding: clamp(1.75rem, 4vw, 2.5rem);
  border-radius: calc(var(--mft-radius-xl) + 4px);
  background:
    radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(125deg, #312e81 0%, #4f46e5 45%, #7c3aed 100%);
  color: #fff;
  box-shadow: var(--mft-shadow-glow);
  display: grid;
  gap: var(--mft-space-4);
}
@media (min-width: 800px) {
  .hp-cta-band {
    grid-template-columns: 1.4fr auto;
    align-items: center;
    padding-inline: var(--mft-space-10);
  }
}
.hp-cta-band h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 900;
  letter-spacing: -0.03em;
}
.hp-cta-band p {
  margin: 0;
  opacity: 0.88;
  line-height: 1.7;
}
.hp-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s var(--mft-ease), transform 0.55s var(--mft-ease);
}
.hp-reveal.is-in {
  opacity: 1;
  transform: none;
}

/* Footer polish */
.site-footer {
  border-top: 1px solid var(--mft-border);
  background: color-mix(in srgb, var(--mft-bg) 70%, white) !important;
}
.footer-inner {
  gap: var(--mft-space-4) !important;
  flex-wrap: wrap;
}

/* ── Admin EP chrome polish ──────────────────────────────────── */
.ep-topbar-btn {
  border-radius: 12px !important;
  transition: background var(--mft-dur-fast) var(--mft-ease), transform var(--mft-dur-fast) var(--mft-ease) !important;
}
.ep-topbar-btn:hover {
  transform: translateY(-1px);
}
.ep-qa-badge {
  border-radius: var(--mft-radius-full) !important;
  font-weight: 900 !important;
  letter-spacing: 0.04em;
}
.ep-toast {
  border-radius: 14px !important;
  box-shadow: var(--mft-shadow-md) !important;
  border: 1px solid var(--mft-border) !important;
}
.ep-dialog {
  border-radius: var(--mft-radius-xl) !important;
  box-shadow: var(--mft-shadow-lg) !important;
  border: 1px solid var(--mft-border) !important;
}
.ep-btn-primary {
  background: linear-gradient(135deg, var(--mft-primary), var(--mft-accent)) !important;
  border: 0 !important;
}

/* ── Student workspace premium ───────────────────────────────── */
.sw-body {
  --sw-primary: var(--mft-primary);
  --sw-accent: var(--mft-accent);
  --sw-radius: var(--mft-radius-lg);
  --sw-shadow: var(--mft-shadow-md);
}
.sw-nav {
  border-inline-end: 1px solid var(--mft-border);
  background: color-mix(in srgb, white 90%, var(--mft-primary-soft)) !important;
}
.sw-btn-primary {
  background: linear-gradient(135deg, var(--mft-primary), var(--mft-accent)) !important;
  border: 0 !important;
  box-shadow: var(--mft-shadow-glow) !important;
}
.sw-login-card,
.sw-card,
.sw-main .sw-panel {
  border-radius: var(--mft-radius-xl) !important;
  box-shadow: var(--mft-shadow-sm) !important;
  border: 1px solid var(--mft-border) !important;
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hp-hero::before {
    animation: none;
  }
}

/* ── Mobile safety ───────────────────────────────────────────── */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}
@media (max-width: 640px) {
  .hp-cta-row {
    flex-direction: column;
    align-items: stretch;
  }
  .hp-btn {
    width: 100%;
    justify-content: center;
  }
  .mft-btn {
    min-height: 44px;
  }
}
