/* ==== Grundlagen: Farben, Schrift, Knöpfe, Eingaben (gelten für alle Panels) ==== */
:root {
  color-scheme: dark;
  --bg: #0b0d12; /* Hintergrund der Bühne */
  --surface: #11141b; /* Seitenleiste und Chat-Spalte */
  --panel: #171b24; /* Karten */
  --panel-2: #1e2330; /* Eingabefelder, Hover */
  --line: #272d3b;
  --line-soft: #1b202b;
  --text: #eef1f7;
  --muted: #8d97a9;
  --faint: #5f687a;
  --accent: #7c6cff;
  --accent-2: #22d3ee;
  --accent-soft: rgb(124 108 255 / 0.16);
  --brand: linear-gradient(135deg, #8b5cf6 0%, #6366f1 55%, #22d3ee 100%);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
  --radius-s: 10px;
  --shadow: 0 16px 40px rgb(0 0 0 / 0.45);
  --font: 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

/* Kleine Überschrift über Bereichen */
h2 {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon {
  flex: none;
  width: 18px;
  height: 18px;
}

/* ---- Knöpfe ---- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 0;
  border-radius: var(--radius-s);
  cursor: pointer;
  transition: filter 0.15s, background-color 0.15s, transform 0.08s;
}
button:hover {
  filter: brightness(1.12);
}
button:active {
  transform: translateY(1px);
}
button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
  filter: none;
  transform: none;
}
button.secondary {
  color: var(--text);
  background: var(--panel-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
button.secondary:hover {
  background: #262c3b;
  filter: none;
}
button.danger {
  background: #e5484d;
}
button.ghost {
  padding: 8px 10px;
  font-weight: 500;
  color: var(--muted);
  background: none;
}
button.ghost:hover {
  color: var(--text);
  background: var(--panel-2);
  filter: none;
}
button.link {
  padding: 0;
  font-weight: 500;
  color: var(--muted);
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link:hover {
  color: var(--text);
  filter: none;
}

/* ---- Eingaben ---- */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  padding: 9px 12px;
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[type='checkbox'],
input[type='radio'] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}
input[type='range'] {
  padding: 0;
  height: 18px;
  accent-color: var(--accent);
  background: none;
  border: 0;
  box-shadow: none;
}

.error {
  padding: 10px 12px;
  color: #fecaca;
  background: rgb(248 113 113 / 0.12);
  border: 1px solid rgb(248 113 113 / 0.3);
  border-radius: var(--radius-s);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-2);
  border-radius: 999px;
}

/* Schmale Bildlaufleisten im dunklen Stil */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #2a3040;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-track {
  background: none;
}

/* ==== Seitenaufbau: Seitenleiste | Bühne | Chat ==== */
.app {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr) 340px;
  grid-template-areas: 'side main chat';
  height: 100vh;
}

.sidebar {
  grid-area: side;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 18px 16px 12px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line-soft);
}

.stage-column {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 14px 20px 18px;
}

.chat-column {
  grid-area: chat;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line-soft);
}

/* ---- Marke (Logo + Name + Verbindungsstatus) ---- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px;
}
.brand-logo {
  flex: none;
  filter: drop-shadow(0 6px 14px rgb(99 102 241 / 0.35));
}
.wordmark {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.wordmark span {
  margin-left: 0.14em; /* „kowa talk“, nicht „kowatalk“ */
  font-weight: 600;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Verbindungsstatus mit Punkt davor */
.status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--muted);
}
.status::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.status[data-state='verbunden'] {
  color: var(--good);
}
.status[data-state='verbunden']::before {
  background: var(--good);
  box-shadow: 0 0 0 3px rgb(52 211 153 / 0.18);
}
.status[data-state='verbinde'],
.status[data-state='getrennt'] {
  color: var(--warn);
}
.status[data-state='verbinde']::before,
.status[data-state='getrennt']::before {
  background: var(--warn);
}
.status[data-state='abgelehnt'],
.status[data-state='ersetzt'],
.status[data-state='gesperrt'] {
  color: var(--bad);
}
.status[data-state='abgelehnt']::before,
.status[data-state='ersetzt']::before,
.status[data-state='gesperrt']::before {
  background: var(--bad);
}

