/* ═══════════════════════════════════════════════════════════════
   LexiGuard — Main Stylesheet
   Modern dark/light theme, bilingual (RTL/LTR)
   ═══════════════════════════════════════════════════════════════ */

:root {
  --gold: #c9a84c;
  --gold-soft: #d4af37;
  --gold-glow: rgba(201, 168, 76, 0.35);
  --green: #5cb88c;
  --red: #e85c5c;
  --orange: #f5a524;
  --blue: #4a90e2;
  --purple: #9b59b6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.25);
}

/* Dark theme (default) */
[data-theme='dark'] {
  --bg-0: #0a0d12;
  --bg-1: #0f141a;
  --bg-2: #161c25;
  --bg-3: #1e2733;
  --text: #e8ecf2;
  --text-muted: #94a0b0;
  --text-dim: #5d6878;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --hero-grad-1: rgba(201, 168, 76, 0.18);
  --hero-grad-2: rgba(74, 144, 226, 0.12);
}

[data-theme='light'] {
  --bg-0: #f8f9fb;
  --bg-1: #ffffff;
  --bg-2: #ffffff;
  --bg-3: #f0f3f7;
  --text: #1a202c;
  --text-muted: #4a5568;
  --text-dim: #718096;
  --border: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.13);
  --hero-grad-1: rgba(201, 168, 76, 0.13);
  --hero-grad-2: rgba(74, 144, 226, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

html[dir='rtl'] body {
  font-family: 'Noto Kufi Arabic', 'Tajawal', 'Inter', sans-serif;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

/* ═══════ NAVIGATION ═══════ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-0) 85%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0d12;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 4px 14px var(--gold-glow);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: color var(--transition);
}

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

.nav-cta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.icon-btn:hover {
  background: var(--bg-3);
  color: var(--text);
}

/* ═══════ BUTTONS ═══════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  color: #0a0d12;
  box-shadow: 0 6px 20px var(--gold-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px var(--gold-glow);
}

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

.btn-ghost:hover { background: var(--bg-2); }

.btn-secondary {
  background: var(--bg-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-3);
  border-color: var(--border-strong);
}

.btn-lg { padding: 1rem 1.8rem; font-size: 1rem; border-radius: 14px; }
.btn-sm { padding: 0.5rem 0.95rem; font-size: 0.82rem; border-radius: 10px; }
.btn-block { width: 100%; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ═══════ HERO ═══════ */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 1.5rem 4rem;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 900px;
  background: radial-gradient(circle, var(--hero-grad-1) 0%, transparent 60%);
  z-index: 0;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -300px;
  right: -100px;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--hero-grad-2) 0%, transparent 60%);
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.hero-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(92, 184, 140, 0.18);
}

.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.1;
  margin: 0 0 1.25rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero h1 .gradient {
  background: linear-gradient(135deg, var(--gold), var(--gold-soft));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.lead {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
  max-width: 540px;
  line-height: 1.55;
}

.hero-cta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: 2.5rem;
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.hero-stat .num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
}

.hero-stat .label {
  font-size: 0.83rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.hero-visual {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
}

.hero-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-xl);
  padding: 1px;
  background: linear-gradient(135deg, var(--gold), transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.hero-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.hero-card-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(232, 92, 92, 0.12);
  color: var(--red);
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid rgba(232, 92, 92, 0.3);
}

.risk-circle {
  width: 110px;
  height: 110px;
  margin: 0 auto 1.25rem;
  position: relative;
}

.risk-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.risk-circle .track { stroke: var(--bg-3); }
.risk-circle .fill { stroke: var(--red); transition: stroke-dashoffset 1.5s; }
.risk-circle .num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
}

.clause-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-2);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}

.clause-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.clause-item .dot.red { background: var(--red); box-shadow: 0 0 0 4px rgba(232, 92, 92, 0.15); }
.clause-item .dot.orange { background: var(--orange); box-shadow: 0 0 0 4px rgba(245, 165, 36, 0.15); }
.clause-item .dot.green { background: var(--green); box-shadow: 0 0 0 4px rgba(92, 184, 140, 0.15); }

.clause-item .text {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
}

.floating-card {
  position: absolute;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: float 4s ease-in-out infinite;
}

