/* ==========================================
   Dashboard Stylesheet (Sehr detailliert)
   ==========================================
   Diese Datei ist absichtlich stark kommentiert,
   damit man beim Lesen sofort sieht:
   - das ist der Hintergrund
   - das ist das Menü
   - das ist die Kartenoptik
   - das ist die Tabelle
*/

/* ========= 1) Design-Variablen (globale Farben/Schatten) ========= */
/* Hier werden zentrale Farbwerte hinterlegt, die später überall genutzt werden. */
:root {
  --bg: #f4efe6;
  --panel: #fffaf2cc;
  --panel-solid: #fffaf2;
  --text: #1f2529;
  --muted: #546067;
  --line: #d9cdbb;
  --accent: #c13f2b;
  --accent-2: #2d8a78;
  --shadow: 0 18px 40px rgba(19, 37, 29, 0.14);
}

/* Alle Elemente nutzen "border-box", damit Padding in Breitenberechnungen enthalten ist. */
* {
  box-sizing: border-box;
}

/* ========= 2) Seitenhintergrund ========= */
/* Das ist der komplette Seitenhintergrund inkl. radialer Verläufe. */
body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, #08a777 0%, #0840dd 40%),
    radial-gradient(circle at 100% 100%, #072721 0%, #00ff6a 92%);
  padding: 28px;
}

/* Discord-Server-Icon als leicht transparenter Hintergrund-Wasserzeichen. */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 580px;
  height: 580px;
  background-image: url('https://cdn.discordapp.com/icons/1476796641410285628/b4777990238970acf39c50f53ca2b77f.webp?size=80&quality=lossless');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.75;
  pointer-events: none;
  z-index: 0;
}

/* Universelle Utility-Klasse zum Verstecken von Elementen. */
.hidden {
  display: none !important;
}

/* ========= 3) Allgemeine Button-Basis ========= */
/* Grundstil für Menü- und Ghost-Buttons. */
.menu-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #fff8ef;
  color: var(--text);
  border: 1px solid var(--line);
}

/* Der runde "Hamburger"-Button oben links. */
.menu-btn {
  width: 52px;
  height: 52px;
  padding: 0;
  flex-direction: column;
}

/* Die drei Balken im Hamburger-Button. */
.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: #5b4730;
  border-radius: 999px;
}

/* ========= 4) Seitenmenü (links) ========= */
/* Container für das gesamte aufklappbare Seitenmenü. */
.side-menu {
  position: fixed;
  top: 18px;
  left: 18px;
  width: 280px;
  max-width: calc(100vw - 36px);
  background: #fffaf2;
  border: 1px solid #fff;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
  z-index: 20;
  transition: transform 180ms ease, opacity 180ms ease;
}

/* Ausgeblendeter Zustand des Menüs (wird per JS getoggelt). */
.side-menu.closed {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-16px);
}

/* Kopf/Fuß im Menü mit horizontaler Ausrichtung. */
.side-menu-header,
.side-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* Navigationseinträge untereinander. */
.side-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}

/* Standard-Look für jeden Navigationslink. */
.side-menu-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf8;
}

/* Hover/Fokus-Effekt auf MenülLinks. */
.side-menu-nav a:hover,
.side-menu-nav a:focus-visible {
  background: #f6ede0;
}

/* Aktiver Menüpunkt (gerade ausgewählte Ansicht). */
.side-menu-nav a.active {
  background: #f3e2cc;
  border-color: #cfad82;
  font-weight: 700;
}

/* Team-only Links bekommen gestrichelten Rand als visuelles Signal. */
.side-menu-nav a[data-team-only="true"] {
  border-style: dashed;
}

/* Footer im Menü vertikal aufbauen (Session-Text + Logout). */
.side-menu-footer {
  align-items: flex-start;
  flex-direction: column;
}

