/* styles.css — Secure Prompt Relay. Dark, dense, monospace-forward. */

:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --border: #2a323d;
  --text: #e6e9ee;
  --muted: #98a2b3;
  --accent: #4f8cff;
  --accent-hover: #3a78f0;
  --danger: #ff6b6b;
  --ok: #33c481;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); }

/* ---------- buttons / inputs ---------- */
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 8px;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: default; }

.linkbtn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}
.linkbtn:hover { background: var(--panel-2); color: var(--text); }
.linkbtn.danger { color: var(--danger); }
.linkbtn.danger:hover { background: rgba(255, 107, 107, 0.12); }

input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
label { display: block; margin: 0.75rem 0; font-size: 0.9rem; color: var(--muted); }
label input, label select { margin-top: 0.3rem; }

.inline { display: inline; }
.mono { font-family: var(--mono); }
.breakable { word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.error {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: #ffb4b4;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
}

/* ---------- auth pages ---------- */
.auth-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem;
}
.card.wide { max-width: 460px; }
.card h1 { font-size: 1.25rem; margin: 0 0 1rem; }

.qr {
  display: flex;
  justify-content: center;
  background: #fff;
  padding: 0.75rem;
  border-radius: 10px;
  margin: 0.75rem 0;
}
.qr svg { max-width: 100%; height: auto; }

.secret { margin: 0.5rem 0 1rem; }
.secret summary { cursor: pointer; color: var(--muted); }
.secret code { display: block; margin-top: 0.5rem; padding: 0.5rem; background: var(--panel-2); border-radius: 8px; }

/* ---------- relay ---------- */
.relay-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.sender-pick { margin: 0; display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; }
.sender-pick select { width: auto; padding: 0.35rem 0.5rem; }

.thread {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.older-wrap {
  display: flex;
  justify-content: center;
  padding: 0.75rem 1rem 0;
}
.older-wrap .linkbtn {
  border: 1px solid var(--border);
  background: var(--panel);
}

.msg {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.msg-new { animation: flash 1.5s ease-out; }
@keyframes flash {
  from { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79, 140, 255, 0.35); }
  to   { border-color: var(--border); box-shadow: none; }
}
.msg-error { border-color: rgba(255, 107, 107, 0.5); }
.msg-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.msg-sender { font-weight: 600; color: var(--accent); }
.msg-time { color: var(--muted); }
.msg-actions { margin-left: auto; display: flex; gap: 0.25rem; }
.msg-body {
  margin: 0;
  padding: 0.85rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
}

.composer {
  position: sticky;
  bottom: 0;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1rem;
}
.composer textarea {
  width: 100%;
  min-height: 90px;
  max-height: 40vh;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
}

/* passphrase gate overlay */
.gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(8, 10, 13, 0.86);
  backdrop-filter: blur(3px);
}
.gate-card {
  width: 100%;
  max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.6rem;
}
.gate-card h2 { margin-top: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 1rem;
  border-radius: 10px;
  z-index: 20;
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .sender-pick { font-size: 0.8rem; }
}
