/* ============================================================
   Nexus — Design-System (SCNX-inspiriert)
   Dunkles Theme, Violett/Blau-Verläufe, Glassmorphism-Karten
   ============================================================ */

:root {
  --brand: #7c5cff;
  --brand-2: #4f8cff;
  --brand-3: #c471ed;
  --grad: linear-gradient(135deg, #7c5cff 0%, #4f8cff 100%);
  --grad-text: linear-gradient(120deg, #a78bfa 0%, #60a5fa 50%, #c471ed 100%);

  --bg: #08080d;
  --bg-2: #0d0d16;
  --surface: #12121d;
  --surface-2: #181826;
  --surface-3: #1f1f30;
  --border: #262636;
  --border-2: #33334a;

  --text: #ececf5;
  --muted: #9292ad;
  --dim: #6b6b85;

  --green: #3ddc97;
  --red: #ff5c6c;
  --yellow: #ffcc4d;

  --r: 16px;
  --r-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, .5);
  --glow: 0 0 40px rgba(124, 92, 255, .25);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Sanfte Farbschleier im Hintergrund */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(600px circle at 15% 0%, rgba(124, 92, 255, .16), transparent 55%),
    radial-gradient(700px circle at 85% 5%, rgba(79, 140, 255, .12), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

a { color: var(--brand-2); text-decoration: none; transition: .15s; }
a:hover { color: var(--brand-3); }

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(8, 8, 13, .72);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.nav > .container { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 19px; letter-spacing: -.3px; color: var(--text); }
.brand .logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--grad); display: grid; place-items: center; font-size: 18px;
  box-shadow: var(--glow);
}
.links { display: flex; align-items: center; gap: 10px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; white-space: nowrap;
  border: 1px solid var(--border-2); border-radius: var(--r-sm);
  padding: 10px 18px; font-weight: 600; font-size: 14px; font-family: inherit;
  background: var(--surface-2); color: var(--text);
  transition: transform .15s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; }
.btn.primary:hover { box-shadow: 0 8px 24px rgba(124, 92, 255, .45); }
.btn.danger { background: rgba(255, 92, 108, .12); border-color: rgba(255, 92, 108, .4); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 13px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- Hero (Landing) ---------- */
.hero { text-align: center; padding: 100px 0 60px; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(124, 92, 255, .12); border: 1px solid rgba(124, 92, 255, .3);
  color: #c4b5fd; padding: 7px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  margin-bottom: 26px;
}
.hero h1 { font-size: clamp(40px, 7vw, 72px); line-height: 1.05; font-weight: 900; letter-spacing: -2.5px; }
.hero h1 .grad {
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--muted); font-size: 19px; max-width: 640px; margin: 22px auto 34px; }
.hero .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ---------- Statistik-Kacheln ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 48px 0; }
.stat {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 26px 20px; text-align: center; transition: .2s;
}
.stat:hover { border-color: var(--border-2); transform: translateY(-3px); }
.stat .num {
  font-size: 36px; font-weight: 800; letter-spacing: -1px;
  background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .label { color: var(--muted); font-size: 13.5px; margin-top: 6px; font-weight: 500; }

/* ---------- Feature-Grid ---------- */
.section-head { text-align: center; margin: 70px 0 34px; }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -1px; }
.section-head p { color: var(--muted); margin-top: 10px; font-size: 16.5px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 80px; }
.feature {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 26px; transition: .2s; position: relative; overflow: hidden;
}
.feature::after {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: var(--grad); opacity: 0; transition: .2s;
}
.feature:hover { border-color: var(--border-2); transform: translateY(-4px); box-shadow: var(--shadow); }
.feature:hover::after { opacity: 1; }
.feature .ico {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: rgba(124, 92, 255, .12); border: 1px solid rgba(124, 92, 255, .22);
  font-size: 22px; margin-bottom: 15px;
}
.feature h3 { font-size: 17.5px; margin-bottom: 7px; font-weight: 700; }
.feature p { color: var(--muted); font-size: 14.5px; }

/* ---------- Karten ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 26px; margin-bottom: 20px;
}
.card > h2 { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card .sub { color: var(--muted); font-size: 14px; margin-top: 3px; }

.page-title { padding: 36px 0 18px; }
.page-title h1 { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.page-title p { color: var(--muted); margin-top: 4px; }

/* ---------- Server-Grid ---------- */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.guild-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 18px; display: flex; align-items: center; gap: 14px; transition: .2s;
}
.guild-card:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--shadow); }
.guild-icon {
  width: 52px; height: 52px; border-radius: 15px; flex-shrink: 0; overflow: hidden;
  background: var(--grad); display: grid; place-items: center; font-weight: 800; font-size: 20px; color: #fff;
}
.guild-icon img { width: 100%; height: 100%; object-fit: cover; }
.guild-info { flex: 1; min-width: 0; }
.guild-info .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guild-info .meta { color: var(--muted); font-size: 13px; }