/* Stil für Session-Infotext im Menüfuß. */
.side-menu-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ========= 5) Login-Overlay ========= */
/* Vollflächiger, abgedunkelter Layer über der Seite. */
.auth-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(19, 16, 12, 0.58);
  backdrop-filter: blur(8px);
  z-index: 30;
}

/* Weiße Login-Karte in der Mitte des Overlays. */
.auth-card {
  width: min(480px, 100%);
  background: #fffaf2;
  border-radius: 18px;
  border: 1px solid #fff;
  box-shadow: var(--shadow);
  padding: 18px;
}

/* Abstand direkt unter der Login-Überschrift. */
.auth-card h2 {
  margin: 4px 0 6px;
}

/* Untertiteltext in der Login-Karte. */
.auth-subtitle {
  margin: 0 0 14px;
  color: var(--muted);
}

/* Toggle-Reihe und Action-Reihe in der Login-Karte. */
.auth-toggle,
.auth-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

/* Inaktiver Login-Tab. */
.auth-tab {
  flex: 1;
  background: #fff4e8;
  color: #94c217;
}

/* Aktiver Login-Tab (Team oder User). */
.auth-tab.active {
  background: linear-gradient(135deg, var(--accent), #ed7e57);
  color: white;
}

/* Statuszeile unten im Login-Overlay. */
.auth-status {
  margin: 0;
  font-weight: 700;
}

/* ========= 6) Dekorativer Hintergrund (Orbs) ========= */
/* Basisstil für beide Unschärfe-Kreise im Hintergrund. */
.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* Orange Orb oben rechts. */
.orb-a {
  width: 280px;
  height: 280px;
  background: #ff8b5e;
  top: -60px;
  right: 18%;
}

/* Türkiser Orb unten links. */
.orb-b {
  width: 320px;
  height: 320px;
  background: #52b7a3;
  bottom: -120px;
  left: -60px;
}

/* Topbar + Grid liegen bewusst über dem Hintergrund-Layer. */
.topbar,
.grid {
  position: relative;
  z-index: 1;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.analytics-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
  padding: 12px;
}

.analytics-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

@media (max-width: 1100px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

/* ========= 7) Topbar (Titel + Controls) ========= */
/* Oberer Bereich mit Menübutton, Titel und rechter Steuerung. */
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
}

/* Kleine Großbuchstaben-Zeile über Überschriften (z. B. ELITE DEV). */
.eyebrow {
  margin: 0;
  color: var(--accent);
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 700;
}

/* Hauptüberschrift der Seite. */
h1 {
  margin: 4px 0;
  font-size: clamp(24px, 3vw, 42px);
  line-height: 1.05;
}

/* Unterzeile unter dem Haupttitel. */
.subtitle {
  margin: 0;
  color: var(--muted);
}

/* Rechter Steuerbereich (Guild-ID + Refresh). */
.controls {
  display: flex;
  gap: 10px;
  align-items: end;
}

/* Label-Layout für Inputs. */
label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}

/* Gemeinsame Form-Stile: Eingaben, Selects und Buttons. */
input,
select,
button {
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

/* Primärer Button-Look im Dashboard. */
button {
  background: linear-gradient(135deg, var(--accent), #02b7ff);
  border: none;
  color: white;
  cursor: pointer;
  font-weight: 700;
}

/* Leichter Hover-Effekt auf Buttons. */
button:hover {
  filter: brightness(1.04);
}

/* Sichtbarer Fokus-Ring für Tastaturbedienung (Accessibility). */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #2d8a78;
  outline-offset: 2px;
}

/* ========= 8) Grid + Panels ========= */
/* 12-Spalten-Raster als Grundlayout für alle Karten. */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

/* Standard-Kachel (Panel): Glas-Look mit Rand und Schatten. */
.panel {
  grid-column: span 6;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border: 1px solid #fff;
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 14px;
  animation: rise 450ms ease both;
  position: relative;
  overflow: hidden;
}

/* Schmale vertikale Farbleiste links am Panelrand. */
.panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 5px;
  background: #d6b381;
}

