/* =========================================================
   AFK Together – Themes & Feinschliff
   Wird nach allen anderen Stylesheets geladen.
   Theme: <html data-theme="..."> (purple | black | white | blue | green | red)
   ========================================================= */

:root,
html[data-theme="purple"] {
  --bg: #07070c;
  --bg-soft: #0d0d16;
  --surface-rgb: 17, 17, 28;
  --well-rgb: 6, 6, 12;
  --ink-rgb: 255, 255, 255;
  --accent-rgb: 167, 139, 250;
  --accent-strong-rgb: 139, 92, 246;
  --accent2-rgb: 59, 130, 246;
  --primary-light: #ddd6fe;
  --on-accent: #110b20;
  --text: #f6f4ff;
  --text-soft: #d7d2e5;
  --text-dim: #a5a0ba;
  --text-faint: #6d6880;
  --text-mute: #403a48;
  --danger-text: #fecdd3;
  --success-text: #bbf7d0;
  --warn-text: #fde68a;
  --info-text: #bfdbfe;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px rgba(0, 0, 0, 0.28);
  --panel: rgba(var(--surface-rgb), 0.72);

  --primary: rgb(var(--accent-rgb));
  --primary-strong: rgb(var(--accent-strong-rgb));
  --primary-soft: rgba(var(--accent-rgb), 0.12);
  --panel-strong: rgba(var(--surface-rgb), 0.94);
  --border: rgba(var(--ink-rgb), 0.08);
  --border-strong: rgba(var(--accent-rgb), 0.28);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  color-scheme: dark;
}

/* ---------- Black ---------- */
html[data-theme="black"] {
  --bg: #050505;
  --bg-soft: #0e0e0e;
  --surface-rgb: 20, 20, 20;
  --well-rgb: 8, 8, 8;
  --accent-rgb: 229, 229, 229;
  --accent-strong-rgb: 163, 163, 163;
  --accent2-rgb: 115, 115, 115;
  --primary-light: #f5f5f5;
  --on-accent: #0a0a0a;
  --text: #fafafa;
  --text-soft: #d4d4d4;
  --text-dim: #a3a3a3;
  --text-faint: #737373;
  --text-mute: #404040;
}

/* ---------- White ---------- */
html[data-theme="white"] {
  --bg: #f5f6f8;
  --bg-soft: #ffffff;
  --surface-rgb: 255, 255, 255;
  --well-rgb: 238, 240, 244;
  --ink-rgb: 15, 23, 42;
  --accent-rgb: 17, 24, 39;
  --accent-strong-rgb: 55, 65, 81;
  --accent2-rgb: 100, 116, 139;
  --primary-light: #111827;
  --on-accent: #ffffff;
  --text: #0f172a;
  --text-soft: #1e293b;
  --text-dim: #475569;
  --text-faint: #64748b;
  --text-mute: #cbd5e1;
  --danger-text: #be123c;
  --success-text: #15803d;
  --warn-text: #a16207;
  --info-text: #1d4ed8;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px rgba(15, 23, 42, 0.06);
  --panel: rgba(255, 255, 255, 0.92);
  color-scheme: light;
}

/* ---------- Blue ---------- */
html[data-theme="blue"] {
  --bg: #060a13;
  --bg-soft: #0b111e;
  --surface-rgb: 14, 21, 36;
  --well-rgb: 5, 9, 17;
  --accent-rgb: 96, 165, 250;
  --accent-strong-rgb: 37, 99, 235;
  --accent2-rgb: 56, 189, 248;
  --primary-light: #bfdbfe;
  --on-accent: #06101f;
  --text: #f1f5ff;
  --text-soft: #d3dcef;
  --text-dim: #9fb0cc;
  --text-faint: #66768f;
  --text-mute: #2c3a52;
}

/* ---------- Green ---------- */
html[data-theme="green"] {
  --bg: #050c08;
  --bg-soft: #0a140e;
  --surface-rgb: 13, 25, 18;
  --well-rgb: 4, 10, 6;
  --accent-rgb: 74, 222, 128;
  --accent-strong-rgb: 22, 163, 74;
  --accent2-rgb: 45, 212, 191;
  --primary-light: #bbf7d0;
  --on-accent: #052e16;
  --text: #f0fdf4;
  --text-soft: #d1e7d9;
  --text-dim: #9cb8a8;
  --text-faint: #648070;
  --text-mute: #2b4537;
}

