/* ==========================================================================
   diskurso.ph - shared foundation
   Tokens, reset and the components used by BOTH /user and /admin.
   Page-specific styling lives in user/css/user.css and admin/css/admin.css
   ========================================================================== */

:root {
  /* surfaces (dark is the default, like the Twitter dim theme) */
  --bg:            #0a0f14;
  --bg-elevated:   #111a22;
  --surface:       #0f171e;
  --surface-hover: #161f28;
  --border:        #1f2c38;
  --border-strong: #2d3f4f;

  /* type */
  --text:       #e7edf3;
  --text-dim:   #8b9aa8;
  --text-faint: #5d6e7c;

  /* brand + debate sides - denim blue and retro red, lifted so they stay
     readable on the dark background. The light theme uses them at full strength. */
  --brand:        #4e7fa8;
  --brand-hover:  #5c90bc;
  --brand-soft:   rgba(78, 127, 168, 0.16);
  --side-a:       #6e9dc4;   /* Affirmative / Pro */
  --side-a-soft:  rgba(110, 157, 196, 0.14);
  --side-b:       #d94a4a;   /* Negative / Con */
  --side-b-soft:  rgba(217, 74, 74, 0.14);
  --gold:         #f5b544;
  --success:      #00ba7c;
  --danger:       #f4212e;
  --danger-soft:  rgba(244, 33, 46, 0.12);

  --radius:      14px;
  --radius-sm:   9px;
  --radius-pill: 999px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 3px var(--brand-soft);

  --font: "Chirp", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] {
  --bg:            #ffffff;
  --bg-elevated:   #ffffff;
  --surface:       #f7f9fa;
  --surface-hover: #eff3f4;
  --border:        #e3e8ea;
  --border-strong: #cfd9de;
  --text:          #0f1419;
  --text-dim:      #536471;
  --text-faint:    #8899a6;
  --brand:         #446b8d;   /* Denim Blue */
  --brand-hover:   #375873;
  --brand-soft:    rgba(68, 107, 141, 0.10);
  --side-a:        #446b8d;
  --side-a-soft:   rgba(68, 107, 141, 0.10);
  --side-b:        #b71c1c;   /* Retro Red */
  --side-b-soft:   rgba(183, 28, 28, 0.09);
  --danger-soft:   rgba(244, 33, 46, 0.08);
  --shadow: 0 8px 28px rgba(15, 20, 25, 0.12);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid var(--bg);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s, transform .08s;
}
.btn:hover { background: var(--brand-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #d81b26; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field > label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.hint { margin-top: 6px; font-size: 12px; color: var(--text-faint); }
.hint-error { color: var(--danger); }
.hint-ok { color: var(--success); }

/* ---------- cards / panels ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card-title { font-size: 17px; font-weight: 800; margin-bottom: 12px; }

/* ---------- avatar ---------- */
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  letter-spacing: .02em;
  user-select: none;
}
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 76px; height: 76px; font-size: 26px; }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
}
.pill-a { color: var(--side-a); border-color: var(--side-a); background: var(--side-a-soft); }
.pill-b { color: var(--side-b); border-color: var(--side-b); background: var(--side-b-soft); }
.pill-gold { color: var(--gold); border-color: var(--gold); background: rgba(245,181,68,.12); }
.pill-live { color: var(--success); border-color: var(--success); background: rgba(0,186,124,.12); }
.pill-closed { color: var(--text-faint); }

/* ---------- helpers ---------- */
.row { display: flex; align-items: center; gap: 10px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.bold { font-weight: 700; }
.center { text-align: center; }
.stack { display: grid; gap: 14px; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.empty { padding: 42px 22px; text-align: center; color: var(--text-dim); }
.empty h3 { margin-bottom: 6px; color: var(--text); font-size: 18px; }

.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 28px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toast ---------- */
#toast-host {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  z-index: 90;
  width: max-content;
  max-width: 92vw;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toast-in .2s ease-out;
}
.toast-error { background: var(--danger); }
.toast-dark  { background: var(--bg-elevated); border: 1px solid var(--border-strong); color: var(--text); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .62);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 80;
}
.modal {
  width: 100%;
  max-width: 460px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal h3 { font-size: 20px; margin-bottom: 8px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ---------- brand mark ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--side-a), var(--side-b));
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

/* ==========================================================================
   TAG CHIPS - interests and topic keywords
   ========================================================================== */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.chip:hover { color: var(--text); border-color: var(--text-faint); }
.chip.on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* read-only chips, e.g. the interests shown on a profile */
.chips-static .chip { cursor: default; }
.chips-static .chip:hover { color: var(--text-dim); border-color: var(--border-strong); }

.chip-add { display: flex; gap: 8px; margin-top: 10px; }
.chip-add .input { flex: 1; }

/* ---------- tag entry field ---------- */

.tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 8px 10px;
  min-height: 46px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.tag-input:focus-within {
  border-color: var(--brand);
  box-shadow: var(--ring);
}

.tag-input .tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.tag-x {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: .65;
}
.tag-x:hover { opacity: 1; background: var(--brand); color: #fff; }

.tag-entry {
  flex: 1;
  min-width: 160px;
  padding: 5px 2px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.tag-entry::placeholder { color: var(--text-faint); }

/* ---------- Google sign-in button (auth page and the sidebar invite) ---------- */

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-google:hover { background: var(--surface-hover); border-color: var(--text-faint); }
.btn-google:disabled { opacity: .5; cursor: not-allowed; }
.btn-google svg { flex-shrink: 0; }

/* ---------- reporting ---------- */

.report-quote {
  margin: 0 0 18px;
  padding: 10px 14px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 13.5px;
  line-height: 1.5;
  max-height: 120px;
  overflow: auto;
}

.report-reasons {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--text-dim);
}
.report-reasons b { color: var(--text); }