/* Breites Panel über volle Zeile. */
.panel.wide {
  grid-column: span 12;
}

/* H2 innerhalb eines Panels. */
.panel h2 {
  margin: 0;
  font-size: 18px;
}

/* Kopfzeile innerhalb eines Panels (Titel links, Badge rechts). */
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* Kleine technische Zusatzzeile über Paneltitel. */
.section-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  font-weight: 700;
}

/* Rechte Badge in jeder Panel-Kopfzeile. */
.section-badge {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  background: #f0dcc0;
  color: #7b4f1d;
}

/* Farbakzente je Panel-Typ (Leiste + Badge). */
.panel-overview::before { background: #2d8a78; }
.panel-overview .section-badge { background: #d7efe9; color: #1d6e5f; }
.panel-invites::before { background: #c13f2b; }
.panel-invites .section-badge { background: #f6d2ca; color: #9f2e1e; }
.panel-levels::before { background: #ffbb00; }
.panel-levels .section-badge { background: #f4e6b7; color: #ffa600; }
.panel-team::before { background: #6246a6; }
.panel-team .section-badge { background: #e2daf7; color: #563694; }
.panel-links::before { background: #1b76ad; }
.panel-links .section-badge { background: #d7eaf6; color: #155d87; }
.panel-giveaways::before { background: #ff0095; }
.panel-giveaways .section-badge { background: #f5dccd; color: #f308f3; }

/* ========= 9) Übersichtskarten ========= */
/* 4er-Raster für Kennzahlen in der Übersicht. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

/* Einzelne KPI-Karte. */
.stat-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff9ef;
}

/* Jede Karte bekommt eine leicht andere Hintergrundfarbe. */
.stat-card:nth-child(1) { background: #3d1c5c; }
.stat-card:nth-child(2) { background: #089c5e7a; }
.stat-card:nth-child(3) { background: #021529; }
.stat-card:nth-child(4) { background: #3f1d1d; }

/* Kleine Beschriftung in der KPI-Karte. */
.stat-card span {
  font-size: 12px;
  color: var(--muted);
}

/* Große Zahl in der KPI-Karte. */
.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

/* Statuszeile unter den KPI-Karten. */
.status {
  margin: 12px 0 0;
  color: var(--accent-2);
  font-weight: 700;
}

/* ========= 10) Tabellen ========= */
/* Scrollbarer Tabellencontainer mit Rahmen. */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

/* Tabelle nimmt volle Breite ein. */
table {
  width: 100%;
  border-collapse: collapse;
}

/* Grundstil für Tabellenzellen und Kopfzellen. */
th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

/* Sticky Tabellenkopf (bleibt oben beim Scrollen sichtbar). */
th {
  position: sticky;
  top: 0;
  background: #fdf7ec;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Inline-Controls für Select + Button in Team-Kacheln. */
.inline-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Select in Inline-Controls soll den verfügbaren Platz füllen. */
.inline-controls select {
  flex: 1;
  min-height: 46px;
  font-weight: 600;
  background: #fffdf8;
  border: 1px solid #d9cdbb;
}

.inline-controls input {
  flex: 1;
  min-height: 46px;
  background: #fffdf8;
  border: 1px solid #d9cdbb;
}

/* Eigener Dropdown-Pfeil für Select-Felder. */
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #7a6448 50%), linear-gradient(135deg, #7a6448 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* Lange Inhalte in Zellen werden abgeschnitten statt Layout zu sprengen. */
td {
  max-width: 320px;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* ========= 11) Detailkarten / Team-Tools ========= */
/* Codebox (wenn im UI verwendet). */
.codebox {
  margin: 10px 0 0;
  background: #181d20;
  color: #d8f0eb;
  padding: 10px;
  border-radius: 10px;
  min-height: 160px;
  overflow: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

/* Container für User-Detaildaten. */
.detail-card {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff9ef;
  padding: 12px;
}

/* Leerer Zustand in Detailkarten. */
.detail-card.empty {
  background: #fffdf8;
  color: var(--muted);
}

/* Text im leeren Zustand. */
.detail-card.empty p {
  margin: 0;
  font-weight: 600;
}

/* Kopfbereich der Detailkarte (Titel + Badge). */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

/* Titel in Detailkarten. */
.detail-header h3 {
  margin: 0;
  font-size: 16px;
}

/* Runde kleine Info-Badge (z. B. "Level 12"). */
.pill {
  background: #f1d3b0;
  color: #6a3f1a;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
}

/* 2-spaltiges Raster für Key-Value Infos. */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* Einzelnes Key-Value Feld. */
.kv-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px;
  background: #fffdf8;
}

/* Labeltext in KV-Feldern. */
.kv-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

/* Werttext in KV-Feldern. */
.kv-item strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

/* Container für Untertabelle in Detailkarten. */
.subtable-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: auto;
}

/* ========= 12) Moderations-Log Bereich ========= */
/* Buttonleiste für Log-Filter (alle/invite/role/message/ban). */
.log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

/* Einzelner Filter-Button (inaktiv). */
.log-filter-btn {
  background: #fff4e8;
  color: #704322;
  border: 1px solid var(--line);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

/* Aktiver Filter-Button. */
.log-filter-btn.active {
  background: linear-gradient(135deg, var(--accent), #ed7e57);
  color: #fff;
  border-color: transparent;
}

/* Farbliche Markierung je Log-Typ. */
.log-row-invite td {
  background: #eaf7ef;
}

.log-row-ban td {
  background: #fae7e5;
}

.log-row-role td {
  background: #fff1e3;
}

.log-row-message td {
  background: #e8f3fb;
}

/* ========= 13) Giveaway-Team-Aktionen ========= */
/* Container mit Info + Buttons im Giveaway-Bereich. */
.giveaway-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff8ef;
}

/* Text: wie viele Giveaways ausgewählt wurden. */
.giveaway-bulk-info {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

/* Primärer Danger-Button (Löschen). */
.danger-btn {
  background: linear-gradient(135deg, #b33027, #df5e42);
}

/* Zweiter Danger-Button (Reset-ID), etwas dunkler. */
.danger-btn.secondary {
  background: linear-gradient(135deg, #8f2a23, #c44b3c);
}

/* Buttongruppe rechts im Bulk-Aktionsbereich. */
.giveaway-bulk-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Deaktivierter Buttonzustand (grauer/unklickbar). */
.danger-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: none;
}

/* Abgeschlossene Giveaways werden ausgegraut dargestellt. */
.giveaway-finished td {
  opacity: 0.5;
}

/* Letzte Spalte bei ausgegrauten Zeilen bleibt besser lesbar. */
.giveaway-finished td:last-child {
  opacity: 1;
}

/* Standard-Linkfarbe im Dashboard. */
a {
  color: var(--accent-2);
}

/* ========= 14) Animation ========= */
/* Leichter Einblend-Effekt beim Laden von Panels. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========= 15) Responsive (Tablet/Mobile) ========= */
/* Unter 980px wird das Layout auf eine mobile Darstellung umgebaut. */
@media (max-width: 980px) {
  /* Weniger Seitenabstand auf kleinen Screens. */
  body {
    padding: 14px;
  }

  /* Topbar untereinander statt nebeneinander. */
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  /* Controls ebenfalls untereinander. */
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  /* Login-Buttons/Actions untereinander. */
  .auth-toggle,
  .auth-actions {
    flex-direction: column;
  }

  /* Alle Panels nehmen volle Breite ein. */
  .panel,
  .panel.wide {
    grid-column: span 12;
  }

  /* KPI-Raster von 4 auf 2 Spalten reduzieren. */
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Key-Value Raster auf 1 Spalte reduzieren. */
  .kv-grid {
    grid-template-columns: 1fr;
  }

  /* Giveaway-Aktionsleiste untereinander stapeln. */
  .giveaway-bulk-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
