/* ============================================================
   Fankaar — design system (2.0)
   Dark, RTL, Vazirmatn. All legacy classes preserved; this is
   a visual upgrade on top of the original layout tokens.
   ============================================================ */

:root {
  --bg: #0a0e17;
  --bg-soft: #0e1422;
  --surface: #121a2b;
  --surface-2: #172136;
  --surface-hover: #1d2942;
  --border: #223049;
  --border-soft: #1a2540;
  --fg: #e6ebf4;
  --fg-bright: #ffffff;
  --muted: #93a1bb;
  --muted-2: #6d7c99;
  --accent: #14b8a6;
  --accent-2: #38bdf8;
  --accent-bright: #5eead4;
  --accent-text: #052e2b;
  --grad: linear-gradient(135deg, #14b8a6 0%, #38bdf8 100%);
  --grad-soft: linear-gradient(135deg, rgba(20,184,166,.14) 0%, rgba(56,189,248,.10) 100%);
  --error: #f87171;
  --error-bg: #3f0f0f;
  --error-border: #7f1d1d;
  --success: #4ade80;
  --success-bg: #0b2e1a;
  --success-border: #14532d;
  --warning: #fbbf24;
  --warning-bg: #3a2605;
  --warning-border: #78350f;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --glow: 0 0 0 1px rgba(20, 184, 166, .35), 0 0 28px rgba(20, 184, 166, .18);
  --font: "Vazirmatn", "IRANSans", Tahoma, "Segoe UI", sans-serif;
  --transition: all .18s cubic-bezier(.4, 0, .2, 1);
  --header-h: 60px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(56, 189, 248, .07), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(20, 184, 166, .06), transparent 55%),
    var(--bg);
  color: var(--fg);
  font-size: 14.5px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent-bright); text-decoration: none; transition: color .15s ease; }
