/* ============================================================
   Botledge — design system
   ============================================================ */

:root {
  --bg: #0a0e17;
  --bg-soft: #0f1522;
  --panel: #131b2b;
  --panel-2: #172033;
  --line: #22304a;
  --line-soft: #1a2438;
  --text: #e8eefb;
  --muted: #8ea0bd;
  --faint: #61708c;
  --brand: #2aabee;
  --brand-2: #229ed9;
  --accent: #f6821f;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.75);
  --maxw: 1180px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(42, 171, 238, 0.13), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(246, 130, 31, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1rem; color: var(--muted); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: .9rem; }
.mono { font-family: var(--mono); }

/* ---------------- nav ---------------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(10, 14, 23, 0.78);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #04121d; font-weight: 900;
  box-shadow: 0 6px 18px -6px rgba(42, 171, 238, .8);
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--muted); font-weight: 500; font-size: .95rem; }
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 10px 18px; border-radius: var(--radius-sm); font: inherit; font-weight: 600;
  font-size: .95rem; cursor: pointer; transition: .15s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #04121d;
}
.btn-primary:hover { box-shadow: 0 12px 30px -12px rgba(42, 171, 238, .9); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--bad); border-color: rgba(248, 113, 113, .35); }
.btn-danger:hover { border-color: var(--bad); }
.btn-sm { padding: 7px 13px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

/* ---------------- hero ---------------- */
.hero { padding: 84px 0 40px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 6px 14px; font-size: .82rem; color: var(--muted); margin-bottom: 22px;
}
.hero .eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(52, 211, 153, .18); }
.hero p.lead { font-size: 1.15rem; max-width: 620px; margin: 0 auto 30px; }
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.grad { background: linear-gradient(120deg, var(--brand), #7dd3fc 60%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------- sections / cards ---------------- */
section { padding: 52px 0; }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card h3 { margin-top: 6px; }
.card .icon {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center;
  background: rgba(42, 171, 238, .12); color: var(--brand); font-size: 1.2rem; margin-bottom: 12px;
}

.steps { counter-reset: step; }
.step { position: relative; padding-left: 54px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; color: #04121d;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

/* ---------------- forms ---------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.field .hint { font-size: .8rem; color: var(--faint); margin-top: 6px; }
input, textarea, select {
  width: 100%; background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 13px; font: inherit; font-size: .95rem; transition: .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(42, 171, 238, .18); }
textarea { resize: vertical; min-height: 90px; font-family: var(--mono); font-size: .88rem; }

/* ---------------- auth ---------------- */
.auth-wrap { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px 22px; }
.auth-card { width: 100%; max-width: 420px; }
.tabs { display: flex; gap: 6px; background: var(--bg-soft); border: 1px solid var(--line-soft); border-radius: 999px; padding: 4px; margin-bottom: 22px; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 9px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; }
.tabs button.active { background: var(--panel-2); color: var(--text); box-shadow: var(--shadow); }

/* ---------------- app shell ---------------- */
.app { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 64px); }
.side { border-right: 1px solid var(--line-soft); padding: 20px; background: var(--bg-soft); }
.side .side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bot-list { display: flex; flex-direction: column; gap: 8px; }
.bot-item {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; transition: .12s;
}
.bot-item:hover { background: var(--panel); }
.bot-item.active { background: var(--panel); border-color: var(--line); }
.bot-item .bname { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bot-item .bmeta { font-size: .76rem; color: var(--faint); }

.main { padding: 24px 26px 60px; min-width: 0; }
.main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }

/* status pill */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; border: 1px solid var(--line); }
.pill .d { width: 8px; height: 8px; border-radius: 50%; }
.pill.live { color: var(--good); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); }
.pill.live .d { background: var(--good); box-shadow: 0 0 0 4px rgba(52, 211, 153, .16); }
.pill.stopped { color: var(--muted); }
.pill.stopped .d { background: var(--faint); }
.pill.error { color: var(--bad); border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .08); }
.pill.error .d { background: var(--bad); }

/* editor */
.editor-shell { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #0d1220; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--panel-2); border-bottom: 1px solid var(--line-soft); font-size: .82rem; color: var(--faint); }
.CodeMirror { height: 420px !important; font-family: var(--mono) !important; font-size: 13.5px !important; background: #0d1220 !important; }
#codeFallback { min-height: 420px; border: 0; border-radius: 0; background: #0d1220; }

/* logs */
.logs { max-height: 280px; overflow: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: #0d1220; }
.log-row { display: flex; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); font-family: var(--mono); font-size: .8rem; }
.log-row:last-child { border-bottom: 0; }
.log-row .lt { color: var(--faint); white-space: nowrap; }
.log-row.error .lm { color: var(--bad); }
.log-row.warn .lm { color: var(--warn); }
.log-row.info .lm { color: var(--muted); }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 20px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; font-weight: 600; font-size: .9rem; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: rgba(248, 113, 113, .5); }
.toast.success { border-color: rgba(52, 211, 153, .5); }

/* docs */
.docs { display: grid; grid-template-columns: 220px 1fr; gap: 34px; padding: 40px 0 80px; }
.docs-nav { position: sticky; top: 84px; align-self: start; font-size: .9rem; }
.docs-nav a { display: block; padding: 6px 0; color: var(--muted); }
.docs-nav a:hover { color: var(--text); text-decoration: none; }
.docs h2 { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.docs h2:first-child { border-top: 0; margin-top: 0; }
.docs pre {
  background: #0d1220; border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 16px; overflow: auto; font-family: var(--mono); font-size: .84rem; color: #cfe3ff; line-height: 1.6;
}
.docs code { font-family: var(--mono); font-size: .88em; background: var(--panel-2); padding: 2px 6px; border-radius: 6px; }
.docs pre code { background: none; padding: 0; }
table.api { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.api th, table.api td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
table.api th { color: var(--faint); font-weight: 600; }
table.api td code { background: none; color: var(--brand); }
.note { border-left: 3px solid var(--brand); background: rgba(42, 171, 238, .06); padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

footer.site { border-top: 1px solid var(--line-soft); padding: 34px 0; color: var(--faint); font-size: .88rem; }
footer.site .row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }

.empty { text-align: center; padding: 50px 20px; color: var(--faint); }
.hidden { display: none !important; }
.row-gap { display: flex; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

@media (max-width: 900px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .docs { grid-template-columns: 1fr; }
  .docs-nav { position: static; display: flex; flex-wrap: wrap; gap: 14px; }
  .nav-links a.opt { display: none; }
}
