/* ====== Foro Anónimo — estilos ====== */
/* Paleta morada. Para cambiar el color del sitio, edita --accent. */
:root {
  --bg: #f5f3fb;
  --card: #ffffff;
  --text: #1c1830;
  --muted: #6b6882;
  --border: #e6e1f2;
  --accent: #7c3aed;       /* morado principal (botones) */
  --accent-soft: #efe7fe;  /* fondo suave morado */
  --link: #6d28d9;
  --accent-text: #ffffff;
  --up: #7c3aed;
  --down: #0891b2;
  --quote: #16a34a;
  --danger: #dc2626;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d16;
    --card: #1a1724;
    --text: #ebe8f5;
    --muted: #a19cb8;
    --border: #2d2940;
    --accent-soft: #2a1f45;
    --link: #c4b5fd;
    --up: #a78bfa;
    --down: #22d3ee;
    --quote: #4ade80;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

/* Barra superior */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.logo { font-weight: 800; font-size: 18px; text-decoration: none; }
.logo-mark { color: var(--accent); }
.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a { white-space: nowrap; text-decoration: none; padding: 4px 12px; border-radius: 999px; color: var(--muted); border: 1px solid var(--border); font-size: 13px; }
.cats a.active, .cats a:hover { color: var(--text); border-color: var(--text); }

.topbar { border-top: 3px solid var(--accent); }
.cats a.active { background: var(--accent-soft); border-color: var(--accent) !important; color: var(--link) !important; font-weight: 600; }

/* Diseño en dos columnas: contenido + barra lateral */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 312px; gap: 24px; padding-top: 16px; padding-bottom: 32px; align-items: start; }
.layout.no-sidebar { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.content { min-width: 0; }

/* Barra lateral */
.sidebar { display: flex; flex-direction: column; gap: 12px; }
.side-box { margin: 0; }
.side-box h3 { margin: 4px 0 4px; font-size: 18px; }
.side-box h4 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.side-about { border-top: 4px solid var(--accent); }
.side-about p { margin: 0 0 12px; font-size: 14px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stats div { background: var(--bg); border-radius: 8px; padding: 8px 10px; }
.stats strong { display: block; font-size: 18px; }
.stats span { font-size: 12px; color: var(--muted); }
.btn-block { display: block; text-align: center; width: 100%; }
.trend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.trend-item { display: flex; gap: 10px; align-items: center; text-decoration: none; padding: 6px; margin: 0 -6px; border-radius: 8px; }
.trend-item:hover { background: var(--bg); }
.trend-rank { font-weight: 800; color: var(--accent); min-width: 14px; font-size: 14px; }
.trend-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.trend-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trend-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.side-cats { list-style: none; margin: 0; padding: 0; }
.side-cats a { display: flex; align-items: center; gap: 10px; padding: 6px; margin: 0 -6px; border-radius: 8px; text-decoration: none; font-size: 14px; }
.side-cats a:hover, .side-cats a.active { background: var(--accent-soft); }
.side-cats .count { margin-left: auto; }
.cat-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; background: hsl(calc(var(--h) * 1deg) 60% 50%); }
.side-box a.small { color: var(--link); text-decoration: none; }
.side-tip { padding: 0 4px; line-height: 1.6; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
}

/* Botones */
.btn { display: inline-block; border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 8px 16px; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.link-btn:hover { color: var(--text); text-decoration: underline; }

/* Tarjetas */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.empty { text-align: center; padding: 40px 16px; }
.cat-header h1 { margin: 0 0 4px; }
.cat-header p { margin: 0 0 12px; color: var(--muted); }

.sortbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sortbar a { text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.sortbar a.active { background: var(--card); color: var(--text); border: 1px solid var(--border); }

/* Publicaciones */
.post { display: flex; gap: 12px; }
.vote { display: flex; flex-direction: column; align-items: center; min-width: 36px; }
.vote-btn { background: none; border: 0; cursor: pointer; font-size: 16px; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.vote-btn:hover { background: var(--bg); }
.vote-btn.up.on { color: var(--up); }
.vote-btn.down.on { color: var(--down); }
.score { font-weight: 700; font-size: 14px; }
.post-main { flex: 1; min-width: 0; }
.meta { font-size: 12px; color: var(--muted); }
.meta a { text-decoration: none; }
.cat-tag { font-weight: 700; color: var(--text) !important; }
.tag { font-family: ui-monospace, monospace; background: var(--bg); padding: 0 4px; border-radius: 4px; }
.op { background: var(--accent); color: var(--accent-text); font-weight: 700; padding: 0 5px; border-radius: 4px; font-size: 11px; }
.pending { background: #f59e0b; color: #000; padding: 0 6px; border-radius: 4px; margin-left: 4px; }
.title { font-size: 18px; margin: 4px 0 8px; line-height: 1.3; overflow-wrap: anywhere; }
.title a { text-decoration: none; }
.title a:hover { text-decoration: underline; }
.post-full .title { font-size: 22px; }
.post-img { display: block; margin: 8px 0; }
.post-img img { max-height: 480px; border-radius: 8px; display: block; background: var(--bg); cursor: zoom-in; }
.post-full .post-img img { max-height: 80vh; }
.body { overflow-wrap: anywhere; }
.body a { color: var(--link); }
.body.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.quote { color: var(--quote); }
.deleted { color: var(--muted); font-style: italic; }
.actions { display: flex; gap: 14px; margin-top: 10px; font-size: 13px; color: var(--muted); align-items: center; }
.actions a { text-decoration: none; }
.actions a:hover { text-decoration: underline; }

/* Comentarios */
.section-title { font-size: 16px; margin: 0 0 12px; }
.comments { list-style: none; margin: 16px 0 0; padding: 0; }
.comments.nested { margin: 8px 0 0 6px; padding-left: 12px; border-left: 2px solid var(--border); }
.comment { margin-bottom: 12px; }
.comment:target > .body { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 6px; }
.comment .actions { margin-top: 4px; }
.replying { font-size: 13px; color: var(--muted); }

/* Formularios */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
input[type=text], input[type=password], select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form .btn { align-self: flex-start; }
.form-card h1 { margin-top: 0; }
.narrow { max-width: 420px; margin: 40px auto; }
.preview { max-height: 240px; width: auto; align-self: flex-start; border-radius: 8px; margin-top: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Mensajes */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; font-size: 14px; }
.flash-ok { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }

/* Paginación y pie */
.pager { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.footer { color: var(--muted); font-size: 12px; padding-bottom: 32px; text-align: center; }
.footer a { color: var(--muted); }
.prose h1 { margin-top: 0; }
.prose li { margin-bottom: 6px; }

/* Visor de imágenes */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; z-index: 100; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 200; }

/* Panel de moderación */
.admin-head { display: flex; justify-content: space-between; align-items: center; }
.mod-item h3 { margin: 4px 0; font-size: 16px; }
.mod-thumb { max-height: 160px; border-radius: 6px; display: block; margin: 6px 0; }
.mod-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.sel-sm, .in-sm { padding: 4px 8px !important; font-size: 13px; width: auto !important; }
.report-info { font-size: 13px; background: #fef3c7; color: #78350f; padding: 6px 10px; border-radius: 6px; margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); }

@media (max-width: 560px) {
  .post { gap: 8px; }
  .vote { min-width: 28px; }
  .title { font-size: 16px; }
  .post-full .title { font-size: 19px; }
  .card { padding: 12px; }
}

/* Imágenes en comentarios (miniatura a la izquierda, estilo foro) */
.comment-content { display: flow-root; }
.comment-img { float: left; margin: 4px 12px 4px 0; }
.comment-img img { max-width: 180px; max-height: 180px; border-radius: 8px; }
.comment-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.comment-attach .preview { flex-basis: 100%; max-height: 140px; }
.attach-btn { font-weight: 600; cursor: pointer; }
@media (max-width: 560px) {
  .comment-img img { max-width: 120px; max-height: 120px; }
}
@media (min-width: 901px) { .cat-header { display: none; } } /* en computadora ya se ve en la barra lateral */

/* Nombres de usuario */
.author { color: var(--muted); }
.author.named { color: var(--text); font-weight: 700; }
.comment-form .name-input { max-width: 320px; }
