/* ==========================================================================
   LawChat AI — dizayn tizimi
   ========================================================================== */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Manrope", "Inter", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --indigo: #6366f1;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --gold: #f5c451;
  --green: #34d399;
  --red: #f87171;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #22d3ee 100%);
  --grad-text: linear-gradient(100deg, #a5b4fc 0%, #c4b5fd 40%, #67e8f9 100%);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* dark (standart) */
  --bg: #05070f;
  --bg-2: #080b17;
  --bg-elev: #0c1022;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eceefb;
  --text-2: #b7bdd6;
  --muted: #8189a8;
  --primary: #7c7ff5;
  --primary-ink: #ffffff;
  --ring: rgba(124, 127, 245, 0.45);
  --shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  --glass: rgba(10, 13, 28, 0.66);
  --code-bg: rgba(255, 255, 255, 0.05);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-2: #eef0f7;
  --bg-elev: #ffffff;
  --surface: rgba(15, 23, 60, 0.03);
  --surface-2: rgba(15, 23, 60, 0.055);
  --surface-3: rgba(15, 23, 60, 0.085);
  --border: rgba(15, 23, 60, 0.09);
  --border-strong: rgba(15, 23, 60, 0.16);
  --text: #0d1226;
  --text-2: #3a4262;
  --muted: #6a7291;
  --primary: #5b5ef0;
  --ring: rgba(91, 94, 240, 0.35);
  --shadow: 0 10px 30px -12px rgba(20, 30, 80, 0.18);
  --shadow-lg: 0 30px 70px -24px rgba(20, 30, 80, 0.28);
  --glass: rgba(255, 255, 255, 0.75);
  --code-bg: rgba(15, 23, 60, 0.05);
  --grad-text: linear-gradient(100deg, #4f46e5 0%, #7c3aed 45%, #0891b2 100%);
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
::selection { background: rgba(124, 127, 245, 0.35); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

.container { width: min(1200px, 100% - 40px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.logo-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--grad); box-shadow: 0 6px 20px -6px rgba(99, 102, 241, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #fff; flex: none;
}
.logo-mark svg { width: 20px; height: 20px; }
.logo small { font-weight: 600; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); margin-left: 2px; }

/* ---------- Tugmalar ---------- */
.btn {
  --h: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 18px; border-radius: 12px; font-weight: 600; font-size: 14.5px;
  white-space: nowrap; transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .2s, opacity .2s;
  border: 1px solid transparent; user-select: none;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-sm { --h: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { --h: 52px; padding: 0 26px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-primary {
  background: var(--grad); color: #fff; background-size: 160% 160%; background-position: 0% 50%;
  box-shadow: 0 10px 30px -10px rgba(99, 102, 241, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { background-position: 100% 50%; box-shadow: 0 14px 40px -10px rgba(99, 102, 241, 1), inset 0 1px 0 rgba(255, 255, 255, 0.3); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-white { background: #fff; color: #0b1020; }
.btn-white:hover { transform: translateY(-1px); box-shadow: 0 12px 30px -10px rgba(255,255,255,.4); }
.btn-danger { background: rgba(248, 113, 113, 0.12); color: var(--red); border-color: rgba(248, 113, 113, 0.25); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Belgilar ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.badge-pro { background: linear-gradient(135deg, rgba(99,102,241,.2), rgba(34,211,238,.18)); border-color: rgba(124,127,245,.35); color: var(--text); }
.badge-business { background: linear-gradient(135deg, rgba(245,196,81,.2), rgba(251,146,60,.14)); border-color: rgba(245,196,81,.4); color: var(--text); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }

/* ---------- Formalar ---------- */
.field { display: grid; gap: 7px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border); outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--muted); }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); background: var(--surface-2); }
.input.invalid { border-color: var(--red); box-shadow: 0 0 0 4px rgba(248, 113, 113, .15); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }
.input-wrap .icon-btn { position: absolute; right: 5px; top: 5px; }
.field-error { color: var(--red); font-size: 12.5px; min-height: 0; }
.form-error {
  display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 12px; font-size: 13.5px;
  background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.25); color: #fca5a5;
}
[data-theme="light"] .form-error { color: #b91c1c; }

/* ---------- Kartalar ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.glass { background: var(--glass); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%); }

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 1000; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; width: min(420px, calc(100% - 32px)); }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toastIn .35s var(--ease);
}
.toast svg { width: 18px; height: 18px; flex: none; }
.toast.success svg { color: var(--green); }
.toast.error svg { color: var(--red); }
.toast.leaving { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(3, 5, 12, 0.66); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; animation: fadeIn .2s ease;
}
.modal {
  width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--bg-elev);
  border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 28px; animation: modalIn .3s var(--ease); position: relative;
}
.modal h3 { font-size: 21px; margin-bottom: 8px; }
.modal .modal-close { position: absolute; top: 14px; right: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* ---------- Sayt navigatsiyasi (landing, pricing) ---------- */
/* Suzuvchi kapsula: tepadan tushib keladi, pastga aylantirilganda shisha qobiqqa kiradi. */
.site-nav { position: fixed; inset: 12px 0 auto 0; z-index: 50; pointer-events: none; animation: navDrop 1s .1s var(--ease) both; }
.site-nav .container {
  pointer-events: auto; position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px;
  height: 64px; padding: 0 10px 0 16px; border-radius: 20px; border: 1px solid transparent;
  transition: height .4s var(--ease), background .4s, border-color .4s, box-shadow .4s, width .5s var(--ease);
}
.site-nav.scrolled .container {
  height: 58px; width: min(1080px, 100% - 24px);
  background: rgba(10, 13, 28, .6); border-color: rgba(255, 255, 255, .09);
  backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .07);
}
/* Kapsula ustki qirrasidagi nur */
.site-nav .container::before {
  content: ""; position: absolute; top: -1px; left: 18%; right: 18%; height: 1px; opacity: 0; transition: opacity .4s;
  background: linear-gradient(90deg, transparent, rgba(165, 180, 252, .8), rgba(103, 232, 249, .8), transparent);
}
.site-nav.scrolled .container::before { opacity: 1; }
@keyframes navDrop { from { opacity: 0; transform: translateY(-28px); filter: blur(6px); } }

.site-nav .logo-mark svg { animation: scaleSwing 2.2s .5s ease-in-out both; transform-origin: 50% 20%; }
.site-nav .logo:hover .logo-mark svg { animation: scaleSwing 1.6s ease-in-out; }
@keyframes scaleSwing { 0% { transform: rotate(0); } 18% { transform: rotate(-14deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-5deg); } 80% { transform: rotate(2deg); } 100% { transform: rotate(0); } }

.nav-links { position: relative; display: flex; gap: 2px; }
.nav-links a { position: relative; z-index: 1; padding: 8px 15px; border-radius: 11px; font-size: 14.5px; font-weight: 500; color: var(--text-2); transition: color .25s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
/* Kursor ortidan suzuvchi yorug'lik (common.js joylaydi) */
.nav-glow {
  position: absolute; top: 0; left: 0; height: 100%; width: 0; border-radius: 11px; opacity: 0; pointer-events: none;
  background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08);
  transition: transform .45s var(--ease), width .45s var(--ease), opacity .3s;
}
.nav-glow::after { content: ""; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); box-shadow: 0 0 12px rgba(124, 127, 245, .9); }
.nav-links:hover .nav-glow { opacity: 1; }

/* Navbar'dagi asosiy tugma: aylanib yonadigan chegara */
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.site-nav .nav-actions .btn-primary { position: relative; isolation: isolate; }
.site-nav .nav-actions .btn-primary::before {
  content: ""; position: absolute; inset: -1.5px; z-index: -1; border-radius: 13px; padding: 1.5px;
  background: conic-gradient(from var(--spin), transparent 0 55%, #67e8f9 70%, #c4b5fd 82%, transparent 95%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: spin 4s linear infinite;
}
@keyframes spin { to { --spin: 360deg; } }
.nav-actions { display: flex; gap: 10px; align-items: center; }
.nav-toggle { display: none; }
.mobile-menu { display: none; }

@media (max-width: 900px) {
  .nav-links, .nav-actions .hide-sm { display: none; }
  .nav-toggle { display: inline-grid; }
  .mobile-menu.open {
    display: grid; gap: 4px; position: fixed; top: 84px; left: 12px; right: 12px; z-index: 49; padding: 12px;
    border-radius: var(--radius-lg); border: 1px solid var(--border-strong); background: var(--bg-elev); box-shadow: var(--shadow-lg);
    animation: modalIn .25s var(--ease);
  }
  .mobile-menu a { padding: 12px 14px; border-radius: 10px; font-weight: 500; }
  .mobile-menu a:hover { background: var(--surface-2); }
  .mobile-menu .btn { margin-top: 6px; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 56px 0 36px; color: var(--text-2); font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 40px; }
.footer-grid li { overflow-wrap: anywhere; }
.footer-grid h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; font-family: var(--font); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.disclaimer { max-width: 720px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* ---------- Reveal animatsiyasi ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Tarif kartalari (landing + pricing) ---------- */
.billing-toggle { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); position: relative; }
.billing-toggle button { position: relative; z-index: 1; padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--text-2); transition: color .2s; display: inline-flex; gap: 8px; align-items: center; }
.billing-toggle button.active { color: var(--text); }
.billing-toggle .pill { position: absolute; z-index: 0; top: 4px; bottom: 4px; border-radius: 999px; background: var(--bg-elev); border: 1px solid var(--border-strong); box-shadow: var(--shadow); transition: left .35s var(--ease), width .35s var(--ease); }
.save-tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: rgba(52, 211, 153, .15); color: var(--green); font-weight: 700; }

.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
@media (max-width: 960px) { .plans-grid { grid-template-columns: 1fr; max-width: 460px; margin-inline: auto; } }
.plan {
  position: relative; display: flex; flex-direction: column; gap: 22px; padding: 30px; border-radius: var(--radius-xl);
  background: var(--surface); border: 1px solid var(--border); transition: transform .35s var(--ease), border-color .3s, box-shadow .3s;
}
.plan:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.plan.popular { background: linear-gradient(180deg, rgba(99,102,241,.14), rgba(34,211,238,.04) 60%), var(--bg-elev); border-color: rgba(124,127,245,.45); box-shadow: 0 30px 80px -30px rgba(99,102,241,.6); }
.plan.popular::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; background: var(--grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.plan-ribbon { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); padding: 5px 14px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 8px 20px -6px rgba(99,102,241,.8); white-space: nowrap; }
.plan-head h3 { font-size: 22px; display: flex; align-items: center; gap: 10px; }
.plan-head p { color: var(--muted); font-size: 14px; margin-top: 6px; }
.plan-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan-price .amount { font-family: var(--font-display); font-size: 42px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.plan-price .per { color: var(--muted); font-size: 14px; }
.plan-price .note { width: 100%; font-size: 13px; color: var(--muted); min-height: 20px; }
.plan ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; flex: 1; align-content: start; }
.plan li { display: flex; gap: 10px; font-size: 14.5px; color: var(--text-2); }
.plan li svg { width: 18px; height: 18px; flex: none; color: var(--cyan); margin-top: 2px; }
.plan .current-tag { text-align: center; font-size: 13px; color: var(--green); font-weight: 600; }

/* ---------- Foydalanish shartlarini tasdiqlash oynasi ---------- */
.terms-gate { display: grid; gap: 14px; }
.terms-gate ul { margin: 0; padding: 14px 16px 14px 34px; display: grid; gap: 8px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; color: var(--text-2); line-height: 1.55; }
.terms-gate b { color: var(--text); }
.terms-gate .check { font-size: 14px; }
.terms-gate .form-error { margin: 0; }
.check a, .terms-gate a { color: var(--primary); font-weight: 600; }
.check a:hover, .terms-gate a:hover { text-decoration: underline; }
.disclaimer a { color: var(--text-2); text-decoration: underline; text-decoration-color: var(--border-strong); }
.disclaimer a:hover { color: var(--text); }