a:hover { color: #99f6e4; }

::selection { background: rgba(20, 184, 166, .3); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #263450; border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: #31446b; }
*::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------
   Layout
   ------------------------------------------------------------ */
.sidebar {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 230px;
  background: linear-gradient(180deg, #0b101d 0%, #0a0f1a 100%);
  border-left: 1px solid var(--border-soft);
  padding: 20px 12px;
  overflow-y: auto;
  z-index: 5;
}

.brand {
  font-size: 21px; font-weight: 800;
  padding: 4px 14px 20px;
  color: var(--fg-bright);
  letter-spacing: -.2px;
  display: flex; flex-direction: column; gap: 2px;
}
.brand span {
  font-size: 10.5px; color: var(--accent-bright);
  letter-spacing: 3px; text-transform: uppercase; font-weight: 600;
}

.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 3px;
  color: var(--muted);
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid transparent;
}
.sidebar nav a:hover {
  background: var(--surface); color: var(--fg); text-decoration: none;
  transform: translateX(-2px);
}
.sidebar nav a.active {
  background: var(--grad-soft);
  color: var(--accent-bright);
  border-color: rgba(20, 184, 166, .25);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--accent);
}

.main { margin-right: 230px; min-height: 100vh; display: flex; flex-direction: column; }
.main.narrow { margin-right: 0; }

.topbar {
  background: rgba(18, 26, 43, .8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
  padding: 0 26px;
  height: var(--header-h);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 4;
}
.crumb { font-weight: 700; font-size: 15px; color: var(--fg-bright); }
.userbox { display: flex; align-items: center; gap: 12px; }
.u-name { color: var(--fg); font-weight: 600; font-size: 13.5px; }
.u-role {
  background: var(--grad-soft); color: var(--accent-bright);
  border: 1px solid rgba(20, 184, 166, .3);
  border-radius: 999px; padding: 3px 12px; font-size: 12px; font-weight: 600;
}

.content { padding: 26px; max-width: 1220px; width: 100%; margin: 0 auto; }

/* ------------------------------------------------------------
   Components
   ------------------------------------------------------------ */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, #101828 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
  transition: var(--transition);
  position: relative;
}
.card:hover { border-color: #2a3c5c; }

.grid { display: grid; gap: 16px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.stat { text-align: center; display: block; border-radius: var(--radius); overflow: hidden; }
.stat::before {
  content: ""; position: absolute; inset: 0 0 auto;
  height: 3px; background: var(--grad); opacity: .8;
}
.stat:hover { transform: translateY(-3px); border-color: rgba(20,184,166,.4); box-shadow: var(--glow); }
.stat-num { font-size: 32px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.3; }
.stat-label { color: var(--muted); font-size: 13.5px; }

/* tables */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td {
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 12px; text-align: right; vertical-align: middle;
}
.table th {
  background: rgba(10, 14, 23, .6);
  color: var(--muted); font-weight: 600;
  white-space: nowrap;
  border-top: 1px solid var(--border-soft);
  font-size: 12.5px;
  letter-spacing: .2px;
}
.table tr { transition: background .12s ease; }
.table tr:hover td { background: rgba(29, 41, 66, .45); }
.table tr:last-child td { border-bottom: none; }

.num { text-align: left; font-variant-numeric: tabular-nums; direction: ltr; }
.mono { direction: ltr; font-family: "Consolas", "JetBrains Mono", monospace; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.wrap { word-break: break-word; max-width: 420px; unicode-bidi: plaintext; }

/* forms */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
input, select, textarea {
  font: inherit;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0b1120;
  color: var(--fg);
  min-width: 0;
  transition: var(--transition);
}
input:hover, select:hover, textarea:hover { border-color: #2e4268; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .15);
  background: #0f1728;
}
textarea { width: 100%; resize: vertical; }
label { display: block; margin: 12px 0 5px; color: var(--muted); font-size: 13px; font-weight: 500; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 18px;
  cursor: pointer;
  font: inherit; font-weight: 600;
  background: var(--surface-hover); color: var(--fg);
  transition: var(--transition);
  white-space: nowrap;
}
.btn:hover { background: #24304e; color: #fff; text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--grad); color: #04120f; border-color: transparent; box-shadow: 0 4px 16px rgba(20,184,166,.25); }
.btn.primary:hover { box-shadow: 0 6px 22px rgba(20,184,166,.4); filter: brightness(1.06); color: #04120f; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--fg); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-bright); background: rgba(20,184,166,.06); }
.btn.danger { background: var(--error-bg); color: var(--error); border-color: var(--error-border); }
.btn.danger:hover { background: #7f1d1d; color: #fecaca; }
.btn.lg { padding: 12px 26px; font-size: 15px; border-radius: 12px; }
.btn.small { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.inline { display: inline; }

.alert { border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.alert.error { background: var(--error-bg); color: #fca5a5; border: 1px solid var(--error-border); }
.alert.ok { background: var(--success-bg); color: #86efac; border: 1px solid var(--success-border); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* ------------------------------------------------------------
   Auth
   ------------------------------------------------------------ */
.auth-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(800px 500px at 80% 10%, rgba(56,189,248,.10), transparent 55%),
    radial-gradient(700px 500px at 10% 90%, rgba(20,184,166,.08), transparent 55%),
    var(--bg);
}
.auth-card {
  width: 400px;
  padding: 34px 32px;
  text-align: center;
}
.auth-card h1 { font-size: 21px; margin: 0 0 4px; color: var(--fg-bright); }
.auth-card .auth-sub { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.auth-card form { text-align: right; }
.auth-card .btn { width: 100%; margin-top: 18px; }
.auth-logo {
  font-size: 34px; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px;
}
.auth-foot { margin-top: 16px; font-size: 12.5px; color: var(--muted-2); }

/* ------------------------------------------------------------
   Landing page
   ------------------------------------------------------------ */
.landing { max-width: 1100px; margin: 0 auto; }

.hero {
  text-align: center;
  padding: 64px 20px 40px;
  position: relative;
}
.hero-badge {
  display: inline-block;
  background: var(--grad-soft);
  border: 1px solid rgba(20,184,166,.3);
  color: var(--accent-bright);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 18px;
}
.hero-title {
  font-size: clamp(40px, 7vw, 64px);
  font-weight: 900;
  margin: 0 0 8px;
  letter-spacing: -1px;
  line-height: 1.15;
  background: linear-gradient(135deg, #ffffff 20%, #99f6e4 55%, #7dd3fc 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: heroTitleUp .8s cubic-bezier(.22,.61,.36,1) both;
}
.hero-sub {
  max-width: 640px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-stats {
  display: flex; gap: 18px; justify-content: center; flex-wrap: wrap;
  margin-top: 44px;
}
.stat.chip {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 16px 28px;
  min-width: 150px;
}
.stat.chip .stat-num { font-size: 26px; display: block; }

.section-title {
  text-align: center;
  font-size: 26px; font-weight: 800;
  color: var(--fg-bright);
  margin: 0 0 8px;
}

.features { padding: 48px 0 20px; }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 28px;
}
.feature-card {
  background: linear-gradient(180deg, var(--surface) 0%, #101828 100%);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 22px 20px;
  transition: var(--transition);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(20,184,166,.4);
  box-shadow: var(--glow);
}
.fe-ico {
  font-size: 28px;
  display: inline-block;
  margin-bottom: 10px;
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-soft);
  border: 1px solid rgba(20,184,166,.25);
  border-radius: 14px;
}
.feature-card h3 { margin: 0 0 6px; font-size: 16px; color: var(--fg-bright); font-weight: 700; }
.feature-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.8; }

.steps { padding: 40px 0; }
.step-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 26px;
}
.step {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 22px;
  text-align: center;
}
.step-n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--grad);
  color: #04120f;
  font-weight: 800; font-size: 17px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.step h3 { margin: 0 0 6px; font-size: 15.5px; color: var(--fg-bright); }
.step p { margin: 0; color: var(--muted); font-size: 13.5px; }

.cta-band {
  margin: 32px 0 56px;
  text-align: center;
  background: linear-gradient(135deg, rgba(20,184,166,.12), rgba(56,189,248,.10));
  border: 1px solid rgba(20,184,166,.3);
  border-radius: 20px;
  padding: 44px 24px;
}
.cta-band h2 { margin: 0 0 18px; font-size: 24px; color: var(--fg-bright); }

/* ------------------------------------------------------------
   Mobile
   ------------------------------------------------------------ */
@media (max-width: 960px) {
  .sidebar {
    position: static; width: 100%; height: auto;
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    border-left: none; border-bottom: 1px solid var(--border-soft);
    padding: 10px 14px;
  }
  .brand { padding: 2px 10px 2px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .main { margin-right: 0; }
  .topbar { padding: 0 14px; height: 54px; }
  .content { padding: 16px; }
  .hero { padding: 40px 12px 30px; }
  .hero-sub { font-size: 15px; }
}

/* ============================================================
   Hero app-screen mockup + motion graphics
   ============================================================ */
.hero-visual {
  position: relative;
  max-width: 760px;
  margin: 48px auto 0;
  perspective: 1200px;
  animation: visualIn 1s cubic-bezier(.22,.61,.36,1) .25s both;
}

.h-screen {
  background: linear-gradient(180deg, rgba(22,32,54,.92), rgba(13,19,33,.96));
  border: 1px solid rgba(56,189,248,.25);
  border-radius: 18px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(20,184,166,.12);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.h-topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10,15,26,.6);
}
.h-dot { width: 10px; height: 10px; border-radius: 50%; background: #f87171; display: inline-block; }
.h-dot.alt { background: #fbbf24; }
.h-dot:last-of-type { background: #4ade80; }
.h-crumb { margin-right: auto; font-size: 12px; color: var(--muted); }

.h-body { display: flex; min-height: 260px; }
.h-side {
  width: 52px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px 12px;
  border-left: 1px solid var(--border-soft);
  background: rgba(10,15,26,.4);
}
.h-navline { height: 8px; border-radius: 99px; background: #243049; }
.h-navline.active { background: var(--grad); box-shadow: 0 0 12px rgba(20,184,166,.5); }

.h-main { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.h-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.h-card {
  background: rgba(23,33,54,.8);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  display: flex; flex-direction: column; gap: 2px;
}
.h-card b { font-size: 18px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.h-card span { font-size: 10.5px; color: var(--muted); }

.h-chart {
  flex: 1;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 14px 8px 4px;
  border-top: 1px solid var(--border-soft);
}
.h-bar {
  flex: 1;
  height: var(--h, 50%);
  background: linear-gradient(180deg, #38bdf8, #14b8a6);
  border-radius: 6px 6px 2px 2px;
  transform-origin: bottom;
  animation: barGrow .9s cubic-bezier(.22,.61,.36,1) both;
  opacity: .85;
  transition: opacity .2s;
}
.h-bar:hover { opacity: 1; }

.h-float-card {
  position: absolute;
  background: rgba(23,33,54,.95);
  border: 1px solid rgba(20,184,166,.4);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px; font-weight: 600;
  color: var(--fg-bright);
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 8px;
  animation: floatY 5s ease-in-out infinite;
}
.h-float-card.f1 { top: -18px; right: -28px; }
.h-float-card.f2 { bottom: -16px; left: -24px; animation-delay: 2.5s; }

/* ---------- keyframes ---------- */
@keyframes heroTitleUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes visualIn {
  from { opacity: 0; transform: translateY(30px) rotateX(6deg); }
  to { opacity: 1; transform: translateY(0) rotateX(0); }
}
@keyframes barGrow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ---------- ambient background orbs (motion) ---------- */
.landing { position: relative; }
.landing::before,
.landing::after {
  content: "";
  position: fixed;
  width: 420px; height: 420px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .14;
  z-index: -1;
  animation: orbDrift 16s ease-in-out infinite;
}
.landing::before {
  background: #14b8a6;
  top: -120px; left: -120px;
}
.landing::after {
  background: #38bdf8;
  bottom: -140px; right: -140px;
  animation-delay: -8s;
}
@keyframes orbDrift {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.15); }
}

/* ---------- scroll-reveal on feature cards / steps ---------- */
.reveal { opacity: 0; }
.reveal.in-view { animation: revealUp .65s cubic-bezier(.22,.61,.36,1) forwards; }
@keyframes revealUp {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}
.feature-card, .step { will-change: transform, opacity; }