.floating-card.tl { top: -20px; left: -30px; }
.floating-card.br { bottom: 20px; right: -40px; animation-delay: 1.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.floating-card .ico {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

/* ═══════ SECTIONS ═══════ */
.section {
  padding: 5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-head {
  text-align: center;
  margin-bottom: 3rem;
}

.section-head .eyebrow {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.section-head h2 {
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-weight: 800;
  margin: 0 0 0.8rem;
  letter-spacing: -0.015em;
}

.section-head p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}

/* ═══════ FEATURES GRID ═══════ */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-soft) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  color: #0a0d12;
  box-shadow: 0 8px 20px var(--gold-glow);
}

.feature-icon.blue { background: linear-gradient(135deg, #4a90e2, #357abd); color: white; box-shadow: 0 8px 20px rgba(74, 144, 226, 0.3); }
.feature-icon.green { background: linear-gradient(135deg, #5cb88c, #449a76); color: white; box-shadow: 0 8px 20px rgba(92, 184, 140, 0.3); }
.feature-icon.purple { background: linear-gradient(135deg, #9b59b6, #7d4096); color: white; box-shadow: 0 8px 20px rgba(155, 89, 182, 0.3); }
.feature-icon.orange { background: linear-gradient(135deg, #f5a524, #d68e10); color: white; box-shadow: 0 8px 20px rgba(245, 165, 36, 0.3); }
.feature-icon.red { background: linear-gradient(135deg, #e85c5c, #c64545); color: white; box-shadow: 0 8px 20px rgba(232, 92, 92, 0.3); }

.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.6;
}

/* ═══════ HOW IT WORKS ═══════ */
.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  position: relative;
}

.how-grid::before {
  content: '';
  position: absolute;
  top: 70px;
  left: 16%;
  right: 16%;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    var(--border-strong) 0,
    var(--border-strong) 6px,
    transparent 6px,
    transparent 14px
  );
  z-index: 0;
}

html[dir='rtl'] .how-grid::before {
  background: repeating-linear-gradient(
    to left,
    var(--border-strong) 0,
    var(--border-strong) 6px,
    transparent 6px,
    transparent 14px
  );
}

.how-step {
  position: relative;
  z-index: 1;
  text-align: center;
}

.how-num {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--bg-1);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold);
  box-shadow: 0 0 0 8px var(--bg-0);
}

.how-step .illust {
  width: 100%;
  max-width: 200px;
  height: 130px;
  margin: 0 auto 1.25rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.how-step h3 {
  margin: 0.5rem 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.how-step p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ═══════ PRICING ═══════ */
.billing-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin: 0 auto 2.5rem;
}

.billing-toggle button {
  background: transparent;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition);
}

.billing-toggle button.active {
  background: var(--gold);
  color: #0a0d12;
}

.billing-toggle .save-badge {
  background: rgba(92, 184, 140, 0.15);
  color: var(--green);
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 8px;
  margin-inline-start: 6px;
  font-weight: 700;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.price-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
}

.price-card:hover { border-color: var(--border-strong); }

.price-card.featured {
  border-color: var(--gold);
  background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 6%, var(--bg-1)) 0%, var(--bg-1) 100%);
  box-shadow: 0 0 0 1px var(--gold), 0 20px 50px rgba(201, 168, 76, 0.1);
  transform: scale(1.02);
}

.price-card .popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gold);
  color: #0a0d12;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

.price-card .plan-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--gold);
}

.price-card.featured .plan-icon {
  background: var(--gold);
  color: #0a0d12;
}

.price-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 700;
}

.price-card .price {
  font-size: 2.3rem;
  font-weight: 800;
  margin: 0.5rem 0;
  letter-spacing: -0.02em;
}

.price-card .price small {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.price-card ul {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  flex: 1;
}

.price-card ul li {
  padding: 0.45rem 0;
  font-size: 0.9rem;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.price-card ul li svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--green);
  margin-top: 3px;
}

/* ═══════ FOOTER ═══════ */
.footer {
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 2rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 2rem;
}

.footer h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer ul li { margin: 0.55rem 0; }

.footer ul a {
  color: var(--text);
  font-size: 0.93rem;
  transition: color var(--transition);
}

.footer ul a:hover { color: var(--gold); }

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* ═══════ APP PAGE LAYOUT ═══════ */
.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-1);
  border-inline-end: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand { padding: 0 0.5rem 1.25rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); }

.side-section {
  margin-top: 1.5rem;
}

.side-section .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 0 0.7rem;
  margin-bottom: 0.5rem;
}

.side-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 0.93rem;
  font-weight: 500;
  margin-bottom: 0.15rem;
  cursor: pointer;
  transition: all var(--transition);
}

