/* bewoke — minimal dashboard styles. Designed for readability, not polish. */

/* Alpine.js x-cloak: hide elements with x-cloak until Alpine initializes.
   Without this, a failed Alpine init (e.g., blocked CDN, JS error) leaves
   x-cloak'd elements visible-but-broken. Putting it in the main stylesheet
   ensures it's always present, independent of JS load order. */
[x-cloak] { display: none !important; }

:root {
  --bg: #0a0a0b;
  --bg-soft: #131316;
  --bg-warn: #2a2310;
  --bg-danger: #2a1010;
  --fg: #f5f5f5;
  --fg-muted: #a1a1a6;
  --fg-faint: #6a6a6f;
  --border: #1d1d20;
  --accent: #c6ff3a;
  --accent-hover: #d6ff5a;
  --danger: #ff6b6b;
  --code-bg: #131316;
  --radius: 6px;
  --max-width: 720px;
  --border-soft: #1d1d20;       /* inner dividers — matches border on dark */
  --bg-selected: #1a1d22;       /* conversation-list selected row */
  --bg-unread: #1a1f12;         /* conversation-list unread row (faint lime) */
  --accent-soft: #1a2310;       /* CTA background tint (very dark lime) */

  /* Sender-surface theming hooks. Consumed by chat.css; overridden by per-link
     custom CSS via `:root { --pill-bg: ...; }`. Defaults now match the
     bold-dark theme (see 2026-08-03 dark-theme cutover). Variable NAMES are
     unchanged so existing per-link custom CSS continues to override.
     Adding a new hook here means creators can theme it without learning a new
     class selector — see internal/api/presets.go for the canonical examples. */
  --pill-bg: #1a2310;
  --pill-fg: var(--accent);
  --shell-bg: #0a0a0b;            /* .chat-shell surface */
  --chat-bg: #0f0f12;             /* .chat-messages scroll area */
  --bubble-them-bg: #131316;      /* incoming bubble (creator → sender) */
  --bubble-them-border: #1d1d20;
  --bubble-them-fg: var(--fg);
  --bubble-me-bg: var(--accent);  /* outgoing bubble (sender's own) */
  --bubble-me-fg: #0a0a0b;        /* dark text on lime bubble */

  /* Nickname color palette for multi-user chat. Consumed by nicknames.js.
     Lightened slightly so they pop on dark surfaces. */
  --nick-1: #f0b066;
  --nick-2: #6db8ee;
  --nick-3: #b07cf0;
  --nick-4: #6df0a0;
  --nick-5: #f06b96;
  --nick-6: #9cf06b;
  --nick-7: #6bf0e4;
  --nick-8: #f0e06b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
               Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-header nav {
  display: flex;
  gap: 18px;
  align-items: center;
}
.site-header nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
}
.site-header nav a:hover { color: var(--fg); }
.site-header nav a.active { color: var(--fg); font-weight: 600; }
.site-header nav a.has-unread::after {
  content: ''; display: inline-block;
  width: 6px; height: 6px; border-radius: 50%;
  background: #dc2626; margin-left: 4px;
}
/* Display-name greeting (Phase 4). Subtle: small text, muted color, no
   interaction. Hidden for anon creators (template gates on .Creator.DisplayName
   being non-empty). Sits in the nav with the same gap as the links. */
.site-header nav .nav-greeting {
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 400;
}

main {
  padding: 32px 20px 80px;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  color: var(--fg-muted);
  font-size: 13px;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }
h1 { font-size: 28px; margin: 0 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 4px; }

p.lede {
  font-size: 17px;
  color: var(--fg-muted);
  max-width: 60ch;
  margin: 0 0 24px;
}

.muted { color: var(--fg-muted); }
.small { font-size: 13px; }

.hero {
  padding: 48px 0 24px;
}
.cta-form {
  margin-top: 24px;
}

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.feature h3 { margin-bottom: 4px; }
.feature p { margin: 0; color: var(--fg-muted); font-size: 14px; }

