/* ─────────────────────────────────────────────────────────────
   WhazzaStream – Design-System (Tokens, Basis, Komponenten)
   Theme: html.dark / body.dark (Standard: dark)
   ───────────────────────────────────────────────────────────── */

:root {
  --bg:          #f4f4f7;
  --bg-elev:     #ffffff;
  --surface:     #ffffff;
  --surface-2:   #f1f1f5;
  --surface-3:   #e7e7ee;
  --border:      rgba(16, 16, 32, .09);
  --border-strong: rgba(16, 16, 32, .16);
  --text:        #15151d;
  --text-2:      #4a4a5a;
  --muted:       #7a7a8c;

  --accent:      #8b5cf6;
  --accent-hover:#7c3aed;
  --accent-soft: rgba(139, 92, 246, .12);
  --accent-text: #ffffff;

  --danger:      #ef4444;
  --danger-soft: rgba(239, 68, 68, .12);
  --success:     #22c55e;
  --warning:     #f59e0b;
  --live:        #ef4444;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(16, 16, 32, .06);
  --shadow:    0 8px 24px rgba(16, 16, 32, .08);
  --shadow-lg: 0 24px 64px rgba(16, 16, 32, .18);

  --topbar-h: 60px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --smilie-bg:   var(--surface-2);
  --smilie-text: var(--text);
  color-scheme: light;
}

html.dark,
body.dark {
  --bg:          #0c0c12;
  --bg-elev:     #12121a;
  --surface:     #15151e;
  --surface-2:   #1c1c27;
  --surface-3:   #262633;
  --border:      rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .13);
  --text:        #ececf2;
  --text-2:      #b4b4c3;
  --muted:       #7d7d90;

  --accent-soft: rgba(139, 92, 246, .18);
  --danger-soft: rgba(239, 68, 68, .16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow:    0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

svg.icon { width: 18px; height: 18px; flex: none; }

/* ── Topbar ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--bg-elev) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #a78bfa, #7c3aed 60%, #db2777);
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, .35);
}
.brand-mark svg { width: 16px; height: 16px; }
.brand span b { color: var(--accent); font-weight: 700; }

.brand-tag {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .15rem .5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .75rem .3rem .35rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: .85rem;
  color: var(--text);
}

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  text-transform: uppercase;
  flex: none;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn,
.btn-primary,
.btn-danger,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  height: 38px;
  padding: 0 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .875rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active,
.btn-primary:active,
.btn-danger:active,
.btn-ghost:active { transform: translateY(1px); }

.btn,
.btn-ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}
.btn:hover,
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-text); }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font: inherit;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent); }

/* Theme-Toggle: Icon je nach Theme */
#toggle-theme .i-moon { display: none; }
html.dark #toggle-theme .i-sun { display: none; }
html.dark #toggle-theme .i-moon { display: block; }

/* ── Formulare ──────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  height: 40px;
  padding: 0 .85rem;
  font: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { height: auto; padding: .7rem .85rem; resize: vertical; }

input::placeholder,
textarea::placeholder { color: var(--muted); }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

input[type="color"] {
  width: 40px; height: 40px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }

input[type="checkbox"],
input[type="radio"] { accent-color: var(--accent); }

.field-label,
.form-grid > label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
}

/* Segmented Sprachumschalter */
.lang-switch-radio,
.lang-switch {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.lang-switch-radio input[type="radio"] { display: none; }
.lang-switch-radio label,
.lang-switch a {
  padding: .25rem .6rem;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-switch-radio label:hover,
.lang-switch a:hover { color: var(--text); }
.lang-switch-radio input[type="radio"]:checked + label,
.lang-switch a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── Status ─────────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  font-size: 0;
  flex: none;
  background: var(--muted);
}
.status-dot.online  { background: var(--success); box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.status-dot.offline { background: var(--muted); }

/* ── Popover / Dialog ───────────────────────────────────── */
.panel-popup {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  width: min(92vw, 420px);
  max-height: 82vh;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--text);
  animation: pop-in .16s ease-out;
}
.panel-popup h3 { font-size: 1.05rem; margin-bottom: 1rem; padding-right: 2.5rem; }

@keyframes pop-in {
  from { opacity: 0; transform: translate(-50%, -48%) scale(.98); }
  to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.btn-close {
  position: absolute;
  top: .9rem; right: .9rem;
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  z-index: 2;
}
.btn-close:hover { background: var(--surface-2); color: var(--text); }

/* ── Scrollbars ─────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
