/* ============================================================
   Freemiga — shared design system
   Dark, glass-panel aesthetic with a violet→cyan accent gradient.
   ============================================================ */

:root {
  --bg: #05060a;
  --bg-soft: #0a0c12;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-solid: #10121a;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #f4f6fb;
  --text-dim: #9aa3b5;
  --text-faint: #636d82;

  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-soft: rgba(124, 92, 255, 0.14);
  --gradient: linear-gradient(135deg, #8b6bff 0%, #6e8dff 45%, #22d3ee 100%);

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 0 1px rgba(124, 92, 255, 0.25), 0 12px 40px -12px rgba(124, 92, 255, 0.45);

  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

html[dir="rtl"] {
  --font-display: "Vazirmatn", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Vazirmatn", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Ambient background glow + faint grid — pure CSS, no assets */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(700px 500px at 12% -8%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at 100% 10%, rgba(34, 211, 238, 0.14), transparent 55%),
    radial-gradient(600px 500px at 50% 120%, rgba(124, 92, 255, 0.12), transparent 60%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 100%);
  pointer-events: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0;
}

::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 20px;
}

.container-mid {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Navbar ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  background: rgba(5, 6, 10, 0.7);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #05060a;
  box-shadow: 0 4px 18px -4px rgba(124, 92, 255, 0.7);
}

.brand-name {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
  color: var(--text-dim);
}

.nav-links a:hover {
  color: var(--text);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-switch {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.lang-switch:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--gradient);
  color: #05060a;
  box-shadow: 0 8px 26px -8px rgba(124, 92, 255, 0.65);
}

.btn-primary:hover {
  box-shadow: 0 10px 32px -6px rgba(124, 92, 255, 0.85);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

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

.btn-ghost:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.3);
}

.btn-danger:hover {
  background: rgba(251, 113, 133, 0.22);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12.5px;
}

.btn-block {
  width: 100%;
}

/* ---------- Cards / panels ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 28px;
}

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 0 0 7px;
}

input, textarea, select {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  margin-bottom: 16px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
}

input::placeholder, textarea::placeholder {
  color: var(--text-faint);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  margin-top: -6px;
  margin-bottom: 14px;
  display: none;
}

.helper {
  color: var(--text-dim);
  font-size: 12.5px;
  margin: -8px 0 16px;
  line-height: 1.6;
}

/* ---------- Badges / status tags ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-pulse .badge-dot {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.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-neutral { background: rgba(255, 255, 255, 0.06); color: var(--text-dim); }

/* ---------- Misc utility ---------- */

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }

.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 24px 0;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  margin-top: 80px;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-faint);
}