/* ---------- Dashboard-Layout mit Sidebar ---------- */
.dash-layout { display: grid; grid-template-columns: 250px 1fr; gap: 26px; align-items: start; padding-bottom: 60px; }
.sidebar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px; position: sticky; top: 84px;
}
.sidebar .group-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim);
  font-weight: 700; padding: 14px 12px 7px;
}
.side-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer;
  background: none; border: none; color: var(--muted); font-size: 14.5px; font-weight: 500;
  font-family: inherit; text-align: left; transition: .15s;
}
.side-item:hover { background: var(--surface-2); color: var(--text); }
.side-item.active { background: rgba(124, 92, 255, .14); color: #fff; font-weight: 600; }
.side-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: auto; }
.side-item .dot.off { background: var(--border-2); }

/* ---------- Formulare ---------- */
.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 7px; font-size: 14px; }
.form-row .hint, .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

input[type="text"], input[type="number"], textarea, select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 11px 13px; color: var(--text);
  font-size: 14px; font-family: inherit; transition: .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(124, 92, 255, .15);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
textarea { resize: vertical; min-height: 78px; }
select option { background: var(--surface-2); }

/* Schalter */
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-2);
  border-radius: 26px; cursor: pointer; transition: .2s;
}
.slider::before {
  content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--grad); border-color: transparent; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:disabled + .slider { opacity: .4; cursor: not-allowed; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.module-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 13px 15px;
}

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Server-Log: Ereignis + Zielkanal + Schalter pro Zeile */
.log-row {
  display: grid; grid-template-columns: 1fr 210px auto; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 14px; margin-bottom: 8px;
}
.log-row .log-name { font-size: 14px; font-weight: 600; }
.log-row .log-select { margin: 0; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 13px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--dim); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .8px; }
tbody tr { transition: .12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ---------- Badges, Pills ---------- */
.badge { display: inline-block; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge.on { background: rgba(61, 220, 151, .14); color: var(--green); }
.badge.off { background: rgba(255, 92, 108, .14); color: var(--red); }
.badge.warn { background: rgba(255, 204, 77, .14); color: var(--yellow); }
.pill {
  display: inline-block; background: var(--surface-2); border: 1px solid var(--border);
  padding: 4px 11px; border-radius: 999px; font-size: 12.5px;
  font-family: ui-monospace, 'Cascadia Code', monospace; color: var(--muted);
}
code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; color: #c4b5fd; }

.user-chip { display: flex; align-items: center; gap: 9px; }
.user-chip img { width: 30px; height: 30px; border-radius: 50%; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(150%);
  background: var(--surface-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 14px 24px; border-radius: 12px; box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.34, 1.56, .64, 1); z-index: 200; font-weight: 500;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(61, 220, 151, .5); }
.toast.err { border-color: rgba(255, 92, 108, .5); }

/* ---------- Tabs (Admin) ---------- */
.tabs { display: flex; gap: 7px; margin-bottom: 22px; flex-wrap: wrap; }
.tab {
  padding: 9px 17px; border-radius: var(--r-sm); cursor: pointer; font-weight: 600; font-size: 14px;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted); transition: .15s;
}
.tab:hover { color: var(--text); border-color: var(--border-2); }
.tab.active { background: var(--grad); color: #fff; border-color: transparent; }

/* ---------- Diverses ---------- */
.empty { text-align: center; color: var(--muted); padding: 56px 20px; }
.loading { text-align: center; color: var(--muted); padding: 46px; }
.section-title {
  font-size: 15px; font-weight: 700; margin: 24px 0 13px;
  padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.footer {
  text-align: center; color: var(--dim); font-size: 13.5px;
  padding: 44px 0; border-top: 1px solid var(--border); margin-top: 50px;
}
.flex { display: flex; align-items: center; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.mt { margin-top: 16px; }
.right { margin-left: auto; }

/* Sticky Speicher-Leiste */
.save-bar {
  position: sticky; bottom: 0; margin-top: 8px;
  background: rgba(8, 8, 13, .9); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding: 15px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}

/* Fortschrittsbalken (Level-Vorschau) */
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--grad); border-radius: 99px; }

@media (max-width: 900px) {
  .dash-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; display: flex; overflow-x: auto; gap: 6px; }
  .sidebar .group-label { display: none; }
  .side-item { white-space: nowrap; width: auto; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row-2 { grid-template-columns: 1fr; }
  /* Schmal: Name + Schalter in einer Zeile, Kanalauswahl darunter über die volle Breite */
  .log-row { grid-template-columns: 1fr auto; }
  .log-row .log-name { grid-area: 1 / 1; }
  .log-row > .switch { grid-area: 1 / 2; }
  .log-row .log-select { grid-area: 2 / 1 / 3 / 3; }
}
