/* ====== Radio-station light/dark theme CSS ====== */

/* Font import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

:root {
  /* Light defaults (overruled in dark via [data-theme="dark"]) */
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-2: #f3f4f6;
  --muted: #64748b;
  --text: #0f172a;
  --accent: #2563eb; /* blauw */
  --accent-2: #60a5fa;
  --border: #e5e7eb;
  --bubble: #f8fafc;
  --bubble-me: #dbeafe;
  --shadow: 0 6px 18px rgba(0,0,0,.08);
  --radius: 14px;
  --radius-sm: 10px;
  --transition: .25s cubic-bezier(.4,.2,.2,1);
  --header-gradient: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  --code-bg: rgba(15,23,42,0.04);
  --live-dot: #ef4444;
  --live-dot-glow: rgba(239,68,68,.7);

  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light dark;
}

/* Dark mode overrides */
[data-theme="dark"] {
  --bg: #0a101f;
  --panel: #141d37;
  --panel-2: #0f1f3f;
  --muted: #8fa3b1;
  --text: #ffffff;
  --accent: #1f8f4c; /* groen */
  --accent-2: #2ac47d;
  --border: rgba(255,255,255,0.08);
  --bubble: #1f2f55;
  --bubble-me: #274690;
  --shadow: 0 16px 40px -8px rgba(255,255,255,0.04);
  --radius: 14px;
  --radius-sm: 10px;
  --header-gradient: linear-gradient(135deg, #1f8f4c 0%, #2ac47d 100%);
  --code-bg: rgba(255,255,255,0.03);
  --live-dot: #4ade80;
  --live-dot-glow: rgba(74,222,128,.7);
}

/* Reset + base */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden; }
body { transition: background var(--transition), color var(--transition); }
h1 { font-size: 1.2rem; margin: 0; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.muted { opacity: .7; }
.small { font-size: .9em; }
.status { font-size: .9rem; }
.spacer { flex: 1; }

/* Layout */
.app { max-width: 1240px; margin: 0 auto; padding: 16px; min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.app-grid { display: grid; grid-template-columns: minmax(0,1fr) 360px; grid-gap: 16px; align-items: stretch; }
.app-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--header-gradient);
  border-radius: var(--radius);
  color: white;
  position: relative;
  box-shadow: inset 0 -4px 16px rgba(0,0,0,.25);
}
.app-header h1 { margin: 0; font-family: 'Inter', sans-serif; }

/* Buttons & controls */
.ghost {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: var(--shadow);
  font-family: inherit;
  transition: filter var(--transition);
}
.ghost:hover { filter: brightness(1.05); }
.ghost.small { padding: 4px 8px; box-shadow: none; }

/* Sidebar */
.stats-sidebar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  height: calc(100vh - 24px);
  position: sticky;
  top: 12px;
  display: block;
  box-shadow: var(--shadow);
}
.stats-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.stats-header .spacer { flex: 1; }
.stats { display: grid; gap: 12px; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }

/* Chat column */
.chat-col { grid-column: 1 / 2; display: flex; flex-direction: column; gap: 12px; align-items: center; min-height: 0; }
.player-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  width: min(980px,100%);
  box-shadow: var(--shadow);
}
.player-bar audio { width: 100%; }
.player-meta { display:flex; align-items:center; gap:8px; font-size:.95rem; flex-wrap:wrap; }
.player-meta .sep { opacity:.6; }
.live-dot {
  width:10px;
  height:10px;
  border-radius:50%;
  background: var(--live-dot);
  position: relative;
  box-shadow: 0 0 0 0 var(--live-dot-glow);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--live-dot-glow); }
  70% { box-shadow: 0 0 0 8px rgba(0,0,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,0,0,0); }
}

/* Chat window */
.chat-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  height: clamp(560px,70vh,860px);
  width: min(980px,100%);
  box-shadow: var(--shadow);
}
.messages {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.messages::-webkit-scrollbar { width: 10px; }
.messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 10px; }
.messages li {
  margin: 10px 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--bubble);
  border: 1px solid var(--border);
  max-width: 75%;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.messages li.me {
  background: var(--bubble-me);
  border-color: #274690;
  margin-left: auto;
}
.messages li .meta { font-size: .75rem; opacity: .7; }
.messages li .text { margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.typing { font-size: .85rem; opacity: .8; margin: 0 6px; min-height: 1.2em; }

/* Composer */
.composer {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 6px;
  background: linear-gradient(180deg, transparent, var(--panel));
  border-top: 1px solid var(--border);
}
.composer input {
  flex: 1;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.15);
  font-family: inherit;
}
.send-btn {
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: white;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(37,99,235,.35);
  transition: filter var(--transition);
}
.send-btn:hover { filter: brightness(1.05); }

/* Emoji */
.emoji-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.15);
}
.emoji-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(8,1fr);
  gap: 6px;
  width: 320px;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: var(--shadow);
  z-index: 1000;
}
.emoji {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}
.emoji:hover { background: rgba(0,0,0,.05); }

/* Bars */
.bar {
  height: 18px;
  background: var(--bubble);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: relative;
}
.bar > span {
  position: absolute;
  inset: 0;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}
.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  opacity: .9;
  margin-bottom: 4px;
}

/* Collapsible sections */
.collapsible { display: block; }
.collapsible-head { display:flex; align-items:center; gap:8px; margin:6px 0; }
.collapsible .section-body { display:block; }
.collapsed .section-body { display:none; }

/* Name modal */
.name-modal {
  position: fixed;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:3000;
  background: rgba(0,0,0,.35);
}
.name-modal .box {
  background: var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  max-width:520px;
  width:92%;
  box-shadow: var(--shadow);
}
.name-form { display:flex; gap:8px; margin-top:8px; }
.name-form input {
  flex:1;
  padding:10px;
  border:1px solid var(--border);
  border-radius:10px;
  background: var(--bg);
  color: var(--text);
}
.error { color:#ef4444; margin-top:8px; }

/* System message */
li.system {
  background: rgba(255,255,255,0.05);
  padding:6px 12px;
  margin:4px 0;
  font-size:.85rem;
  border-radius:8px;
  color: var(--muted);
  border:1px dashed var(--border);
}

/* Scrollbars */
::-webkit-scrollbar { width:12px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.02); }
::-webkit-scrollbar-thumb {
  background: var(--accent-2);
  border-radius:6px;
  border:3px solid var(--bg);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: underline;
}
[data-theme="dark"] a {
  color: var(--accent-2);
}
a:hover { opacity:.9; }

/* Responsive */
@media (max-width: 1100px) {
  .app-grid { grid-template-columns: 1fr; }
  .stats-sidebar { position: relative; top: auto; height: auto; }
}
@media (max-width: 680px) {
  .app { padding: 10px; }
  .player-bar, .chat-wrap { width: 100%; }
  .messages li { max-width: 90%; }
  .emoji-panel { grid-template-columns: repeat(7,1fr); width: 280px; }
}
