/* ===========================================================
   NEXION · Panel de control — Sistema de diseño 2026
   Glassmorphism · aurora animada · acento neón temático
   =========================================================== */

:root {
  /* Acento (puede sobrescribirse por servidor con --accent inline) */
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-glow: rgba(124, 92, 255, 0.45);

  --bg: #05060d;
  --bg-soft: #0b0e1a;
  --surface: rgba(20, 24, 43, 0.55);
  --surface-2: rgba(30, 35, 60, 0.6);
  --border: rgba(140, 150, 200, 0.14);
  --border-strong: rgba(160, 170, 220, 0.28);

  --text: #eef1fb;
  --text-dim: #9aa3c4;
  --text-faint: #6b7396;

  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
  position: relative;
}

/* ---------- Fondo aurora animado ---------- */
body::before,
body::after {
  content: '';
  position: fixed;
  z-index: -2;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  pointer-events: none;
}
body::before {
  width: 55vw; height: 55vw;
  top: -18vw; left: -12vw;
  background: radial-gradient(circle, var(--accent), transparent 65%);
  animation: float1 22s ease-in-out infinite;
}
body::after {
  width: 48vw; height: 48vw;
  bottom: -16vw; right: -10vw;
  background: radial-gradient(circle, var(--accent-2), transparent 65%);
  animation: float2 26s ease-in-out infinite;
}
@keyframes float1 { 50% { transform: translate(8vw, 10vh) scale(1.15); } }
@keyframes float2 { 50% { transform: translate(-7vw, -8vh) scale(1.1); } }

