/* Monero User Forum — dark theme, Monero orange (#ff6600). No-JS baseline. */
:root {
  --mono-orange: #ff6600;
  --mono-orange-2: #ff8a3d;
  --bg: #0f0f0f;
  --bg-2: #171717;
  --bg-3: #1e1e1e;
  --panel: #181818;
  --border: rgba(255, 255, 255, 0.10);
  --border-2: rgba(255, 255, 255, 0.18);
  --fg: #ededed;
  --fg-muted: rgba(255, 255, 255, 0.62);
  --fg-dim: rgba(255, 255, 255, 0.40);
  --green: #4caf50;
  --red: #ff5252;
  --radius: 8px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
::selection { background: var(--mono-orange); color: #0f0f0f; }
::-moz-selection { background: var(--mono-orange); color: #0f0f0f; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.55;
  font-size: 15px;
}
a { color: var(--mono-orange-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---- Layout shell ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #141414, #0f0f0f);
  position: sticky; top: 0; z-index: 20;
}
.nav {
  max-width: 1080px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: .2px; color: var(--fg); font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--mono-orange); color: #111; font-weight: 900;
  display: inline-flex; align-items: center; justify-content: center; font-size: 18px;
}
.brand .logo-img { width: 34px; height: 34px; border-radius: 7px; display: inline-block; vertical-align: middle; }
.hero-logo { width: 220px; height: 220px; max-width: 72%; border-radius: 16px; display: block; margin: 0 auto; }
.brand .accent { color: var(--mono-orange); }
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: var(--fg-muted); padding: 6px 10px; border-radius: 6px; font-size: 14px; font-weight: 600;
}
.nav-links a:hover { color: var(--fg); background: var(--bg-3); text-decoration: none; }
.nav-spacer { flex: 1 1 auto; }
/* All right-hand controls (search, account icons, Log out) live in one zone that
   is pushed to the right and stays right-aligned even when the bar wraps, so
   Log out is always the far-right element. */
.nav-right {
  margin-left: auto; display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap; justify-content: flex-end;
}
.nav-search { flex: 0 0 auto; margin: 0; position: relative; }
.search-suggest {
  position: absolute; top: 100%; left: 0; margin-top: 4px; z-index: 40;
  min-width: 240px; max-width: 320px;
  background: var(--bg-2); border: 1px solid var(--border-2); border-radius: 6px; overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.search-suggest a {
  display: block; padding: 8px 11px; color: var(--fg); font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid var(--border);
}
.search-suggest a:last-child { border-bottom: 0; }
.search-suggest a:hover { background: var(--bg-3); color: var(--mono-orange-2); text-decoration: none; }
.nav-search input {
  background: var(--bg); border: 1px solid var(--border-2); color: var(--fg);
  border-radius: 6px; padding: 5px 10px; font-size: 13px; width: 150px; height: 32px;
}
.nav-search input:focus { border-color: var(--mono-orange); outline: none; width: 200px; }
@media (max-width: 640px) { .nav-search input { width: 108px; } .nav-search input:focus { width: 140px; } }
.nav-badge {
  display: inline-block; min-width: 18px; text-align: center; font-size: 11px; font-weight: 800;
  background: var(--mono-orange); color: #111; border-radius: 999px; padding: 1px 6px; margin-left: 4px;
}
.nav-icon { display: inline-flex; align-items: center; }
.nav-icon svg { display: block; }
/* Log out sits by itself at the far right of the bar (the nav-spacer already
   right-aligns the trailing controls; the nav gap separates it from the icons). */
.nav-logout { display: inline-flex; }

.container { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---- Panels / cards ---- */
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin: 0 0 16px; }
.panel-title { margin: 0 0 12px; font-size: 16px; font-weight: 800; }
h1 { font-size: 24px; margin: 0 0 14px; }
h2 { font-size: 19px; }
.muted { color: var(--fg-muted); }
.dim { color: var(--fg-dim); }
hr { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--bg-3); color: var(--fg); border: 1px solid var(--border-2);
  padding: 8px 14px; border-radius: 6px; font-weight: 700; font-size: 14px; font-family: inherit;
}
.btn:hover { text-decoration: none; border-color: var(--fg-dim); }
.btn-primary { background: var(--mono-orange); color: #111; border-color: var(--mono-orange); }
.btn-primary:hover { background: var(--mono-orange-2); border-color: var(--mono-orange-2); }
.btn-danger { border-color: rgba(255,82,82,.5); color: #ff8a8a; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---- Forms ---- */
.form-group { margin: 0 0 14px; }
label { display: block; font-size: 13px; font-weight: 700; color: var(--fg-muted); margin-bottom: 5px; }
.input, input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], input[type=url], textarea, select {
  width: 100%; background: var(--bg); color: var(--fg);
  border: 1px solid var(--border-2); border-radius: 6px; padding: 9px 11px;
  font-family: inherit; font-size: 14px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--mono-orange); }
textarea { min-height: 120px; resize: vertical; }
.hint { font-size: 12px; color: var(--fg-dim); margin-top: 4px; }
.field-error, .text-danger, .validation-summary-errors { color: var(--red); font-size: 13px; }
.form-narrow { max-width: 440px; }

/* ---- Alerts ---- */
.alert { border-radius: 6px; padding: 10px 14px; margin: 0 0 16px; font-size: 14px; border: 1px solid var(--border-2); }
.alert-success { background: rgba(76,175,80,.12); border-color: rgba(76,175,80,.4); color: #9be29e; }
.alert-error { background: rgba(255,82,82,.12); border-color: rgba(255,82,82,.4); color: #ff9a9a; }
.alert-info { background: rgba(255,102,0,.10); border-color: rgba(255,102,0,.35); color: var(--mono-orange-2); }

/* ---- Chips / badges ---- */
.chip {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--border); color: var(--fg-muted);
}
.chip-cat { color: var(--mono-orange-2); border-color: rgba(255,102,0,.35); background: rgba(255,102,0,.08); }
.rep { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-dim); }

/* ---- Thread / post lists ---- */
.thread-row { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.thread-row:last-child { border-bottom: 0; }
.thread-row-main { flex: 1 1 auto; min-width: 0; }
.thread-row-stats { flex: 0 0 auto; text-align: right; }
.thread-title { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.thread-meta { font-size: 12px; color: var(--fg-dim); }

.post { border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 14px; overflow: hidden; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.post-body { padding: 14px; white-space: pre-wrap; word-break: break-word; }
.post-sig { padding: 0 14px 12px; color: var(--fg-dim); font-size: 12px; border-top: 1px dashed var(--border); margin-top: 6px; padding-top: 8px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--bg-3); border: 1px solid var(--border); }
.avatar-lg { width: 84px; height: 84px; }
.avatar-xs { width: 18px; height: 18px; vertical-align: -4px; margin-right: 4px; }
.thread-lastby { display: inline; }
.post-banned { filter: blur(0); background: repeating-linear-gradient(45deg,#000,#000 10px,#0a0a0a 10px,#0a0a0a 20px); color: #000 !important; }
.post-banned * { color: #1a1a1a !important; }
/* Moderator-censored post: neutral placeholder, no content shown to anyone. */
.post-censored { color: var(--fg-dim); border-left: 3px solid rgba(255,82,82,.5); padding-left: 10px; }

/* Report control: a compact no-JS disclosure that reveals the reason form. */
.report-box { display: inline-block; }
.report-box .report-summary {
  list-style: none; cursor: pointer; font-size: 12px; color: var(--fg-dim);
  padding: 4px 9px; border: 1px solid var(--border); border-radius: 6px; user-select: none;
}
.report-box .report-summary::-webkit-details-marker { display: none; }
.report-box[open] .report-summary { color: #ff8a8a; border-color: rgba(255,82,82,.4); }
.report-box .report-summary:hover { color: #ff8a8a; }
.report-form { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.report-reason { flex: 1 1 220px; min-width: 160px; }

/* Admin report queue rows */
.report-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.report-row:last-child { border-bottom: 0; }
.report-actions { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.report-reason-shown { margin-top: 4px; font-size: 13px; color: var(--fg); }
.report-excerpt {
  margin-top: 6px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; color: var(--fg-dim); white-space: pre-wrap; word-break: break-word;
}

/* Rendered markdown post body */
.post-md { white-space: normal; }
.post-md > :first-child { margin-top: 0; }
.post-md p { margin: 0 0 10px; }
.post-md p:last-child { margin-bottom: 0; }
.post-md a { color: var(--mono-orange-2); text-decoration: underline; word-break: break-word; }
.post-md ul, .post-md ol { margin: 0 0 10px; padding-left: 22px; }
.post-md code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 13px; }
.post-md pre { background: var(--bg); padding: 10px; border-radius: 6px; overflow-x: auto; border: 1px solid var(--border); }
.post-md pre code { background: none; padding: 0; }
.post-md blockquote { margin: 0 0 10px; padding: 6px 12px; border-left: 3px solid var(--border-2); color: var(--fg-muted); }

/* Live post preview (toggled from the editor toolbar) */
.md-preview { margin: 8px 0 0; padding: 12px 14px; background: var(--bg); border: 1px dashed var(--mono-orange); border-radius: var(--radius); }

/* Markdown editor toolbar (progressive enhancement) */
.md-toolbar { display: flex; gap: 5px; margin-bottom: 6px; flex-wrap: wrap; }
.md-toolbar button {
  background: var(--bg-3); border: 1px solid var(--border-2); color: var(--fg);
  border-radius: 5px; padding: 4px 10px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.md-toolbar button:hover { border-color: var(--mono-orange); color: var(--mono-orange-2); }
.md-hint { font-size: 12px; color: var(--fg-dim); margin-top: 4px; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); color: var(--fg-dim); font-size: 13px; }
.site-footer .inner { max-width: 1080px; margin: 0 auto; padding: 20px 16px; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }

/* ---- Sponsor slot ---- */
.sponsor-slot { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px; background: var(--bg-2); }
.sponsor-slot .label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-dim); }
.sponsor-slot .label a { color: var(--fg-muted); }
.sponsor-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 10px; }
@media (max-width: 760px) { .sponsor-grid { grid-template-columns: repeat(2, 1fr); } }

/* Thread page: content + right sponsor sidebar */
.thread-layout { display: flex; gap: 16px; align-items: flex-start; }
.thread-main { flex: 1 1 auto; min-width: 0; }
.thread-side { flex: 0 0 250px; }
.sponsor-side .sponsor-card { margin-bottom: 8px; }
@media (max-width: 860px) { .thread-layout { flex-direction: column; } .thread-side { flex: none; width: 100%; } }
.sponsor-card { display: flex; flex-direction: column; gap: 4px; padding: 11px 13px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.sponsor-card:hover { border-color: rgba(255,102,0,.4); text-decoration: none; }
.sponsor-name { font-weight: 800; color: var(--mono-orange-2); }
.sponsor-rating { font-size: 12px; color: var(--fg-dim); font-weight: 600; margin-left: 4px; }
.sponsor-desc { font-size: 12.5px; color: var(--fg-muted); line-height: 1.45; }

/* Post author left column (monero.forum-style layout) */
.post-inner { display: flex; }
.post-author {
  flex: 0 0 132px; padding: 14px 10px; border-right: 1px solid var(--border);
  background: var(--bg-2); text-align: center; min-width: 0;
}
.post-author .avatar { width: 56px; height: 56px; }
.post-author .who { display: block; font-weight: 800; margin-top: 8px; word-break: break-word; font-size: 14px; }
.post-author .rep { display: block; margin-top: 3px; }
.post-author .pcount { display: block; margin-top: 6px; font-size: 12px; color: var(--fg-muted); }
.post-author .pcount b { color: var(--fg); }
.post-main { flex: 1 1 auto; min-width: 0; }
.post-main .post-meta { padding: 10px 14px 0; color: var(--fg-dim); font-size: 12px; }
.post-actions { display: flex; gap: 8px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--border); background: var(--bg-2); }
@media (max-width: 560px) {
  .post-inner { flex-direction: column; }
  .post-author {
    flex: none; border-right: 0; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 14px;
  }
  .post-author .avatar { width: 40px; height: 40px; }
  .post-author .who, .post-author .rep, .post-author .pcount { margin: 0; }
}

/* ---- Chat ---- */
.chat-log {
  max-height: 460px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 10px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  scrollbar-width: thin; scrollbar-color: var(--mono-orange) #000;
}
.chat-log::-webkit-scrollbar { width: 11px; }
.chat-log::-webkit-scrollbar-track { background: #000; border-radius: 6px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--mono-orange); border-radius: 6px; border: 2px solid #000; }
.chat-log::-webkit-scrollbar-thumb:hover { background: var(--mono-orange-2); }
.chat-msg { font-size: 14px; }
#chat-input { flex: 1 1 auto; min-width: 0; }

/* Direct-message bubbles — shrink to fit the message, small time top-left */
.dm-list { display: flex; flex-direction: column; gap: 6px; }
.dm-bubble { width: fit-content; max-width: 80%; min-width: 44px; padding: 5px 11px 7px; border-radius: 12px; }
.dm-bubble.me { align-self: flex-end; background: rgba(255,102,0,.14); border: 1px solid rgba(255,102,0,.32); }
.dm-bubble.them { align-self: flex-start; background: var(--bg-3); border: 1px solid var(--border); }
.dm-time { font-size: 10px; color: var(--fg-dim); line-height: 1.2; margin-bottom: 2px; }
.dm-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; line-height: 1.4; }
.chat-msg .who { font-weight: 700; color: var(--mono-orange-2); }
.chat-msg .when { font-size: 11px; color: var(--fg-dim); }

/* ── Two-pane messenger: conversation list (left) + thread (right) ────────── */
.dm-layout { display: flex; gap: 16px; align-items: flex-start; }
.dm-leftcol { flex: 0 0 340px; display: flex; flex-direction: column; gap: 16px; }
.dm-threadcol { flex: 1 1 auto; min-width: 0; }
@media (max-width: 860px) {
  .dm-layout { flex-direction: column; }
  .dm-leftcol { flex: none; width: 100%; }
}

/* Left column: the conversation list */
.dm-listcol { padding: 12px; }
.dm-list-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.dm-list-title { flex: 1 1 auto; min-width: 0; }
.dm-list-title strong { font-size: 16px; }
.dm-convo-scroll {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 70vh; overflow-y: auto; margin: 0 -6px; padding: 0 6px;
  scrollbar-width: thin; scrollbar-color: var(--mono-orange) #000;
}
.dm-convo-scroll::-webkit-scrollbar { width: 11px; }
.dm-convo-scroll::-webkit-scrollbar-track { background: #000; border-radius: 6px; }
.dm-convo-scroll::-webkit-scrollbar-thumb { background: var(--mono-orange); border-radius: 6px; border: 2px solid #000; }

.dm-convo {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 9px; text-decoration: none; color: var(--fg); border: 1px solid transparent;
}
.dm-convo:hover { background: var(--bg-3); }
.dm-convo.active { background: rgba(255,102,0,.10); border-color: var(--mono-orange); }
.dm-convo .avatar { width: 40px; height: 40px; flex: 0 0 auto; }
.dm-convo-body { flex: 1 1 auto; min-width: 0; }
.dm-convo-top { display: flex; align-items: baseline; gap: 7px; }
.dm-convo-name {
  font-weight: 700; font-size: 14px; color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 42%;
}
.dm-convo.active .dm-convo-name { color: var(--mono-orange-2); }
.dm-convo-role {
  font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--fg-dim); white-space: nowrap; flex: 0 0 auto;
}
.dm-convo-role.role-admin  { color: var(--mono-orange-2); border-color: rgba(255,102,0,.4); }
.dm-convo-role.role-banned { color: #ff8a8a; border-color: rgba(255,82,82,.4); }
.dm-convo-role.role-gone   { color: var(--fg-dim); }
.dm-convo-time { margin-left: auto; font-size: 11px; color: var(--fg-dim); white-space: nowrap; flex: 0 0 auto; }
.dm-convo-snip {
  font-size: 13px; color: var(--fg-dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dm-convo-unread { margin-left: 4px; flex: 0 0 auto; }

/* Right column: thread header + empty state */
.dm-thread-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dm-thread-who { min-width: 0; }
.dm-thread-name { font-size: 20px; font-weight: 700; color: var(--fg); text-decoration: none; }
.dm-thread-name:hover { color: var(--mono-orange-2); }
.dm-empty { display: flex; align-items: center; justify-content: center; min-height: 140px; text-align: center; }
@media (max-width: 640px) {
  .dm-head-inbox { display: none; }
}

@media (max-width: 640px) {
  .nav { gap: 10px; }
  .nav-links a { padding: 6px 8px; }
}

/* ===== Mobile polish (phones) ===== */
@media (max-width: 640px) {
  /* Reclaim the wasted side space */
  .container { padding: 12px 10px 24px; }
  .panel { padding: 12px; }

  /* Thread list -> full-width, equally spaced cards (title on top, stats below) */
  .thread-row {
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-3);
  }
  .thread-row:last-child { border-bottom: 1px solid var(--border); margin-bottom: 0; }
  .thread-row-main { width: 100%; }
  .thread-title { font-size: 16px; }
  .thread-row-stats {
    width: 100%;
    text-align: left;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
  }
  .thread-row-stats .btn { margin-left: auto; margin-top: 0 !important; }

  /* Chatroom -> app-like: header on top, log fills the screen, input pinned below */
  .chat-page {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 92px);
    margin-bottom: 0;
  }
  .chat-page > h1 { font-size: 19px; margin: 0 0 6px; flex: 0 0 auto; }
  .chat-page > p.muted { display: none; }
  .chat-page .chat-log {
    flex: 1 1 auto;
    min-height: 0;      /* let it shrink+scroll inside the flex column */
    max-height: none;
  }
  .chat-page #chat-form { flex: 0 0 auto; margin-top: 8px; }
  #chat-input { font-size: 16px; }  /* >=16px stops iOS zoom-on-focus */
}