.side-link:hover { background: var(--bg-2); color: var(--text); }
.side-link.active { background: var(--bg-2); color: var(--text); border-inline-start: 3px solid var(--gold); padding-inline-start: calc(0.8rem - 3px); }
.side-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.side-link .badge {
  margin-inline-start: auto;
  background: var(--gold);
  color: #0a0d12;
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
}

.main {
  padding: 2rem 2rem 3rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0;
}

/* ═══════ CARDS / FORMS ═══════ */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.card.gradient {
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 8%, var(--bg-1)) 0%, var(--bg-1) 100%);
  border-color: var(--gold);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.card-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }
.card-head .ico { color: var(--gold); }

.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text);
}

.form-row input,
.form-row textarea,
.form-row select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color var(--transition);
}

.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.form-row textarea { min-height: 120px; resize: vertical; }

.form-error {
  background: rgba(232, 92, 92, 0.1);
  color: var(--red);
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid rgba(232, 92, 92, 0.25);
  margin-bottom: 1rem;
}

.form-success {
  background: rgba(92, 184, 140, 0.1);
  color: var(--green);
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  font-size: 0.88rem;
  border: 1px solid rgba(92, 184, 140, 0.25);
  margin-bottom: 1rem;
}

.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; } .gap-3 { gap: 1.5rem; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* ═══════ TABLES ═══════ */
.table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table.lex {
  width: 100%;
  border-collapse: collapse;
}

table.lex th, table.lex td {
  padding: 0.85rem 1rem;
  text-align: start;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border);
}

table.lex th {
  background: var(--bg-2);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

table.lex tr:last-child td { border-bottom: none; }

table.lex tr.clickable { cursor: pointer; transition: background var(--transition); }
table.lex tr.clickable:hover { background: var(--bg-2); }

/* ═══════ DROP ZONE ═══════ */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--bg-1);
  cursor: pointer;
  transition: all var(--transition);
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 4%, var(--bg-1));
}

.dropzone svg {
  width: 56px;
  height: 56px;
  color: var(--gold);
  margin: 0 auto 1rem;
}

.dropzone h3 { margin: 0 0 0.35rem; font-weight: 700; }
.dropzone p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* ═══════ TOAST ═══════ */
@keyframes lexiToastSlide {
  from { opacity: 0; transform: translate(50%, -10px); }
  to { opacity: 1; transform: translate(50%, 0); }
}
html[dir='rtl'] @keyframes lexiToastSlide {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ═══════ SPINNER ═══════ */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 13, 18, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 1rem;
}

.loading-overlay .spinner { width: 48px; height: 48px; color: var(--gold); border-width: 3px; }

/* ═══════ PILLS / BADGES ═══════ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.pill.red { background: rgba(232, 92, 92, 0.12); color: var(--red); border: 1px solid rgba(232, 92, 92, 0.25); }
.pill.green { background: rgba(92, 184, 140, 0.12); color: var(--green); border: 1px solid rgba(92, 184, 140, 0.25); }
.pill.orange { background: rgba(245, 165, 36, 0.12); color: var(--orange); border: 1px solid rgba(245, 165, 36, 0.3); }
.pill.gold { background: rgba(201, 168, 76, 0.12); color: var(--gold); border: 1px solid rgba(201, 168, 76, 0.3); }
.pill.blue { background: rgba(92, 140, 232, 0.12); color: #5c8ce8; border: 1px solid rgba(92, 140, 232, 0.25); }
.pill.muted { background: var(--bg-2); color: var(--text-muted); border: 1px solid var(--border); }

/* ═══════ AUTH PAGE ═══════ */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-art {
  background: linear-gradient(135deg, #0f141a 0%, #1a2330 100%);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  overflow: hidden;
}

.auth-art::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 60%);
  top: -100px;
  right: -100px;
}

.auth-art-inner {
  position: relative;
  z-index: 1;
  color: white;
  max-width: 420px;
}

.auth-art h2 {
  font-size: 2rem;
  font-weight: 800;
  margin: 0 0 1rem;
  line-height: 1.2;
}

.auth-art p {
  color: rgba(255, 255, 255, 0.7);
  margin: 0 0 2rem;
  font-size: 1.05rem;
}

.auth-quote {
  background: rgba(255, 255, 255, 0.05);
  border-inline-start: 3px solid var(--gold);
  padding: 1.25rem;
  border-radius: 12px;
  margin-top: 2rem;
}

