/* Fansi Moderation — estilos compartidos */

:root {
  --bg: #0d1226;
  --panel: #141a34;
  --panel-2: #1a2144;
  --line: #2b3466;
  --line-soft: #212951;
  --text: #eef0fd;
  --muted: #9aa2cc;

  --pink: #ff5c8a;
  --pink-hover: #ff7ea3;
  --on-pink: #2b0714;
  --mint: #4de3b0;
  --amber: #ffc857;
  --sky: #6cc6ff;
  --lilac: #b8a6ff;

  --font-display: 'Unbounded', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; margin: 0; letter-spacing: -0.02em; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; border-radius: 6px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Barra superior ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
  padding: 1.25rem 0;
}
.brand {
  display: inline-flex; align-items: center; gap: .65rem;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  letter-spacing: -0.02em; text-decoration: none;
}
.brand-mark { width: 30px; height: 30px; color: var(--pink); flex: none; }

.user { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--panel-2); flex: none; }
.user-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.3rem;
  border: 2px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 700; font-size: .95rem; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--pink); color: var(--on-pink); }
.btn-primary:hover { background: var(--pink-hover); }
.btn-invite { background: transparent; color: var(--pink); border: 2px dashed var(--pink); }
.btn-invite:hover { background: rgba(255, 92, 138, .14); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-disabled { color: var(--muted); border-color: var(--line-soft); cursor: not-allowed; }
.btn-lg { padding: .95rem 1.8rem; font-size: 1.05rem; }
.btn-sm { padding: .45rem .95rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: wait; }

/* ---------- Avisos y estados ---------- */
.notice {
  padding: .8rem 1rem; border-radius: 12px;
  background: rgba(255, 92, 138, .12); border: 1px solid rgba(255, 92, 138, .5);
}
.state {
  padding: 2.5rem 1.5rem; text-align: center;
  border: 2px dashed var(--line); border-radius: 20px;
  display: grid; gap: .75rem; justify-items: center;
}
.state h2 { font-size: 1.15rem; }
.state p { color: var(--muted); max-width: 46ch; }

.state-error {
  background: linear-gradient(180deg, rgba(255, 92, 138, .08), rgba(13, 18, 38, .15));
  border-color: rgba(255, 92, 138, .45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.error-card {
  display: grid; place-items: center;
  width: min(220px, 60vw);
  padding: .6rem;
  border-radius: 24px;
  background: rgba(20, 26, 52, .7);
  border: 1px solid rgba(255, 92, 138, .25);
}
.error-svg {
  width: 100%; height: auto; display: block;
}
.error-outer { fill: rgba(255, 92, 138, .1); stroke: rgba(255, 92, 138, .8); stroke-width: 4; }
.error-eye { fill: #f7d7df; }
.error-mouth { fill: none; stroke: #f7d7df; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.error-brow { fill: none; stroke: rgba(255, 92, 138, .9); stroke-width: 4; stroke-linecap: round; }

.toast-wrap { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 50; }
.toast {
  padding: .75rem 1rem; border-radius: 12px; background: var(--panel-2);
  border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
  max-width: min(360px, 100vw - 2rem); font-weight: 500;
}
.toast-ok { border-color: var(--mint); }
.toast-error { border-color: var(--pink); }

/* =====================================================
   LANDING (index.html)
   ===================================================== */
.hero {
  width: min(1120px, 100% - 2.5rem);
  margin-inline: auto;
  padding: clamp(2rem, 7vw, 5rem) 0 4rem;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(2rem, 6vw, 4.5rem); align-items: center;
}
.hero h1 { font-size: clamp(1.9rem, 4vw, 3.05rem); margin-bottom: 1.25rem; }
.hero-lead { color: var(--muted); font-size: 1.12rem; max-width: 52ch; margin-bottom: 2rem; }
.hero-cta { display: grid; gap: 1rem; justify-items: start; }
.hero-note { color: var(--muted); font-size: .92rem; max-width: 46ch; }
.hero .notice { margin-bottom: 1.25rem; max-width: 52ch; }

.modlog {
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  padding: 1.25rem;
}
.modlog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .25rem .35rem 1rem; }
.modlog-head h2 { font-size: .95rem; }
.modlog-tag { font-size: .8rem; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .65rem; }
.modlog ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }

.log-entry {
  --c: var(--muted);
  display: grid; grid-template-columns: 5.6rem minmax(0, 1fr) auto; gap: .9rem; align-items: center;
  padding: .8rem 1rem .8rem .9rem;
  background: var(--panel-2); border-radius: 12px; border-left: 4px solid var(--c);
  animation: log-in .5s cubic-bezier(.2, .7, .2, 1) backwards;
  animation-delay: calc(var(--i) * 140ms + 200ms);
}
.log-ban { --c: var(--pink); }
.log-timeout { --c: var(--amber); }
.log-automod { --c: var(--sky); }
.log-warn { --c: var(--lilac); }
.log-type { color: var(--c); font-weight: 700; font-size: .88rem; }
.log-entry strong { display: block; font-size: .95rem; }
.log-entry span.log-why { display: block; color: var(--muted); font-size: .88rem; }
.log-entry time { color: var(--muted); font-size: .82rem; white-space: nowrap; }

@keyframes log-in { from { opacity: 0; transform: translateX(18px); } }

.site-foot {
  width: min(1120px, 100% - 2.5rem); margin-inline: auto;
  padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: .85rem;
  border-top: 1px solid var(--line-soft);
}

/* =====================================================
   PANEL DE SERVIDORES (dashboard.html)
   ===================================================== */
.page { width: min(1120px, 100% - 2.5rem); margin-inline: auto; padding: 1.5rem 0 4rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.25rem; margin-bottom: 1.75rem; }
.page-head h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: .4rem; }
.page-head p { color: var(--muted); }
.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; }

.field-input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); font: inherit; padding: .6rem .9rem; min-width: 240px;
}
.field-input::placeholder { color: var(--muted); }