/* ---- Karten (Panels) ---- */
.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.panel:empty {
  display: none;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

/* Hinweis „Update bereit“ (update-banner.ts) */
.update {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 10px;
  padding: 12px;
  font-size: 13px;
  background: var(--accent-soft);
  border: 1px solid rgb(124 108 255 / 0.35);
  border-radius: var(--radius-s);
}
.update small {
  margin-top: -4px;
  color: var(--muted);
}

/* ---- Kopfzeile über der Bühne ---- */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 40px;
}
.topbar-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

/* ==== Erster Start: Begrüßung ==== */
.setup {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(60% 50% at 20% 10%, rgb(139 92 246 / 0.22), transparent 70%),
    radial-gradient(50% 45% at 85% 90%, rgb(34 211 238 / 0.16), transparent 70%),
    rgb(8 10 14 / 0.94);
  backdrop-filter: blur(6px);
}
.setup-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(440px, 100%);
  padding: 32px 28px 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.setup-logo {
  align-self: center;
  filter: drop-shadow(0 10px 24px rgb(99 102 241 / 0.45));
}
.setup-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  text-transform: none;
  color: var(--text);
}
.setup-title .wordmark {
  font-size: inherit;
}
.setup-lead {
  margin-bottom: 6px;
  text-align: center;
  color: var(--muted);
}
.setup .actions button[type='submit'] {
  flex: 1;
  padding: 11px 16px;
}
.setup-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.setup small {
  font-size: 12px;
  color: var(--faint);
}
/* Umschalter „Anmelden | Einladungscode“ */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--panel-2);
  border-radius: var(--radius-s);
}
.segmented button {
  padding: 7px 10px;
  font-weight: 600;
  color: var(--muted);
  background: none;
}
.segmented button[aria-pressed='true'] {
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 1px 0 var(--line);
}
.setup-server summary {
  font-size: 13px;
  color: var(--faint);
  cursor: pointer;
}
.setup-server label {
  margin-top: 8px;
}
/* Nur in der Windows-App (Serveradresse, App-Schalter) bzw. nur in der Web-Version (Download-Link) */
[data-platform='web'] [data-only='app'],
[data-platform='app'] [data-only='web'] {
  display: none !important;
}
.setup-download {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 14px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}
.setup-download a {
  font-weight: 600;
  color: var(--accent-2);
}

/* ==== Einstellungen: Konto, Mitglieder, App ==== */
.settings-card {
  width: min(560px, 100%);
}
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.settings-hint {
  font-size: 13px;
  color: var(--muted);
}
.settings-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.settings-row .settings-hint {
  grid-column: 1 / -1;
}
.invite {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 14px;
  background: var(--accent-soft);
  border: 1px solid rgb(124 108 255 / 0.35);
  border-radius: var(--radius-s);
}
.invite-title {
  font-weight: 600;
}
.invite-code {
  font: 600 22px/1.2 ui-monospace, 'Cascadia Mono', Consolas, monospace;
  letter-spacing: 0.08em;
  user-select: all;
}
.members {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.member {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel-2);
  border-radius: var(--radius-s);
}
.member.blocked .member-name {
  color: var(--muted);
}
.member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.member-info small {
  font-size: 12px;
  color: var(--faint);
}
.member-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.member-actions {
  display: flex;
  gap: 4px;
}
.member-actions button {
  padding: 6px 10px;
  font-size: 13px;
}
.tag-bad {
  color: #fecaca;
  background: rgb(248 113 113 / 0.18);
}

/* Unsichtbare Textbox, nur zum Kopieren in die Zwischenablage (clipboard.ts) */
.clip-helper {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ==== Mittelgroße Fenster: Chat unter die Bühne ==== */
@media (max-width: 1099px) {
  .app {
    grid-template-columns: 264px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(220px, 34vh);
    grid-template-areas:
      'side main'
      'side chat';
  }
  .chat-column {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }
}

/* ==== Schmale Fenster: alles untereinander ==== */
@media (max-width: 759px) {
  .app {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }
  .sidebar {
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line-soft);
  }
  .stage-column {
    padding: 12px 14px 16px;
  }
  .chat-column {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
  }
  .sidebar-footer {
    margin-top: 0;
  }
}