.auth-quote .stars { color: var(--gold); margin-bottom: 0.5rem; }

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--bg-0);
}

.auth-form {
  width: 100%;
  max-width: 400px;
}

.auth-form h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 0 0.4rem;
}

.auth-form .sub {
  color: var(--text-muted);
  margin: 0 0 2rem;
}

/* ═══════ ANALYSIS RESULTS ═══════ */
.analysis-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

.risk-display {
  text-align: center;
  padding: 2rem;
}

.risk-display .big-circle {
  width: 180px;
  height: 180px;
  margin: 0 auto 1rem;
  position: relative;
}

.risk-display .big-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }

.risk-display .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.clause-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.clause-card .head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.clause-card .title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex: 1;
}

.clause-card h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.clause-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ═══════ CASE GRID ═══════ */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.case-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  min-height: 160px;
  display: flex;
  flex-direction: column;
}

.case-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.case-card .emoji { font-size: 2rem; margin-bottom: 0.75rem; }
.case-card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; font-weight: 700; }
.case-card p { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

.case-card .top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

/* ═══════ CHAT ═══════ */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: 70vh;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-msg {
  max-width: 80%;
  padding: 0.85rem 1.1rem;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--gold);
  color: #0a0d12;
  border-bottom-right-radius: 4px;
}

html[dir='rtl'] .chat-msg.user { border-bottom-right-radius: 16px; border-bottom-left-radius: 4px; }

.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg-2);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

html[dir='rtl'] .chat-msg.assistant { border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; }

.chat-input {
  border-top: 1px solid var(--border);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
}

.chat-input input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.95rem;
}

.chat-input input:focus { outline: none; border-color: var(--gold); }

.chat-input button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--gold);
  color: #0a0d12;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ═══════ STAT CARDS ═══════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-card .ico {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
}

.stat-card .num { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.stat-card .label { font-size: 0.83rem; color: var(--text-muted); margin-top: 4px; }

/* ═══════ RESPONSIVE ═══════ */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-visual { order: -1; max-width: 340px; margin: 0 auto; }
  .floating-card { display: none; }
  .how-grid { grid-template-columns: 1fr; }
  .how-grid::before { display: none; }
  .analysis-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 260px; transition: left var(--transition); z-index: 200; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  html[dir='rtl'] .sidebar { left: auto; right: -260px; }
  html[dir='rtl'] .sidebar.open { right: 0; }
  .nav-links { display: none; }
  .main { padding: 1.5rem 1rem 3rem; }
  .hero-stats { flex-wrap: wrap; gap: 1.25rem; }
}

@media (max-width: 600px) {
  .features-grid { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .price-card.featured { transform: none; }
}

/* RTL helpers */
html[dir='rtl'] .side-link.active { border-inline-start: none; border-inline-end: 3px solid var(--gold); padding-inline-end: calc(0.8rem - 3px); padding-inline-start: 0.8rem; }

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 200% 100%;
  animation: skelShimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skelShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   VISUAL POLISH LAYER
   - Hero dot-grid + orbital decoration
   - Risk-circle scan beam
   - Floating-card variants + extra rating card
   - Trust strip
   - Feature-card corner shine on hover
   - How-it-works illustration depth (grid background)
   ═══════════════════════════════════════════════════════════════ */

/* Subtle dot-grid behind hero content */
.hero-grid-pattern {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, color-mix(in srgb, var(--text) 14%, transparent) 1px, transparent 1.5px);
  background-size: 26px 26px;
  background-position: 0 0;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 35%, #000 30%, transparent 80%);
  opacity: 0.55;
}

[data-theme='light'] .hero-grid-pattern { opacity: 0.7; }

/* Orbital rings around the hero card */
.hero-orbit {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-orbit::before,
.hero-orbit::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px dashed color-mix(in srgb, var(--gold) 35%, transparent);
  animation: orbitSpin 30s linear infinite;
}

.hero-orbit::before {
  width: 480px;
  height: 480px;
  margin: -240px 0 0 -240px;
  opacity: 0.5;
}

.hero-orbit::after {
  width: 620px;
  height: 620px;
  margin: -310px 0 0 -310px;
  opacity: 0.25;
  animation-duration: 60s;
  animation-direction: reverse;
}

.hero-orbit .orbit-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 14px var(--gold-glow), 0 0 4px var(--gold);
  top: 50%;
  left: 50%;
  margin: -4px 0 0 -4px;
  transform-origin: 4px 4px;
  animation: orbitTravel 14s linear infinite;
}