.page-section {
  margin-bottom: 48px;
}
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* Forms and buttons */
.primary-button,
.secondary-button,
.danger-button,
.link-button {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 80ms ease, border-color 80ms ease;
}
.primary-button {
  background: var(--accent);
  color: #0a0a0b;
}
.primary-button:hover { background: var(--accent-hover); }
.secondary-button {
  background: var(--bg-soft);
  color: var(--fg);
  border-color: var(--border);
}
.secondary-button:hover { background: var(--code-bg); }
.danger-button {
  background: var(--bg-danger);
  color: var(--danger);
  border-color: var(--danger);
}
.danger-button:hover { background: #3a1515; }
.link-button {
  background: none;
  color: var(--fg-muted);
  padding: 0;
  font-weight: 400;
}
.link-button:hover { color: var(--fg); }

.secondary-button.small,
.danger-button.small {
  padding: 4px 10px;
  font-size: 12px;
}

.copied {
  background: #1f3a26 !important;
  border-color: #4d8a5e !important;
  color: #b6f0c4 !important;
}

/* Capability URL display */
.capability-success {
  padding: 32px 0;
}
.capability-box {
  background: var(--bg-warn);
  border: 1px solid #6b541a;
  border-radius: var(--radius);
  padding: 20px;
  margin: 24px 0;
}
.capability-box code {
  display: block;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  padding: 12px;
  background: var(--bg);
  border-radius: 4px;
}
.capability-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}
.warning-details {
  margin-top: 24px;
  font-size: 14px;
}

/* "Show my dashboard URL" section on the dashboard. Styled to mirror the
   signup-success capability-box but tighter — it's an inline details
   element, not a hero. */
.capability-url-section {
  margin-bottom: 16px;
  font-size: 14px;
}
.capability-url-section > summary {
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 8px;
}
.capability-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.capability-url-box code {
  flex: 1;
  min-width: 0;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 8px 10px;
  background: var(--code-bg, #131316);
  border: 1px solid var(--border, #1d1d20);
  border-radius: 4px;
}

/* QR modal — opened from the QR button on each chat-link row. */
.qr-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.qr-modal {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  text-align: center;
}
.qr-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  text-align: left;
}
.qr-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 4px;
}
.qr-modal-close:hover { color: var(--fg); }
.qr-modal-canvas {
  display: flex;
  justify-content: center;
  margin: 0 auto 12px;
}
.qr-modal-canvas img,
.qr-modal-canvas canvas {
  display: block;
}
.qr-modal-url {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 12px;
  word-break: break-all;
}
.qr-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Lists (links, rooms) */
.link-list, .room-list, .account-actions {
  list-style: none;
  padding: 0;
  margin: 0;
}
.link-row, .room-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.link-row-main { flex: 1; min-width: 0; }
.link-row-main strong { display: block; margin-bottom: 4px; }
.link-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--fg-muted);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.link-create-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.link-create-row {
  display: flex;
  gap: 8px;
}
.link-create-form input[type="text"] {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.link-create-css-toggle {
  border-top: 1px dashed var(--border-soft);
  padding-top: 8px;
}
.link-create-css-toggle summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-muted);
  list-style: none;
  padding: 4px 0;
}
.link-create-css-toggle summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  transition: transform 120ms ease;
  color: var(--fg-faint);
}
.link-create-css-toggle[open] summary::before { transform: rotate(90deg); }
.link-create-css-toggle summary:hover { color: var(--fg); }
.link-create-css-toggle textarea {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  line-height: 1.5;
  box-sizing: border-box;
}
.link-create-css-toggle .muted.small {
  font-size: 11px;
  margin-top: 6px;
}
.link-create-css-toggle .muted.small code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10.5px;
}
.custom-css-pill {
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--fg-muted);
  background: var(--bg-soft);
  border-radius: var(--radius);
}