/* Rejilla sutil sobre el fondo */
body { background-image:
  linear-gradient(rgba(120,130,190,0.035) 1px, transparent 1px),
  linear-gradient(90deg, rgba(120,130,190,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
}

a { color: inherit; text-decoration: none; }

/* ===========================================================
   NAVBAR
   =========================================================== */
.navbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 30px;
  backdrop-filter: blur(18px);
  background: rgba(6, 8, 16, 0.6);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand img { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 0 18px var(--accent-glow); }
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a { color: var(--text-dim); font-weight: 600; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; font-size: .9rem; }
.user-chip img { width: 26px; height: 26px; border-radius: 50%; }

/* ===========================================================
   LAYOUT
   =========================================================== */
.container { max-width: 1180px; margin: 0 auto; padding: 44px 26px 90px; }

.page-title { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em;
  background: linear-gradient(120deg, #fff, var(--accent-2)); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.subtitle { color: var(--text-dim); margin-top: 6px; }
.subtitle a { color: var(--accent-2); font-weight: 600; }

/* ===========================================================
   BOTONES
   =========================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: transform .15s, box-shadow .25s, background .2s; white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px -8px var(--accent-glow); }
.btn-primary:hover { box-shadow: 0 14px 40px -8px var(--accent-glow); }
.btn-ghost { color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: #fff; background: linear-gradient(120deg, #f43f5e, #fb7185); }
.btn-lg { padding: 15px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: .82rem; }

/* ===========================================================
   HERO / LANDING
   =========================================================== */
.hero { text-align: center; padding: 70px 0 50px; }
.hero h1 { font-size: clamp(2.8rem, 7vw, 5rem); font-weight: 900; letter-spacing: -0.04em;
  background: linear-gradient(120deg, #fff 20%, var(--accent) 55%, var(--accent-2)); -webkit-background-clip: text;
  background-clip: text; color: transparent; animation: shimmer 6s linear infinite; background-size: 200% auto; }
@keyframes shimmer { to { background-position: 200% center; } }
.tagline { color: var(--text-dim); font-size: 1.2rem; max-width: 640px; margin: 20px auto 0; }
.hero-actions { display: flex; gap: 16px; justify-content: center; margin-top: 36px; flex-wrap: wrap; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 40px 0; }
.stat-card { text-align: center; padding: 30px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(12px);
  transition: transform .25s, border-color .25s; }
.stat-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.stat-num { display: block; font-size: 2.6rem; font-weight: 900; letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.stat-label { color: var(--text-dim); font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; }

.features { margin-top: 70px; }
.features h2 { text-align: center; font-size: 1.8rem; font-weight: 800; margin-bottom: 34px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.feature { padding: 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px); font-size: 1.4rem;
  transition: transform .25s, border-color .25s, box-shadow .25s; }
.feature:hover { transform: translateY(-5px); border-color: var(--border-strong);
  box-shadow: 0 20px 50px -25px var(--accent-glow); }
.feature strong { font-size: 1.05rem; }
.feature p { font-size: .92rem; color: var(--text-dim); margin-top: 6px; }

/* ===========================================================
   GRID DE SERVIDORES
   =========================================================== */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; margin-top: 30px; }
.guild-card { padding: 22px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px); transition: transform .25s, border-color .25s; }
.guild-card:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.guild-head { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; }
.guild-head img { width: 52px; height: 52px; border-radius: 14px; }
.guild-icon-fallback { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  font-weight: 800; font-size: 1.4rem; color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2)); }
.guild-name { font-weight: 700; font-size: 1.05rem; }
.empty { text-align: center; padding: 60px 20px; color: var(--text-dim); background: var(--surface);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ===========================================================
   CONFIG DE SERVIDOR — layout con sidebar
   =========================================================== */
.guild-config-head { display: flex; align-items: center; gap: 18px; margin-bottom: 30px; }
.guild-config-head img { width: 66px; height: 66px; border-radius: 18px; box-shadow: var(--shadow); }

.dash-layout { display: grid; grid-template-columns: 232px 1fr; gap: 26px; align-items: start; }

.dash-sidebar { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 4px;
  padding: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px); }
.side-link { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-radius: 11px;
  color: var(--text-dim); font-weight: 600; font-size: .95rem; cursor: pointer; transition: all .18s;
  border: 1px solid transparent; }
.side-link .ico { font-size: 1.1rem; }
.side-link:hover { color: var(--text); background: var(--surface-2); }
.side-link.active { color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px -10px var(--accent-glow); }

.dash-panels { min-width: 0; }
.panel-section { display: none; animation: fadeUp .35s ease; }
.panel-section.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.section-title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 4px; }
.section-desc { color: var(--text-dim); margin-bottom: 22px; font-size: .95rem; }

/* ---------- Tarjetas de configuración ---------- */
.config-card { padding: 26px; margin-bottom: 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(12px); }
.config-card h2 { font-size: 1.15rem; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 9px; }
.config-card label { display: block; margin: 16px 0 7px; font-weight: 600; font-size: .9rem; color: var(--text-dim); }
.config-card label:first-of-type { margin-top: 0; }
.hint { font-weight: 400; color: var(--text-faint); font-size: .82rem; }
code { background: rgba(124,92,255,.18); color: var(--accent-2); padding: 1px 7px; border-radius: 6px; font-size: .85em; }

input[type=text], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; padding: 12px 14px; font-family: inherit; font-size: .95rem; color: var(--text);
  background: rgba(6, 9, 20, 0.55); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s; outline: none; color-scheme: dark;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea { resize: vertical; min-height: 90px; }
select option { background: var(--bg-soft); }

/* ---------- Toggle switch ---------- */
.switch-row { display: flex !important; align-items: center; gap: 13px; margin: 14px 0 !important;
  color: var(--text) !important; font-weight: 600; cursor: pointer; }
.switch-row input { display: none; }
.switch-row .track { width: 46px; height: 26px; border-radius: 999px; background: rgba(120,130,190,.25);
  position: relative; transition: background .25s; flex-shrink: 0; }
.switch-row .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .25s; }
.switch-row input:checked + .track { background: linear-gradient(120deg, var(--accent), var(--accent-2)); }
.switch-row input:checked + .track::after { transform: translateX(20px); }

/* ---------- Filas / listas dinámicas ---------- */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form > div { flex: 1; min-width: 120px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 16px; margin-bottom: 9px; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); }
.list-item .meta { display: flex; flex-direction: column; }
.list-item .meta b { font-weight: 700; }
.list-item .meta span { color: var(--text-dim); font-size: .85rem; }
.pill { padding: 3px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: rgba(124,92,255,.2); color: var(--accent-2); }