.hero-orbit .orbit-dot.alt {
  background: var(--blue);
  box-shadow: 0 0 14px rgba(74, 144, 226, 0.5), 0 0 4px var(--blue);
  animation-duration: 22s;
  animation-direction: reverse;
}

@keyframes orbitSpin {
  to { transform: rotate(360deg); }
}

@keyframes orbitTravel {
  from { transform: rotate(0deg) translateX(240px) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(240px) rotate(-360deg); }
}

@media (max-width: 960px) {
  .hero-orbit { display: none; }
}

/* Bring the hero-visual above the orbit decoration */
.hero-visual { z-index: 2; }

/* Risk-circle: animated scan beam */
.risk-circle::before {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    color-mix(in srgb, var(--red) 55%, transparent) 30deg,
    transparent 60deg,
    transparent 360deg
  );
  -webkit-mask: radial-gradient(circle, transparent 56%, #000 57%, #000 70%, transparent 71%);
  mask: radial-gradient(circle, transparent 56%, #000 57%, #000 70%, transparent 71%);
  animation: riskScan 4s linear infinite;
  pointer-events: none;
  opacity: 0.65;
}

@keyframes riskScan {
  to { transform: rotate(360deg); }
}

/* Number stays above the scan ring */
.risk-circle .num { z-index: 2; }
.risk-circle svg { position: relative; z-index: 1; }

/* Third floating card (rating) + variants */
.floating-card.mid {
  top: 50%;
  left: -60px;
  margin-top: -22px;
  animation-delay: 0.75s;
}

html[dir='rtl'] .floating-card.tl { left: auto; right: -30px; }
html[dir='rtl'] .floating-card.br { right: auto; left: -40px; }
html[dir='rtl'] .floating-card.mid { left: auto; right: -60px; }

.floating-card .stars {
  display: inline-flex;
  gap: 1px;
  color: var(--gold);
}

.floating-card .ico.green-bg {
  color: var(--green);
  background: color-mix(in srgb, var(--green) 14%, var(--bg-2));
}

@media (max-width: 960px) {
  .floating-card.mid { display: none; }
}

/* Trust strip below hero stats */
.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
  align-items: center;
}

.trust-strip .label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}

.trust-strip .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}

.trust-badge:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.trust-badge svg { color: var(--gold); }
.trust-badge.green svg { color: var(--green); }
.trust-badge.blue svg { color: var(--blue); }

/* Feature card: corner shine + animated top accent on hover */
.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--gold), transparent);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover::before { width: 100%; }

.feature-card::after {
  content: '';
  position: absolute;
  top: -40px;
  inset-inline-end: -40px;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, var(--gold-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.feature-card:hover::after { opacity: 0.7; }

/* How-it-works illust: subtle grid backdrop for depth */
.how-step .illust {
  position: relative;
  background-color: var(--bg-1);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--text) 8%, transparent) 1px, transparent 1.5px);
  background-size: 14px 14px;
  background-position: 0 0;
  transition: transform var(--transition), border-color var(--transition);
}

.how-step:hover .illust {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--gold) 50%, var(--border));
}

/* Subtle pulse on the hero badge dot */
.hero-badge .dot {
  animation: pulseDot 2.2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 4px rgba(92, 184, 140, 0.18); }
  50%      { box-shadow: 0 0 0 7px rgba(92, 184, 140, 0.05); }
}

/* Gradient text gets a soft glow */
.hero h1 .gradient {
  filter: drop-shadow(0 4px 22px var(--gold-glow));
}

/* Section divider — soft glow line between sections */
.section-divider {
  height: 1px;
  max-width: 1100px;
  margin: 0 auto;
  background: linear-gradient(
    90deg,
    transparent 0%,
    color-mix(in srgb, var(--gold) 35%, transparent) 50%,
    transparent 100%
  );
  opacity: 0.5;
}

/* ═══════════════════════════════════════════════════════════════
   Language Selector
   ═══════════════════════════════════════════════════════════════ */
.lang-select {
  padding: 0.5rem 0.75rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  outline: none;
  min-width: 140px;
}

.lang-select:hover {
  border-color: var(--border-strong);
  background: var(--bg-3);
}

.lang-select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.lang-select option {
  background: var(--bg-2);
  color: var(--text);
  padding: 0.5rem;
}

/* Language selector in navigation */
.nav-cta .lang-select {
  margin-inline-end: 0.5rem;
}
