/* ─────────────────────────────────────────────────────────────────────
   CiteRank — Theme tokens
   Light + Dark mode via [data-theme] on <html>.
   Default: dark. Auto-detects system preference on first load.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Brand: indigo-violet (Linear/Stripe inspired, restrained, professional) */
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;   /* indigo-500 */
  --brand-600: #4f46e5;   /* indigo-600 */
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-glow: rgba(99, 102, 241, .32);
  --accent-500: #a78bfa;  /* soft violet highlight only */
  --accent-600: #8b5cf6;
  --accent-glow: rgba(167, 139, 250, .22);
  --warn-500:  #f59e0b;
  --danger-500:#ef4444;
  --danger-600:#dc2626;
  --success-500:#10b981;

  /* Radius / shadow */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Dark (default) — near-black with indigo-violet accent */
[data-theme='dark'] {
  --bg:        #07080f;
  --bg-elev:   #0c0d18;
  --surface:   #10121f;
  --surface-2: #161827;
  --card:      #12141f;
  --border:    #20253a;
  --border-strong: #2e3450;
  --text:      #ecedf7;
  --text-muted:#969aae;
  --text-dim:  #5e6378;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.6);
  --shadow:    0 4px 20px rgba(20,30,60,.5);
  --shadow-lg: 0 20px 60px rgba(20,30,60,.5);
  --grad-hero:
    radial-gradient(70% 50% at 25% 10%, rgba(99, 102, 241, .22), transparent 65%),
    radial-gradient(60% 45% at 80% 35%, rgba(167, 139, 250, .12), transparent 65%);
  --grad-card: linear-gradient(180deg, rgba(99,102,241,.03), rgba(99,102,241,0));
  --grad-mesh:
    radial-gradient(circle at 15% 25%, rgba(99,102,241,.08), transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(167,139,250,.05), transparent 45%);
}

/* Light — clean off-white with indigo accents */
[data-theme='light'] {
  --bg:        #fbfbfd;
  --bg-elev:   #ffffff;
  --surface:   #ffffff;
  --surface-2: #f4f5fa;
  --card:      #ffffff;
  --border:    #e8e9f1;
  --border-strong: #cdcfde;
  --text:      #14152a;
  --text-muted:#5a5d75;
  --text-dim:  #8c90a8;
  --shadow-sm: 0 1px 2px rgba(20,30,60,.05), 0 1px 3px rgba(20,30,60,.05);
  --shadow:    0 4px 16px rgba(20,30,60,.06);
  --shadow-lg: 0 16px 48px rgba(20,30,60,.09);
  --grad-hero:
    radial-gradient(70% 50% at 25% 10%, rgba(99, 102, 241, .1), transparent 65%),
    radial-gradient(60% 45% at 80% 35%, rgba(167, 139, 250, .06), transparent 65%);
  --grad-card: linear-gradient(180deg, rgba(99,102,241,.018), rgba(99,102,241,0));
  --grad-mesh:
    radial-gradient(circle at 15% 25%, rgba(99,102,241,.04), transparent 45%),
    radial-gradient(circle at 85% 75%, rgba(167,139,250,.03), transparent 45%);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
img, svg { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: 0; background: 0; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--brand-glow); }

/* Container */
.container { width: min(1180px, 92%); margin: 0 auto; }
.container-sm { width: min(880px, 92%); margin: 0 auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius); font-weight: 600; font-size: 14px;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-500) 0%, var(--accent-500) 100%);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 24px var(--brand-glow);
  position: relative;
  overflow: hidden;
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--brand-600), var(--accent-600));
  opacity: 0; transition: opacity .25s;
}
.btn-primary:hover::before { opacity: 1; }
.btn-primary > * { position: relative; z-index: 1; }
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 10px 32px var(--brand-glow); transform: translateY(-1px); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-500); color: #fff; }
.btn-danger:hover { background: var(--danger-600); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Form fields */
.field { display: block; }
.field-label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px;
}
.field-hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; }
.input, .textarea, .select {
  width: 100%; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 12px; font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: 0; border-color: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.textarea { min-height: 200px; resize: vertical; line-height: 1.6; }
.select { appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca0b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}

/* Choice chips (radio group, content-type / tone selectors) */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active {
  background: var(--brand-500); color: #fff; border-color: var(--brand-500);
  box-shadow: 0 4px 12px var(--brand-glow);
}

/* Multi-select toggles (LLM targets) */
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.toggle-card {
  position: relative; padding: 14px 14px 14px 42px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; transition: all .15s ease;
  font-size: 13px; font-weight: 500;
}
.toggle-card:hover { border-color: var(--brand-500); background: var(--surface-2); }
.toggle-card.active { border-color: var(--brand-500); background: linear-gradient(135deg, var(--brand-glow), transparent); }
.toggle-card::before {
  content: ''; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; border-radius: 4px;
  border: 1.5px solid var(--border-strong); background: var(--surface-2);
  transition: all .15s ease;
}
.toggle-card.active::before {
  background: var(--brand-500); border-color: var(--brand-500);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
  background-size: 12px; background-position: center; background-repeat: no-repeat;
}
.toggle-card .tc-label { color: var(--text); display: block; }
.toggle-card .tc-meta { color: var(--text-dim); font-size: 11px; margin-top: 2px; }

/* Card */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px;
  background-image: var(--grad-card);
}