.srv-grid { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 390px), 1fr)); }

.srv {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 1rem; align-items: center;
  padding: 1rem 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
}
.srv.is-missing { background: transparent; border: 2px dashed var(--line); }
.srv.is-locked { opacity: .7; }

.srv-icon {
  width: 52px; height: 52px; border-radius: 16px; object-fit: cover; flex: none;
  background: var(--panel-2);
}
.srv-icon--fallback {
  display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; font-size: .85rem;
  color: var(--muted);
}
.srv-info { min-width: 0; }
.srv-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srv-status { display: flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .87rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.dot-on { background: var(--mint); }

.srv-skel { height: 82px; border-radius: 18px; background: var(--panel); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* =====================================================
   CONFIGURAR (configure.html)
   ===================================================== */
.back { display: inline-flex; gap: .4rem; color: var(--muted); text-decoration: none; font-weight: 600; margin-bottom: 1.25rem; }
.back:hover { color: var(--text); }
.cfg-title { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.cfg-title h1 { font-size: clamp(1.4rem, 3vw, 2rem); }
.cfg-title p { color: var(--muted); }
.cfg-title .srv-icon { width: 60px; height: 60px; border-radius: 18px; }

.cfg-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2.25rem; align-items: start; }

.cfg-nav { display: grid; gap: .3rem; position: sticky; top: 1rem; }
.nav-item {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .6rem .9rem; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); font: inherit; font-weight: 600; text-align: left; cursor: pointer;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.is-active { background: var(--panel-2); color: var(--text); box-shadow: inset 3px 0 0 var(--pink); }
.nav-item.is-soon { cursor: default; opacity: .55; }
.nav-item.is-soon:hover { background: transparent; color: var(--muted); }
.nav-item small { font-size: .75rem; border: 1px solid var(--line); border-radius: 999px; padding: 0 .5rem; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 1.5rem 1.6rem; }
.panel h2 { font-size: 1.15rem; margin-bottom: .35rem; }
.panel > p { color: var(--muted); margin-bottom: 1.5rem; max-width: 60ch; }

.field { display: grid; gap: .4rem; margin-bottom: 1.4rem; max-width: 440px; }
.field label { font-weight: 700; }
.field small { color: var(--muted); }
.select,
.textarea {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .85rem; font: inherit;
}
.textarea {
  min-height: 120px; resize: vertical;
}

.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1.25rem;
  padding: 1.1rem 0; border-top: 1px solid var(--line-soft); cursor: pointer;
}
.switch-row:first-of-type { border-top: 0; padding-top: 0; }
.switch-row strong { display: block; }
.switch-row small { color: var(--muted); font-size: .9rem; }

.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative;
  width: 48px; height: 28px; border-radius: 999px; background: var(--line);
  cursor: pointer; transition: background-color .15s; margin: 0;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px;
  border-radius: 50%; background: #fff; transition: transform .15s;
}
.switch:checked { background: var(--pink); }
.switch:checked::after { transform: translateX(20px); }

.savebar {
  position: sticky; bottom: 1rem; margin-top: 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .8rem 1rem .8rem 1.25rem;
  background: var(--panel-2); border: 1px solid var(--pink); border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45);
}
.savebar p { font-weight: 600; }
.savebar div { display: flex; gap: .6rem; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .cfg-layout { grid-template-columns: 1fr; gap: 1.25rem; }
  .cfg-nav { position: static; display: flex; overflow-x: auto; padding-bottom: .25rem; }
  .nav-item { white-space: nowrap; }
}
@media (max-width: 520px) {
  .user-name { display: none; }
  .srv { grid-template-columns: auto minmax(0, 1fr); }
  .srv .btn { grid-column: 1 / -1; }
  .field-input { min-width: 0; width: 100%; }
  .toolbar { width: 100%; }
  .log-entry { grid-template-columns: 4.6rem minmax(0, 1fr); }
  .log-entry time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
