/* ============================================================
   🎨 Bot Dashboard – Dark Theme (Discord-inspiriert)
   Variablen, Layout (Sidebar/Topbar), Karten, Formulare,
   Toggles, Embed-Vorschau, Toasts, Animationen, Responsive.
   ============================================================ */

:root {
  --bg-0: #1e1f22;      /* dunkelster Hintergrund (Sidebar) */
  --bg-1: #2b2d31;      /* Seiten-Hintergrund */
  --bg-2: #313338;      /* Karten */
  --bg-3: #383a40;      /* Inputs, Hover */
  --bg-4: #404249;      /* aktive Elemente */
  --text-0: #f2f3f5;
  --text-1: #b5bac1;
  --text-2: #80848e;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #23a55a;
  --red: #f23f43;
  --yellow: #f0b232;
  --border: #3f4147;
  --radius: 10px;
  --shadow: 0 8px 24px rgba(0, 0, 0, .35);
  --font: 'gg sans', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

html { color-scheme: dark; }

body {
  font-family: var(--font);
  background: var(--bg-1);
  color: var(--text-0);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
.accent { color: var(--accent); }
.muted { color: var(--text-1); font-size: .92rem; }
.hide-mobile { display: inline; }
.show-mobile { display: none !important; }

/* ---------- Animationen ---------- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn .35s ease both; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border: none; border-radius: 8px;
  font-size: .95rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background .15s, transform .1s, box-shadow .15s;
  color: var(--text-0); background: var(--bg-3);
}
.btn:hover { background: var(--bg-4); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #d83c3e; }
.btn-success { background: var(--green); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-1); }
.btn-ghost:hover { background: var(--bg-3); color: var(--text-0); }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; box-shadow: 0 6px 20px rgba(88, 101, 242, .45); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Landing ---------- */
.landing { display: flex; align-items: center; justify-content: center; padding: 24px; }
.landing-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(600px circle at 15% 20%, rgba(88, 101, 242, .25), transparent 60%),
    radial-gradient(700px circle at 85% 80%, rgba(35, 165, 90, .12), transparent 60%),
    var(--bg-0);
}
.landing-card {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 16px;
  padding: 48px 44px; max-width: 520px; width: 100%; text-align: center;
  box-shadow: var(--shadow);
}
.landing-logo { font-size: 4rem; margin-bottom: 12px; }
.landing-card h1 { font-size: 2.2rem; margin-bottom: 12px; }
.landing-sub { color: var(--text-1); margin-bottom: 24px; }
.landing-status {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 28px;
  background: var(--bg-3); padding: 8px 16px; border-radius: 999px; font-size: .9rem;
}

/* ---------- Status-Punkt ---------- */
.status-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.status-dot.online { background: var(--green); box-shadow: 0 0 8px rgba(35, 165, 90, .8); }
.status-dot.offline { background: var(--red); }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text-0); font-size: 1.05rem; }
.topbar-spacer { flex: 1; }
.topbar-status { display: flex; align-items: center; gap: 8px; color: var(--text-1); font-size: .9rem; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar h2 { font-size: 1.1rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; }

/* ---------- User-Banner ---------- */
.user-banner { height: 120px; background-size: cover; background-position: center; opacity: .9; }

/* ---------- Container & Karten ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { font-size: 1.6rem; margin-bottom: 4px; }

.card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

/* ---------- Suche ---------- */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 14px; margin-bottom: 24px;
}
.searchbar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-0); font-size: 1rem; font-family: inherit;
}

/* ---------- Server-Grid ---------- */
.guild-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.guild-card { display: flex; flex-direction: column; gap: 16px; animation: fadeIn .3s ease both; }
.guild-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }
.guild-card-head { display: flex; align-items: center; gap: 14px; }
.guild-card-meta h3 { font-size: 1.05rem; margin-bottom: 4px; word-break: break-word; }
.guild-icon { width: 56px; height: 56px; border-radius: 16px; flex: none; }
.guild-icon.sm { width: 40px; height: 40px; border-radius: 12px; }
.guild-icon-placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; }
.badge-gold { background: rgba(240, 178, 50, .15); color: var(--yellow); }
.badge-blue { background: rgba(88, 101, 242, .15); color: #8f9aff; }
.badge-green { background: rgba(35, 165, 90, .15); color: #4ade80; }
.badge-red { background: rgba(242, 63, 67, .15); color: #ff7a7d; }
.empty-state { grid-column: 1/-1; text-align: center; padding: 48px; }

/* ============================================================
   Dashboard-Layout (Sidebar + Main)
   ============================================================ */
.dash { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; flex: none; background: var(--bg-0);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 50;
}
.sidebar-head {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border-bottom: 1px solid var(--border); color: var(--text-0);
}
.sidebar-head:hover { background: var(--bg-1); }
.sidebar-head-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.sidebar-head-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-search { padding: 12px 14px 4px; }
.sidebar-search input {
  width: 100%; background: var(--bg-1); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; color: var(--text-0); font-family: inherit; outline: none;
}
.sidebar-search input:focus { border-color: var(--accent); }
.sidebar-nav { padding: 10px 8px 24px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { padding: 12px 10px 4px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px; color: var(--text-1);
  cursor: pointer; font-weight: 500; border: none; background: none;
  font-family: inherit; font-size: .95rem; text-align: left; width: 100%;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--bg-2); color: var(--text-0); }
.nav-item.active { background: var(--bg-3); color: var(--text-0); }
.nav-item .nav-icon { width: 22px; text-align: center; flex: none; }
.nav-item .nav-state { margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); }
.nav-item .nav-state.on { background: var(--green); }
.sidebar-backdrop { display: none; }

.dash-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-content { padding: 26px 30px 80px; max-width: 980px; width: 100%; }
.dash-content > * { animation: fadeIn .3s ease both; }

/* ---------- Lade-Zustand ---------- */
.loading-state { text-align: center; padding: 80px 0; color: var(--text-1); }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 4px solid var(--bg-3); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}

/* ---------- Modul-Kopf ---------- */
.module-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.module-head h1 { font-size: 1.5rem; display: flex; align-items: center; gap: 10px; }
.module-head p { color: var(--text-1); }

/* ---------- Formulare ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1/-1; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-1); }
.field .hint { font-size: .8rem; color: var(--text-2); }

input[type="text"], input[type="number"], input[type="url"], textarea, select {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-0); padding: 10px 12px; font-size: .95rem; font-family: inherit;
  outline: none; width: 100%; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 90px; resize: vertical; }

input[type="color"] {
  width: 46px; height: 38px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-0); cursor: pointer; padding: 3px;
}
.color-row { display: flex; gap: 10px; align-items: center; }

/* ---------- Toggle-Switch ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--bg-4); transition: background .18s; cursor: pointer;
}
.switch .slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .18s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .toggle-label strong { display: block; }
.toggle-row .toggle-label span { font-size: .85rem; color: var(--text-1); }

/* ---------- Sektionen in Modulen ---------- */
.section { margin-bottom: 22px; }
.section h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text-0); display: flex; align-items: center; gap: 8px; }
.save-bar {
  position: sticky; bottom: 16px; display: flex; justify-content: flex-end; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow); margin-top: 20px;
}