/* Navbar */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-row { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.3px; color: var(--text); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 4px 16px var(--brand-glow), 0 1px 0 rgba(255,255,255,.2) inset;
  position: relative;
}
.brand-mark::after {
  content: ''; position: absolute; inset: -2px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  filter: blur(8px); opacity: .35; z-index: -1;
}
.nav-links { display: flex; gap: 28px; align-items: center; list-style: none; }
.nav-links a { font-size: 14px; color: var(--text-muted); font-weight: 500; transition: color .15s; }
.nav-links a:hover { color: var(--text); }
.nav-right { display: flex; gap: 10px; align-items: center; }

/* Theme toggle */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; transition: all .15s ease;
}
.theme-toggle:hover { background: var(--surface); border-color: var(--border-strong); }
.theme-toggle svg { width: 16px; height: 16px; color: var(--text-muted); }
.theme-toggle:hover svg { color: var(--text); }

/* Nav user button (replaces awkward gradient avatar) */
.nav-user {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 14px 0 10px;
  border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text);
  transition: all .15s ease;
  text-decoration: none;
}
.nav-user:hover { background: var(--surface); border-color: var(--border-strong); }
.nav-user .nav-user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--brand-500);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
.nav-user .nav-user-name {
  max-width: 100px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
[data-theme='dark']  .theme-toggle .icon-sun { display: block; }
[data-theme='dark']  .theme-toggle .icon-moon { display: none; }
[data-theme='light'] .theme-toggle .icon-sun { display: none; }
[data-theme='light'] .theme-toggle .icon-moon { display: block; }

/* Hamburger (mobile) */
.nav-burger { display: none; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.nav-burger svg { width: 18px; height: 18px; color: var(--text); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: none; place-items: center; z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: grid; }
.modal {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
  width: min(440px, 92%); box-shadow: var(--shadow-lg);
  animation: modal-in .25s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.modal h2 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 6px; }
.modal-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 20px; }
.modal .field + .field { margin-top: 14px; }
.modal-actions { margin-top: 20px; display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.modal-foot { margin-top: 16px; text-align: center; font-size: 13px; color: var(--text-muted); }
.modal-foot a { color: var(--brand-500); font-weight: 500; cursor: pointer; }

/* Verification banner (shown when email not verified yet) */
.verify-banner {
  display: none;
  padding: 12px 18px;
  background: linear-gradient(90deg, rgba(245,158,11,.15), rgba(245,158,11,.05));
  border-bottom: 1px solid rgba(245,158,11,.4);
  color: var(--text);
  font-size: 13px;
}
.verify-banner.show { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.verify-banner .vb-icon { color: var(--warn-500); display: inline-flex; }
.verify-banner b { font-weight: 700; }
.verify-banner a, .verify-banner button {
  color: var(--brand-500); font-weight: 600; cursor: pointer;
  background: none; border: 0; padding: 0; text-decoration: underline;
}

/* Toast / banner */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: 12px 18px; border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 1100; font-size: 14px; max-width: 480px;
  display: none; animation: toast-in .25s ease;
}
.toast.open { display: block; }
.toast.success { border-color: var(--success-500); }
.toast.error   { border-color: var(--danger-500); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Helpers */
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.hidden { display: none !important; }
.flex { display: flex; }
.center { display: grid; place-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.text-center { text-align: center; }

/* Footer */
.footer {
  border-top: 1px solid var(--border); padding: 40px 0; margin-top: 80px;
  color: var(--text-muted); font-size: 13px;
}
.footer-row { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--text); }

/* Responsive */
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-burger { display: grid; place-items: center; }
  .nav-row { height: 56px; }
}