.footer-inner a:hover {
  color: var(--text-dim);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-up {
  animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (max-width: 720px) {
  .nav-links { display: none; }
}

/* ---------- Marketing page sections (home, plans, how-it-works, features) ---------- */

.page-hero {
  padding: 64px 24px 20px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.1;
  max-width: 720px;
  margin: 0 auto;
}

.page-hero p.lead {
  max-width: 540px;
  margin: 18px auto 0;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.7;
}

.section { padding: 56px 24px; }
.section-head { text-align: center; max-width: 560px; margin: 0 auto 44px; }
.section-head .kicker { color: var(--accent-2); font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.section-head h2 { font-size: clamp(26px, 4vw, 36px); margin-top: 10px; }
.section-head p { color: var(--text-dim); margin-top: 12px; font-size: 15px; line-height: 1.7; }

.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 720px;
  margin: 0 auto;
}
@media (max-width: 640px) {
  .plans-grid { grid-template-columns: 1fr; max-width: 420px; }
}
.plan-card {
  position: relative;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.plan-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.plan-card.featured { border-color: rgba(124, 92, 255, 0.5); box-shadow: var(--shadow-glow); }
.plan-card.free-trial { border-color: rgba(52, 211, 153, 0.5); box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.25), 0 12px 40px -12px rgba(52, 211, 153, 0.45); }
.plan-card .tag-featured {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--gradient); color: #05060a; font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.plan-card .tag-free {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--success); color: #05060a; font-size: 11px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.plan-name { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.plan-price { font-size: 38px; font-weight: 700; font-family: var(--font-display); margin: 14px 0 2px; }
.plan-price span { font-size: 15px; color: var(--text-dim); font-weight: 500; }
.plan-meta { color: var(--text-dim); font-size: 13px; margin-bottom: 20px; }
.plan-features { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; color: var(--text-dim); }
.plan-features li { display: flex; align-items: center; gap: 8px; }
.plan-features svg { width: 15px; height: 15px; color: var(--success); flex-shrink: 0; }
.plan-card .btn { margin-top: auto; }
.plans-empty { text-align: center; color: var(--text-dim); font-size: 14px; padding: 40px 0; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  max-width: 960px;
  margin: 0 auto;
}
@media (max-width: 860px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .features-grid { grid-template-columns: 1fr; }
}
.feature-card { padding: 26px 22px; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.feature-icon svg { width: 20px; height: 20px; }
.feature-card h3 { font-size: 15px; margin-bottom: 8px; }
.feature-card p { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; }

.steps { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.step-row { display: flex; gap: 18px; align-items: flex-start; padding: 20px 22px; }
.step-num {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 9px;
  background: var(--gradient); color: #05060a; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
}
.step-row h3 { font-size: 15px; margin-bottom: 4px; }
.step-row p { color: var(--text-dim); font-size: 13.5px; line-height: 1.6; }

.cta-band {
  max-width: 920px; margin: 0 auto; padding: 48px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(34, 211, 238, 0.08));
}
.cta-band h2 { font-size: 24px; margin-bottom: 6px; }
.cta-band p { color: var(--text-dim); font-size: 14px; }

.section-link-row {
  display: flex; justify-content: center; margin-top: 32px;
}

/* ---------- Banner carousel ---------- */

.banner-carousel {
  position: relative;
  max-width: 1080px;
  margin: 24px auto 0;
  padding: 0 24px;
}
.banner-track {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 21 / 8;
  min-height: 200px;
  background: var(--panel);
}
.banner-slide {
  position: absolute; inset: 0;
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity 0.5s ease;
}
.banner-slide.active { opacity: 1; pointer-events: auto; }
.banner-slide img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.banner-slide .overlay {
  position: relative; z-index: 1; padding: 28px 32px;
  background: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.15) 60%, transparent 100%);
  width: 100%;
  /* Banner text is admin-authored per-slide and independent of the
     visitor's UI language — auto-detect its own direction from content
     instead of inheriting html[dir], so an English headline doesn't get
     shoved to the right (or vice versa) just because the site is in fa. */
  unicode-bidi: plaintext;
}
.banner-slide h3 {
  font-family: var(--font-display);
  font-size: clamp(20px, 3.2vw, 28px);
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.25;
  text-shadow: 0 2px 10px rgba(0,0,0,0.4);
  unicode-bidi: plaintext;
}
.banner-slide p {
  color: rgba(255,255,255,0.9);
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 520px;
  text-shadow: 0 1px 6px rgba(0,0,0,0.35);
  unicode-bidi: plaintext;
}
.banner-dots {
  display: flex; justify-content: center; gap: 8px; margin-top: 14px;
}
.banner-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong);
  cursor: pointer; transition: background 0.2s ease, transform 0.2s ease;
}
.banner-dot.active { background: var(--accent-2); transform: scale(1.3); }

/* ---------- Toast notifications (replaces native alert()) ---------- */

.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  pointer-events: auto;
  animation: toast-in 0.25s ease;
}
.toast.toast-out { animation: toast-out 0.2s ease forwards; }
.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
}
.toast-error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast-info .toast-icon { background: var(--accent-soft); color: var(--accent-2); }
.toast-msg { flex: 1; }
.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 0;
}
.toast-close:hover { color: var(--text-dim); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}
