/*
  =============================================================
  filename:    assets/style.css
  description: SWO Chat design system — amber/cream, Poppins,
               soft curves. No cartoons, elegant line icons,
               sparkle accents on empty states.
  project:     swo-chat-v1
  version:     1.0.0
  created:     2026-04-17 15:45 SAST
  modified:    2026-04-17 15:45 SAST
  changes:     1.0.0 (2026-04-17) Initial design system
  =============================================================
*/

:root {
  --amber:          #C49A3A;
  --amber-soft:     #E2C172;
  --amber-wash:     #FBF4E1;
  --amber-ink:      #7A5A15;
  --cream:          #FDFBF5;
  --paper:          #FFFFFF;
  --ink:            #2B2418;
  --ink-soft:       #6B5C3F;
  --line:           #E6DBC3;
  --line-soft:      #F1E9D6;
  --danger:         #B04318;
  --success:        #4E7C2A;
  --radius-lg:      14px;
  --radius-md:      10px;
  --radius-sm:      8px;
  --shadow-card:    0 1px 2px rgba(43, 36, 24, .04), 0 4px 16px rgba(43, 36, 24, .03);
  --font:           'Poppins', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:           ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-weight: 400;
}
.hidden { display: none !important; }

/* ============ Token gate ============ */
.gate {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #faecc9 0%, var(--cream) 50%);
  padding: 24px;
}
.gate-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  width: 100%; max-width: 440px;
  box-shadow: var(--shadow-card);
  text-align: center;
}
.gate-card h1 { margin: 8px 0 6px; font-weight: 600; letter-spacing: -0.01em; }
.gate-card .sub { color: var(--ink-soft); font-size: 14px; margin: 0 0 20px; line-height: 1.55; }
.gate-card form { display: flex; gap: 8px; }
.gate-card input { flex: 1; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); font: inherit; background: var(--paper); }
.gate-card input:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: transparent; }
.err { color: var(--danger); font-size: 13px; margin-top: 10px; }
.spark { color: var(--amber); font-size: 22px; line-height: 1; }

/* ============ App layout ============ */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

/* ============ Sidebar ============ */
.sidebar {
  background: var(--paper);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.side-head {
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-weight: 600; letter-spacing: -0.01em; }
.btn-new {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--amber-wash); color: var(--amber-ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.btn-new:hover { background: var(--amber-soft); border-color: var(--amber-soft); color: #fff; }

.conv-list { flex: 1; overflow: auto; padding: 8px; }
.conv-item {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent;
  color: var(--ink); font: inherit; font-size: 14px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.conv-item:hover { background: var(--amber-wash); }
.conv-item.active { background: var(--amber-wash); border-color: var(--line); font-weight: 500; color: var(--amber-ink); }
.conv-day { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 12px 4px; }

.side-foot {
  padding: 12px 16px; border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--ink-soft);
}
.model-pill {
  font-family: var(--mono); font-size: 11px; background: var(--amber-wash);
  color: var(--amber-ink); padding: 3px 9px; border-radius: 999px;
}
.link-btn {
  background: none; border: none; padding: 0; color: var(--ink-soft);
  font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline;
}
.link-btn:hover { color: var(--ink); }

/* ============ Chat pane ============ */
.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  background: var(--cream);
}
.chat-head {
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper);
}
.chat-head h2 { font-size: 15px; font-weight: 500; margin: 0; letter-spacing: -0.005em; }
.chat-head-actions { display: flex; gap: 6px; }
.icon-btn {
  border: 1px solid transparent; background: transparent;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: grid; place-items: center; color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--amber-wash); color: var(--amber-ink); }

.stream {
  overflow: auto;
  padding: 28px 0 64px;
  scroll-behavior: smooth;
}
.msg {
  max-width: 780px; margin: 0 auto; padding: 8px 28px;
}
.msg-role {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-soft); margin-bottom: 6px;
}
.msg.user .msg-role { color: var(--amber-ink); }
.msg.user .msg-body {
  background: var(--amber-wash); border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--ink);
}
.msg.assistant .msg-body {
  padding: 6px 0 14px;
  line-height: 1.65;
}

/* Markdown styling inside assistant messages */
.msg-body h1, .msg-body h2, .msg-body h3 { margin: 1em 0 .4em; font-weight: 600; letter-spacing: -0.01em; }
.msg-body h1 { font-size: 1.35em; }
.msg-body h2 { font-size: 1.2em; }
.msg-body h3 { font-size: 1.05em; }
.msg-body p { margin: .55em 0; }
.msg-body ul, .msg-body ol { margin: .5em 0; padding-left: 1.4em; }
.msg-body li { margin: .25em 0; }
.msg-body a { color: var(--amber-ink); text-decoration: underline; }
.msg-body code {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--amber-wash); color: var(--amber-ink);
  padding: 1px 6px; border-radius: 4px;
}
.msg-body pre {
  background: #2B2418; color: #f0e7ce;
  padding: 14px 16px; border-radius: var(--radius-md);
  overflow-x: auto; font-size: 13px; line-height: 1.55;
  position: relative;
}
.msg-body pre code { background: none; color: inherit; padding: 0; }
.msg-body blockquote {
  border-left: 3px solid var(--amber); padding: 2px 12px;
  color: var(--ink-soft); margin: .6em 0;
}
.copy-btn {
  position: absolute; top: 8px; right: 8px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2);
  color: #f0e7ce; font: inherit; font-size: 11px;
  padding: 3px 8px; border-radius: 4px; cursor: pointer;
}
.copy-btn:hover { background: rgba(255,255,255,.16); }