/* ---------- Mini stat cards dentro del overview ---------- */
.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.mini { padding: 20px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px); }
.mini .n { font-size: 1.9rem; font-weight: 900; letter-spacing: -.03em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.mini .l { color: var(--text-dim); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Gráfico de barras (actividad) ---------- */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding: 16px 0 0; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; min-height: 4px;
  background: linear-gradient(to top, var(--accent), var(--accent-2)); transition: height .5s ease;
  box-shadow: 0 0 14px -3px var(--accent-glow); }
.chart .bar-label { font-size: .72rem; color: var(--text-faint); }

/* ---------- Analíticas: barras horizontales de canales ---------- */
.chan-row { display: flex; align-items: center; gap: 12px; margin-bottom: 11px; }
.chan-row .cn { width: 140px; font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chan-row .cn::before { content: '# '; color: var(--text-faint); }
.chan-row .track2 { flex: 1; height: 14px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.chan-row .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 12px -2px var(--accent-glow); transition: width .5s ease; }
.chan-row .cv { width: 84px; text-align: right; font-weight: 700; font-size: .85rem; color: var(--text-dim); }
.chart .bar.neg { background: linear-gradient(to top, #f43f5e, #fb7185); }

/* ---------- Tabla clasificación ---------- */
.rank-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.rank-row .pos { font-weight: 900; font-size: 1.1rem; color: var(--accent-2); width: 34px; }
.rank-row .who { flex: 1; font-weight: 600; }
.rank-row .amt { font-weight: 800; }

/* ---------- Vista previa de embed (tipo Discord) ---------- */
.embed-preview { max-width: 540px; }
.ep-msg-content { white-space: pre-wrap; word-break: break-word; margin-bottom: 8px; color: var(--text); }
.ep-msg-content:empty { display: none; }
.ep-embed { position: relative; background: #2b2d31; border-radius: 8px; border-left: 4px solid var(--accent); padding: 14px 16px; color: #dbdee1; }
.ep-embed.empty { display: none; }
.ep-author { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: #fff; }
.ep-author img { width: 22px; height: 22px; border-radius: 50%; }
.ep-title { font-weight: 700; color: #fff; margin-bottom: 6px; }
.ep-title.link { color: #00a8fc; }
.ep-desc { font-size: .9rem; white-space: pre-wrap; word-break: break-word; margin-bottom: 8px; }
.ep-fields { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 8px; }
.ep-field { min-width: 100%; }
.ep-field.inline { min-width: 30%; flex: 1; }
.ep-field .fn { font-weight: 700; font-size: .82rem; color: #fff; }
.ep-field .fv { font-size: .85rem; white-space: pre-wrap; word-break: break-word; }
.ep-thumb { position: absolute; top: 14px; right: 16px; }
.ep-thumb img { width: 64px; height: 64px; border-radius: 6px; object-fit: cover; }
.ep-image { margin-top: 4px; }
.ep-image img { max-width: 100%; border-radius: 6px; display: block; }
.ep-footer { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: #a3a6aa; margin-top: 8px; }
.ep-footer img { width: 18px; height: 18px; border-radius: 50%; }
.ep-hide { display: none !important; }

/* ---------- Alertas ---------- */
.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 22px; font-weight: 600; }
.alert-success { background: rgba(52,211,153,.14); border: 1px solid rgba(52,211,153,.4); color: var(--ok); }

.btn-save { margin-top: 8px; }

/* ===========================================================
   FOOTER
   =========================================================== */
.footer { text-align: center; padding: 40px 20px; color: var(--text-faint); border-top: 1px solid var(--border); margin-top: 40px; }

/* ===========================================================
   RESPONSIVE
   =========================================================== */
@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar { position: static; flex-direction: row; overflow-x: auto; }
  .side-link { white-space: nowrap; }
  .stats-grid { grid-template-columns: 1fr; }
}