/* ---------- Red ---------- */
html[data-theme="red"] {
  --bg: #0d0607;
  --bg-soft: #160a0c;
  --surface-rgb: 29, 13, 16;
  --well-rgb: 12, 5, 6;
  --accent-rgb: 248, 113, 113;
  --accent-strong-rgb: 220, 38, 38;
  --accent2-rgb: 251, 146, 60;
  --primary-light: #fecaca;
  --on-accent: #2a0606;
  --text: #fff5f5;
  --text-soft: #ecd3d5;
  --text-dim: #c4a3a6;
  --text-faint: #86686b;
  --text-mute: #4a2c30;
}

/* =========================================================
   Feinschliff (alle Themes)
   ========================================================= */

body {
  background:
    radial-gradient(1100px 520px at 12% -12%, rgba(var(--accent-rgb), 0.09), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

body::before { opacity: 0.5; }
html[data-theme="white"] body::before { display: none; }

::selection { background: rgba(var(--accent-rgb), 0.28); }

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--ink-rgb), 0.16) transparent;
}

/* Sidebar & Navigation */
.sidebar {
  background: rgba(var(--surface-rgb), 0.6);
  border-right-color: var(--border);
}

.nav-item { border: 1px solid transparent; }

.nav-item:hover {
  background: rgba(var(--ink-rgb), 0.04);
  color: var(--text);
  transform: none;
}

.nav-item.active {
  color: var(--primary-light);
  border-color: rgba(var(--accent-rgb), 0.16);
  background: rgba(var(--accent-rgb), 0.1);
}

.brand-mark {
  color: var(--on-accent);
  background: var(--primary);
  box-shadow: 0 6px 18px rgba(var(--accent-strong-rgb), 0.22);
}

.language-chip { color: var(--text); }

/* Karten */
.dashboard-panel,
.stat-card {
  border-color: var(--border);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dashboard-panel { backdrop-filter: blur(12px); }

/* Abstand zwischen untereinander liegenden Karten (z. B. Settings links) */
div:not([class]) > .dashboard-panel + .dashboard-panel { margin-top: 20px; }
.stat-card.accent::after { opacity: 0.55; }
.dashboard-topbar h1 { letter-spacing: -0.02em; }

/* Buttons: einfarbig statt Verlauf */
.btn-primary,
.panel-button,
.primary-link-button,
.primary-action {
  color: var(--on-accent);
  background: var(--primary);
  box-shadow: none;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.btn-primary:hover,
.panel-button:hover,
.primary-link-button:hover,
.primary-action:hover {
  color: var(--on-accent);
  filter: brightness(1.08);
}

/* Eingabefelder */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: rgba(var(--accent-rgb), 0.55) !important;
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15);
}

select option {
  color: var(--text);
  background: var(--bg-soft);
}

/* Minecraft-Chat bleibt immer dunkel, damit die Farbcodes lesbar sind */
#chatLog {
  --text: #ececf1;
  --text-soft: #d4d4d8;
  --text-dim: #a1a1aa;
  --text-faint: #71717a;
  --ink-rgb: 255, 255, 255;
  color: var(--text);
}

html[data-theme="white"] #chatLog {
  background: #15161b !important;
  border-color: transparent !important;
}

/* =========================================================
   Theme-Auswahl (Settings)
   ========================================================= */

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

.theme-option {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(var(--well-rgb), 0.45);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.theme-option:hover { border-color: rgba(var(--accent-rgb), 0.35); }

.theme-option[aria-checked="true"] {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1px var(--primary);
}

.theme-swatch {
  position: relative;
  height: 44px;
  overflow: hidden;
  border: 1px solid rgba(128, 128, 128, 0.25);
  border-radius: 8px;
  background: var(--sw-bg);
}

.theme-swatch::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 9px;
  width: 42%;
  height: 7px;
  border-radius: 4px;
  background: var(--sw-fg);
  opacity: 0.55;
}

.theme-swatch::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 22px;
  height: 13px;
  border-radius: 5px;
  background: var(--sw-accent);
}

.theme-option-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 2px;
}

.theme-check {
  flex: none;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text-faint);
  border-radius: 50%;
}

.theme-option[aria-checked="true"] .theme-check {
  border-color: var(--primary);
  background: radial-gradient(circle, var(--primary) 0 42%, transparent 46%);
}

@media (max-width: 640px) {
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