/* Tool call blocks */
.tool {
  max-width: 780px; margin: 8px auto; padding: 0 28px;
}
.tool details {
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
  font-size: 13px;
}
.tool summary {
  padding: 8px 14px;
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 10px;
  color: var(--amber-ink); font-weight: 500;
}
.tool summary::-webkit-details-marker { display: none; }
.tool summary::before {
  content: '▸'; display: inline-block; transition: transform 120ms ease; color: var(--amber);
}
.tool details[open] summary::before { transform: rotate(90deg); }
.tool .tool-name { color: var(--ink); font-family: var(--mono); font-size: 12px; }
.tool .tool-status { margin-left: auto; font-size: 11px; color: var(--ink-soft); }
.tool .tool-status.ok   { color: var(--success); }
.tool .tool-status.err  { color: var(--danger); }
.tool .tool-body {
  border-top: 1px solid var(--line-soft);
  padding: 10px 14px;
  background: #FAF5E6;
}
.tool .tool-body pre {
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line);
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12px; margin: 6px 0 0;
  max-height: 420px; overflow: auto;
}
.tool .tool-label { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.06em; }

/* Empty state */
.empty {
  max-width: 680px; margin: 64px auto; padding: 24px; text-align: center;
}
.empty-spark { color: var(--amber); font-size: 32px; line-height: 1; margin-bottom: 8px; }
.empty h3 { font-size: 22px; font-weight: 600; margin: 4px 0 8px; letter-spacing: -0.01em; }
.empty p { color: var(--ink-soft); max-width: 480px; margin: 0 auto 24px; line-height: 1.6; }
.suggestions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 560px; margin: 0 auto; }
.sugg {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-md); padding: 12px 14px;
  text-align: left; font: inherit; font-size: 13px; cursor: pointer;
  color: var(--ink); line-height: 1.4;
}
.sugg:hover { border-color: var(--amber-soft); background: var(--amber-wash); color: var(--amber-ink); }
@media (max-width: 640px) { .suggestions { grid-template-columns: 1fr; } }

/* Composer */
.composer {
  border-top: 1px solid var(--line-soft);
  background: var(--paper);
  padding: 14px 28px 16px;
}
.composer form {
  max-width: 780px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  align-items: end;
}
#composer {
  width: 100%; min-height: 44px; max-height: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-md);
  font: inherit; font-size: 15px; line-height: 1.5; resize: none;
  background: var(--paper); color: var(--ink);
  box-shadow: var(--shadow-card);
}
#composer:focus { outline: 2px solid var(--amber); outline-offset: 1px; border-color: transparent; }
.btn-primary {
  background: var(--amber); color: #fff;
  border: none; border-radius: var(--radius-md);
  padding: 11px 16px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; min-width: 44px; justify-content: center;
}
.btn-primary:hover  { filter: brightness(0.95); }
.btn-primary:disabled { opacity: 0.55; cursor: progress; }
.composer-meta {
  max-width: 780px; margin: 6px auto 0;
  display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-soft);
}
.hint { opacity: 0.75; }

/* Typing dots */
.typing { display: inline-block; }
.typing span {
  display: inline-block; width: 4px; height: 4px; margin: 0 1px;
  background: var(--amber); border-radius: 50%;
  animation: blink 1.2s infinite ease-in-out both;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.30s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.9); }
  40%           { opacity: 1;    transform: scale(1.1); }
}

/* Responsive */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.open { display: flex; position: fixed; inset: 0; z-index: 50; width: 80%; max-width: 320px; box-shadow: 4px 0 24px rgba(0,0,0,.1); }
  .chat-head, .msg, .tool, .composer form { padding-left: 16px; padding-right: 16px; }
}

/* Scrollbars */
.conv-list::-webkit-scrollbar, .stream::-webkit-scrollbar, .msg-body pre::-webkit-scrollbar, .tool-body pre::-webkit-scrollbar { width: 8px; height: 8px; }
.conv-list::-webkit-scrollbar-thumb, .stream::-webkit-scrollbar-thumb, .msg-body pre::-webkit-scrollbar-thumb, .tool-body pre::-webkit-scrollbar-thumb {
  background: var(--amber-soft); border-radius: 8px;
}

/* =============================================================
   end of assets/style.css
   ============================================================= */
