/* AI BuildTraffic — single stylesheet, no build step, no dependencies. */

:root {
  --bg: #05050a;
  --bg-800: #0d0d18;
  --bg-700: #141423;
  --line: rgba(255, 255, 255, 0.10);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --brand: #8b5cf6;
  --brand-600: #7c3aed;
  --accent: #06b6d4;
  --danger: #f87171;
  --ok: #34d399;
  --radius: 16px;
  --gradient: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -0.02em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); font-weight: 700; }
h3 { font-size: 1.125rem; font-weight: 600; }
p { margin: 0 0 1rem; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .82rem; margin: -.25rem 0 .5rem; }
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.center { text-align: center; }
.full { width: 100%; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.05rem; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--gradient);
  display: grid; place-items: center;
  font-size: .85rem; color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .75rem 1.25rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .95rem;
  cursor: pointer;
  transition: filter .15s ease, background .15s ease, transform .05s ease;
  text-align: center;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 0 30px rgba(124, 58, 237, .3); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: rgba(255,255,255,.05); border-color: var(--line); color: var(--text); }
.btn-secondary:hover { background: rgba(255,255,255,.1); }
.btn-sm { padding: .5rem .85rem; font-size: .85rem; border-radius: 10px; }
.btn-danger { background: rgba(248,113,113,.12); color: var(--danger); border-color: rgba(248,113,113,.3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- Cards & forms ---------- */
.card {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}
.stack { display: grid; gap: .9rem; }
.stack label { display: grid; gap: .35rem; font-size: .875rem; color: var(--muted); }

.input, select.input, textarea.input {
  width: 100%;
  padding: .7rem .85rem;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit; font-size: .95rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { border-color: rgba(167,139,250,.6); box-shadow: 0 0 0 3px rgba(124,58,237,.22); }
textarea.input { min-height: 130px; resize: vertical; }
select.input option { background: var(--bg-800); }

.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1rem 0 .25rem; font-weight: 600; }

.alert { padding: .8rem 1rem; border-radius: 12px; font-size: .9rem; margin-bottom: .9rem; border: 1px solid; }
.alert-error { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); color: #fca5a5; }
.alert-ok { background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.3); color: #6ee7b7; }
.alert-info { background: rgba(255,255,255,.05); border-color: var(--line); color: var(--muted); }

.badge {
  display: inline-block; padding: .25rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 600; background: rgba(255,255,255,.08); color: var(--muted);
}
.badge-brand { background: var(--gradient); color: #fff; }
.badge-ok { background: rgba(52,211,153,.18); color: #6ee7b7; }
.badge-warn { background: rgba(251,191,36,.18); color: #fcd34d; }
.badge-danger { background: rgba(248,113,113,.18); color: #fca5a5; }

/* ---------- Public header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(5,5,10,.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.site-header .inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.nav-links { display: none; gap: 1.75rem; font-size: .9rem; color: var(--muted); }
.nav-links a:hover { color: #fff; }
.nav-actions { display: none; gap: .6rem; align-items: center; }
.nav-toggle { display: block; background: none; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; line-height: 1; }

@media (min-width: 860px) {
  .nav-links, .nav-actions { display: flex; }
  .nav-toggle { display: none; }
}

.mobile-menu { display: none; border-top: 1px solid rgba(255,255,255,.06); padding: .75rem 0 1.25rem; }
.mobile-menu.open { display: block; }
.mobile-menu a { display: block; padding: .7rem .25rem; color: var(--muted); }
.mobile-menu .btn { margin-top: .5rem; }
@media (min-width: 860px) { .mobile-menu, .mobile-menu.open { display: none; } }

/* ---------- Landing ---------- */
.hero { padding: 4rem 0 4.5rem; text-align: center; position: relative; }
.hero::before {
  content: ""; position: absolute; inset: -20% 0 auto 0; height: 520px; z-index: -1;
  background: radial-gradient(ellipse at top, rgba(124,58,237,.25), transparent 62%);
}
.pill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .9rem; margin-bottom: 1.25rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.04); font-size: .78rem; color: var(--muted);
}
.hero p.lead { max-width: 680px; margin: 1.25rem auto 2rem; font-size: 1.05rem; color: var(--muted); }
.hero-actions { display: grid; gap: .75rem; max-width: 340px; margin: 0 auto; }
@media (min-width: 560px) { .hero-actions { display: flex; justify-content: center; max-width: none; } }

.section { padding: 3.5rem 0; }
.section-head { max-width: 640px; margin: 0 auto 2.5rem; text-align: center; }

.grid { display: grid; gap: 1rem; }
/* Grid/flex children default to min-width:auto, so wide content (tables,
   long strings) forces the track wider than the viewport instead of
   scrolling inside its own container. This is the fix. */
.grid > *, .split > * { min-width: 0; }
.grid-3 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1000px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.feature-icon {
  width: 42px; height: 42px; border-radius: 12px; background: var(--gradient);
  display: grid; place-items: center; margin-bottom: .9rem; font-size: 1.1rem;
}
.step-num { font-size: 2.75rem; font-weight: 800; color: rgba(255,255,255,.12); line-height: 1; }

.check-list { list-style: none; padding: 0; margin: 1.25rem 0 0; display: grid; gap: .6rem; }
.check-list li { display: flex; gap: .55rem; font-size: .9rem; color: #cbd5e1; }
.check-list li::before { content: "✓"; color: var(--accent); font-weight: 700; }

.site-footer { border-top: 1px solid rgba(255,255,255,.06); padding: 2.5rem 0; margin-top: 2rem; font-size: .875rem; color: var(--muted); }
.footer-grid { display: grid; gap: 2rem; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer h4 { color: #fff; font-size: .85rem; margin-bottom: .6rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }

/* ---------- Pricing ---------- */
.price { font-size: 2.25rem; font-weight: 800; }
.tier-featured { border-color: rgba(167,139,250,.5); box-shadow: 0 0 40px rgba(124,58,237,.22); position: relative; }
.tier-tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--gradient); padding: .25rem .75rem; border-radius: 999px; font-size: .7rem; font-weight: 700;
}

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background: radial-gradient(ellipse at top, rgba(124,58,237,.2), transparent 60%); }
.auth-card { width: 100%; max-width: 420px; }

.install-body { background: var(--bg); }
.install-wrap { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem;
  background: radial-gradient(ellipse at top, rgba(124,58,237,.2), transparent 60%); }
.install-card { width: 100%; max-width: 520px; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  display: none; width: 250px; flex-shrink: 0;
  background: rgba(13,13,24,.7); border-right: 1px solid rgba(255,255,255,.06);
  padding: 1rem; flex-direction: column;
}
@media (min-width: 1024px) { .sidebar { display: flex; } }

.side-nav { display: grid; gap: .2rem; margin-top: 1.5rem; }
.side-nav a {
  display: flex; align-items: center; gap: .65rem;
  padding: .65rem .75rem; border-radius: 12px;
  font-size: .9rem; font-weight: 500; color: #cbd5e1;
}
.side-nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side-nav a.active { background: var(--gradient); color: #fff; }
.side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.06); padding-top: .9rem; font-size: .8rem; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-bar {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; padding: 0 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06); background: rgba(13,13,24,.7);
}
@media (min-width: 1024px) { .app-bar { display: none; } }
.app-content { padding: 1.25rem; flex: 1; }
@media (min-width: 768px) { .app-content { padding: 2rem; } }

.drawer { position: fixed; inset: 0; z-index: 60; display: none; }
.drawer.open { display: flex; }
.drawer-panel { width: 270px; background: var(--bg-800); padding: 1rem; display: flex; flex-direction: column; }
.drawer-backdrop { flex: 1; background: rgba(0,0,0,.6); }

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

.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-card .stat-label { font-size: .78rem; color: var(--muted); }

/* Two-column work layout: form beside results */
.split { display: grid; gap: 1.25rem; }
@media (min-width: 1100px) { .split { grid-template-columns: 370px 1fr; align-items: start; } }

.variation { display: grid; gap: .75rem; }
.variation-body { white-space: pre-line; font-size: .93rem; line-height: 1.7; }

.list { display: grid; gap: .75rem; }
.row-item { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.row-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .75rem; color: var(--muted); }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); font-size: .9rem;
  border: 1px dashed var(--line); border-radius: var(--radius); }

/* Tables scroll horizontally on small screens instead of breaking layout */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; min-width: 640px; }
th, td { text-align: left; padding: .7rem .6rem; border-bottom: 1px solid rgba(255,255,255,.07); white-space: nowrap; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
td.wrap { white-space: normal; min-width: 220px; }

.platform-chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  padding: .45rem .75rem; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255,255,255,.04); font-size: .8rem; cursor: pointer; color: #cbd5e1;
}
.chip.selected { background: var(--gradient); border-color: transparent; color: #fff; font-weight: 600; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%; display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
