/* ===== Reliable Chat – index.css (updated) ===== */

/* Design tokens */
:root{
  --bg:#f5f8fa;
  --card:#ffffff;
  --ink:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --accent:#0ea5e9;
  --accent-weak:#bae6fd;
  --me-bubble:#e0f2fe;
  --ok:#16a34a;
}

/* Reset-ish */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* Layout */
.wrap { max-width: 900px; margin: 32px auto; padding: 0 16px; }
header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 16px;
}
header h1 { margin: 0; font-size: 28px; letter-spacing: .3px; }
header .right { display:flex; align-items:center; gap:12px; }

/* Status dot */
.dot { width: 10px; height: 10px; border-radius: 50%; background: #bbb; }
.dot.ok { background: var(--ok); }

/* Dev link / Switch user button */
.link {
  background: none; border: 0; padding: 6px 8px; cursor: pointer;
  color: var(--accent); font-size: 14px;
}
.link:hover { text-decoration: underline; }
.link:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 10px;
}

/* Cards */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.06);
}
.hidden { display: none; }

/* Login */
#loginBox { text-align: center; }
#loginBox .row { display: inline-flex; gap: 8px; margin-top: 8px; }
#loginBox input {
  padding: 10px 12px; width: 260px;
  border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
#loginBox button {
  padding: 10px 16px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 12px; cursor: pointer; transition: filter .15s ease;
}
#loginBox button:hover { filter: brightness(0.95); }
.hint { color: var(--muted); font-size: 13px; }

/* Chat */
#chatBox { display: flex; flex-direction: column; gap: 12px; }
.messages {
  height: 60vh; min-height: 320px;
  background: #f8fafc;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px; overflow: auto;
  scroll-behavior: smooth;
}

/* Message bubbles */
.msg { display: flex; margin: 6px 0; gap: 8px; }
.msg .bubble {
  max-width: 70%;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff; border: 1px solid var(--border);
  word-wrap: break-word; white-space: pre-wrap;
}
.msg.me { justify-content: flex-end; }
.msg.me .bubble { background: var(--me-bubble); border-color: var(--accent-weak); }

.meta { font-size: 11px; color: var(--muted); margin-top: 4px; display: flex; gap: 10px; }
.checks { font-size: 12px; }

/* Composer */
.composer { display: flex; gap: 10px; }
.composer input {
  flex: 1; padding: 12px;
  border-radius: 12px; border: 1px solid var(--border);
  background: #fff;
}
.composer button {
  padding: 12px 18px; border-radius: 12px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  cursor: pointer; transition: filter .15s ease, transform .02s ease;
}
.composer button:hover { filter: brightness(0.95); }
.composer button:active { transform: translateY(1px); }

/* Legend */
.legend { color: var(--muted); font-size: 12px; display: flex; gap: 16px; }

/* Responsive */
@media (max-width: 640px){
  #loginBox input { width: 200px; }
  .msg .bubble { max-width: 85%; }
}

/* Optional: light dark-mode tweak */
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0b1220; --card:#0f172a; --ink:#e5e7eb; --muted:#9aa4b2;
    --border:#1f2a44; --accent:#38bdf8; --accent-weak:#164e63; --me-bubble:#0b2e46;
  }
  .messages{ background:#0b1424; }
}