/* ---------- Tag-Eingabe (Wortlisten, Whitelist) ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; background: var(--bg-0); border: 1px solid var(--border); border-radius: 8px; }
.tags .tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-3); border-radius: 6px; padding: 3px 8px; font-size: .88rem;
}
.tags .tag button { background: none; border: none; color: var(--text-1); cursor: pointer; font-size: 1rem; line-height: 1; }
.tags .tag button:hover { color: var(--red); }
.tags input { flex: 1; min-width: 140px; border: none !important; background: transparent !important; padding: 4px !important; }

/* ---------- Repeater (Listen-Editoren) ---------- */
.repeater { display: flex; flex-direction: column; gap: 12px; }
.repeater-item { background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; padding: 14px; animation: fadeIn .25s ease both; }
.repeater-item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.repeater-item-head strong { color: var(--text-1); font-size: .85rem; }

/* ---------- Embed-Vorschau (Discord-Stil) ---------- */
.embed-preview-wrap { background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.embed-preview-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.discord-msg { display: flex; gap: 12px; }
.discord-msg .avatar { width: 40px; height: 40px; }
.discord-msg-body { min-width: 0; flex: 1; }
.discord-msg-author { font-weight: 600; margin-bottom: 2px; }
.discord-msg-author .bot-tag {
  background: var(--accent); color: #fff; font-size: .62rem; font-weight: 700;
  padding: 1px 5px; border-radius: 4px; margin-left: 6px; vertical-align: 2px;
}
.discord-msg-content { white-space: pre-wrap; word-break: break-word; margin-bottom: 6px; }
.discord-embed {
  background: var(--bg-0); border-left: 4px solid var(--accent);
  border-radius: 5px; padding: 12px 14px; max-width: 480px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 14px;
}
.discord-embed .e-author { grid-column: 1/-1; font-size: .85rem; font-weight: 600; }
.discord-embed .e-title { font-weight: 700; grid-column: 1; }
.discord-embed .e-desc { grid-column: 1; font-size: .92rem; color: var(--text-1); white-space: pre-wrap; word-break: break-word; }
.discord-embed .e-thumb { grid-column: 2; grid-row: 1 / span 3; width: 72px; height: 72px; border-radius: 6px; object-fit: cover; }
.discord-embed .e-image { grid-column: 1/-1; max-width: 100%; border-radius: 6px; margin-top: 8px; }
.discord-embed .e-footer { grid-column: 1/-1; font-size: .75rem; color: var(--text-2); margin-top: 6px; }
.discord-embed .e-fields { grid-column: 1/-1; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-top: 6px; }
.discord-embed .e-field-name { font-weight: 700; font-size: .85rem; }
.discord-embed .e-field-value { font-size: .85rem; color: var(--text-1); }

/* ---------- Statistik-Karten (Übersicht) ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-card .stat-icon { font-size: 1.8rem; }
.stat-card .stat-value { font-size: 1.3rem; font-weight: 700; }
.stat-card .stat-label { font-size: .82rem; color: var(--text-1); }

/* ---------- Tabelle (Bestenliste) ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { font-size: .78rem; text-transform: uppercase; color: var(--text-2); }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--bg-2); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 8px; padding: 12px 18px; min-width: 260px; max-width: 380px;
  box-shadow: var(--shadow); animation: slideIn .25s ease both;
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hide-mobile { display: none; }
  .show-mobile { display: inline-flex !important; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: none; }
  .sidebar-backdrop.open {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 45;
  }
  .dash-content { padding: 18px 14px 80px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
}