.account-section ul {
  list-style: disc;
  padding-left: 20px;
}
.account-section li {
  margin-bottom: 8px;
}

/* Connect page credentials */
.credentials-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.credentials-card dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0 0 16px;
}
.credentials-card dt {
  color: var(--fg-muted);
  font-size: 13px;
  padding-top: 2px;
}
.credentials-card dd { margin: 0; }
.credentials-card code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
}

details {
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border-radius: var(--radius);
}
details summary {
  cursor: pointer;
  font-weight: 500;
}
details[open] summary { margin-bottom: 8px; }

.inline { display: inline; }

/* Mobile */
@media (max-width: 600px) {
  .link-row { flex-direction: column; align-items: stretch; }
  .link-row-actions { justify-content: flex-end; flex-wrap: wrap; }
  .credentials-card dl { grid-template-columns: 1fr; }
}

/* Active-conversations grid */
.room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.room-card {
  display: block;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--fg);
  transition: border-color 80ms ease, background 80ms ease;
}
.room-card:hover {
  border-color: var(--accent);
  background: var(--bg);
}
.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.room-card-cta {
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  margin-top: 8px;
}

/* Dashboard "Settings" page: chats CTA + connect card + active-count pill. */
.chats-cta {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; background: var(--accent-soft);
  border: 1px solid var(--accent); border-radius: 8px;
  margin: 20px 0 32px; text-decoration: none;
  color: var(--fg);
}
.chats-cta:hover { color: var(--accent); }
.chats-cta strong { color: var(--accent); }
.chats-cta-arrow { font-size: 18px; color: var(--accent); }
.connect-card {
  padding: 16px 20px; background: var(--bg);
  border: 1px solid var(--border-soft); border-radius: var(--radius);
}
.connect-card-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border-soft);
}
.connect-card-row:last-child { border-bottom: none; }
.connect-card-label { font-size: 13px; color: var(--fg-muted); }
.connect-card-value {
  font-size: 13px; color: var(--fg); font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}
.connect-card-status {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: var(--bg-soft); color: var(--fg-muted);
}
.label-pill {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  background: var(--accent-soft); color: var(--accent);
  border-radius: 3px; font-weight: 500; margin-left: 8px;
}

/* --- Registration / login forms (Phase 2) --------------------------------
   Simple, accessible forms. Use the existing button classes
   (.primary-button / .secondary-button) for actions.
*/
.auth-flow { max-width: 460px; margin: 0 auto; }
/* Link styling for auth pages (login, register, forgot-password,
 * reset-password, confirm-email). Without this, anchors inside .muted
 * paragraphs fall back to the browser default blue — visually inconsistent
 * with the brand's lime accent. Scope is intentionally narrow (.auth-flow
 * only) so we don't inadvertently restyle links elsewhere (dashboard,
 * chats, marketing topbar). */
.auth-flow a { color: var(--accent); text-decoration: none; }
.auth-flow a:visited { color: var(--accent); }
.auth-flow a:hover { color: var(--accent-hover); text-decoration: underline; }
.auth-form { display: flex; flex-direction: column; gap: 16px; margin-top: 24px; }
.auth-form .form-row { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 14px; font-weight: 500; }
.auth-form input[type="email"],
.auth-form input[type="password"] {
  padding: 10px 12px;
  border: 1px solid var(--code-bg);
  border-radius: 6px;
  font-size: 15px;
  background: var(--bg);
  color: var(--fg);
}
.auth-form input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.form-error {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.4);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
}
.flash-message {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 14px;
}

/* --- Anon-creator register nudge on dashboard --------------------------- */
.register-banner.anon-nudge {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0 24px;
}
.register-banner.anon-nudge p { margin: 0; }
.register-banner-actions { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }

/* x-cloak: hide Alpine-controlled elements until Alpine initializes. */
[x-cloak] { display: none !important; }
