/* ============================================================================
   SparkOne Labs — "Midnight" theme  (navy #001f3f + gold #d4af37)
   Lifted from SparkOne_MasterMind/sdk/sparkone-ui (tokens.json) +
   sparkone-dashboard component CSS. Plain CSS variables, no build step.
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Chakra+Petch:wght@400;500;600;700&family=Cinzel:wght@500;600&family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&display=swap');

:root, [data-theme="midnight"] {
  --bg:#001f3f; --bg-deep:#0a1628; --surface:#002a5c; --surface-2:#003366;
  --text:#f8f9fa; --muted:#90a8b8;
  --primary:#d4af37; --accent:#ffd700; --accent-dark:#ccac00;
  --success:#27ae60; --warn:#ffd700; --error:#dc3545; --border:#003366;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(circle at 50% -10%, var(--surface), var(--bg-deep));
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Chakra Petch', system-ui, sans-serif;
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }

/* ---- Brand / header --------------------------------------------------- */
header {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 18px 24px; border-bottom: 1px solid var(--border);
}
.brand {
  font-family: 'Cinzel', serif; font-weight: 600; letter-spacing: 2px;
  color: var(--primary); font-size: 20px; margin: 0;
}
header .sub { color: var(--muted); font-size: 13px; }

/* ---- Nav -------------------------------------------------------------- */
nav { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
nav button, nav a.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 12px 14px; cursor: pointer; font: inherit;
}
nav button.active, nav a.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
nav button:hover, nav a.tab:hover { color: var(--text); }

/* ---- Layout primitives ------------------------------------------------ */
.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 24px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }

/* ---- Card ------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.card h2 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.card h3 { margin: 0 0 8px; color: var(--text); }
.big { font-size: 30px; font-weight: 700; color: var(--accent); }
.sub { color: var(--muted); font-size: 13px; }

/* ---- Buttons ---------------------------------------------------------- */
button.go, .btn {
  background: var(--primary); color: var(--bg); border: 0; padding: 10px 18px;
  border-radius: 6px; font-weight: 700; cursor: pointer; font: inherit; font-weight: 700;
  transition: transform .12s, box-shadow .12s, background .12s;
}
button.go:hover, .btn:hover { background: var(--accent); box-shadow: 0 4px 16px rgba(212,175,55,.3); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn.ghost:hover { background: rgba(212,175,55,.1); box-shadow: none; }

/* ---- Inputs ----------------------------------------------------------- */
input, textarea, select {
  width: 100%; background: var(--bg-deep); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 11px 12px;
  font: inherit; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin: 14px 0 6px; }

/* ---- Pills / chips ---------------------------------------------------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--accent); border: 1px solid var(--border); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; background: var(--bg-deep); color: var(--muted); }

/* ---- Hero ------------------------------------------------------------- */
.hero { text-align: center; padding: 72px 24px 48px; }
.hero h1 {
  font-family: 'Cinzel', serif; font-weight: 600; font-size: clamp(30px, 5vw, 52px);
  color: var(--primary); margin: 0 0 14px; line-height: 1.15;
}
.hero p.lede { color: var(--text); font-size: clamp(16px, 2vw, 20px); max-width: 720px; margin: 0 auto 10px; }
.hero p.sub { color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- Auth card -------------------------------------------------------- */
.auth-overlay { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 34px; width: 360px; max-width: 100%;
  box-shadow: 0 18px 60px rgba(0,0,0,.5);
}
.auth-card .brand { display: block; text-align: center; font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { text-align: center; margin-bottom: 18px; }
.auth-card button.go { width: 100%; margin-top: 20px; }
.msg { margin-top: 14px; font-size: 13px; min-height: 18px; }
.msg.err { color: var(--error); }
.msg.ok { color: var(--success); }

/* ---- Footer ----------------------------------------------------------- */
footer { border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; padding: 28px 24px; text-align: center; }
.disclaimer { max-width: 760px; margin: 0 auto; font-size: 12px; opacity: .85; }

/* ---- Chat widget (floating FAB + panel) ------------------------------- */
.pill-fab {
  position: fixed; bottom: 22px; right: 22px; z-index: 120;
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--primary);
  background: var(--surface); color: var(--accent); font-size: 24px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.45); transition: transform .15s, box-shadow .15s;
}
.pill-fab:hover { transform: scale(1.06); box-shadow: 0 6px 22px rgba(212,175,55,.35); }
.chat-panel {
  position: fixed; bottom: 90px; right: 22px; z-index: 121;
  width: 380px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 130px);
  display: none; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55); overflow: hidden;
}
.chat-panel.open { display: flex; }
.chat-header { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.chat-header .title { font-family: 'Cinzel', serif; color: var(--primary); font-size: 14px; letter-spacing: 1px; }
.chat-header button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { padding: 9px 12px; border-radius: 10px; font-size: 14px; max-width: 85%; white-space: pre-wrap; word-wrap: break-word; }
.chat-msg.user { align-self: flex-end; background: var(--bg-deep); color: var(--primary); border: 1px solid var(--primary); }
.chat-msg.bot { align-self: flex-start; background: var(--bg-deep); border: 1px solid var(--border); color: var(--text); }
.chat-msg.sys { align-self: center; color: var(--muted); font-size: 12px; background: none; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; }
.chat-input button { width: auto; padding: 10px 14px; }

@media (max-width: 480px) {
  .chat-panel { right: 8px; left: 8px; width: auto; }
}
