/* ═══════════════════════════════════════════════════════════════════════════
   Radio Station — CSS Theme System
   ─────────────────────────────────────────────────────────────────────────
   All colours, fonts and spacing are CSS custom properties.
   Override just the tokens you need in StationSettings → custom_css.
   Add a Google Fonts @import via StationSettings → font_import_url.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Dark theme tokens (default) ─────────────────────────────────────────── */
:root {
  --bg:            #0f1117;
  --surface:       #1a1d24;
  --raised:        #21262e;
  --border:        #2c3140;
  --text:          #dde1ee;
  --text-2:        #8892a8;
  --text-3:        #50596a;

  --accent:        #3b82f6;   /* overridden per station via inline style */
  --accent-dim:    color-mix(in srgb, var(--accent) 72%, #000);
  --accent-glow:   color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-text:   color-mix(in srgb, var(--accent) 55%, #fff);

  --on-accent:     #ffffff;
  --success:       #22c55e;
  --warn:          #f59e0b;
  --danger:        #ef4444;
  --danger-dim:    #b91c1c;
  --live:          #e63946;

  --radius:        7px;
  --radius-sm:     4px;
  --radius-lg:     12px;
  --shadow:        0 4px 16px rgba(0,0,0,.55);
  --shadow-sm:     0 1px 4px rgba(0,0,0,.4);

  --font:          system-ui,-apple-system,'Segoe UI',Helvetica,Arial,sans-serif;
  --mono:          'JetBrains Mono','Fira Code','Courier New',monospace;

  --nav-h:         54px;
  --max-w:         1140px;
  --gap:           1.5rem;
  --gap-sm:        .75rem;
  --t:             .15s ease;
}

/* ── Light theme ──────────────────────────────────────────────────────────── */
.theme-light {
  --bg:        #f0f3f9;
  --surface:   #ffffff;
  --raised:    #f4f6fc;
  --border:    #d5daea;
  --text:      #111827;
  --text-2:    #4b5563;
  --text-3:    #9ca3af;
  --shadow:    0 4px 16px rgba(0,0,0,.08);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
  --accent-text: color-mix(in srgb, var(--accent) 75%, #000);
}

/* ── Auto (follow OS) ─────────────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  .theme-auto {
    --bg:        #f0f3f9;
    --surface:   #ffffff;
    --raised:    #f4f6fc;
    --border:    #d5daea;
    --text:      #111827;
    --text-2:    #4b5563;
    --text-3:    #9ca3af;
    --shadow:    0 4px 16px rgba(0,0,0,.08);
    --shadow-sm: 0 1px 4px rgba(0,0,0,.06);
    --accent-text: color-mix(in srgb, var(--accent) 75%, #000);
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */

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

dialog {
  margin: auto;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

h1, h2, h3, h4, h5 {
  color: var(--text);
  line-height: 1.25;
  font-weight: 600;
}
h1 { font-size: 1.6rem;  margin-bottom: .75rem; }
h2 { font-size: 1.2rem;  margin-bottom: .6rem; }
h3 { font-size: 1.025rem; margin-bottom: .5rem; }

p  { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

small, .text-sm { font-size: .82rem; color: var(--text-2); }

code, pre {
  font-family: var(--mono);
  font-size: .875em;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
code { padding: .1em .35em; }
pre  { padding: .75rem 1rem; overflow-x: auto; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

img { max-width: 100%; display: block; }


/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.main-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--gap);
}

section { margin-bottom: 2rem; }


/* ═══════════════════════════════════════════════════════════════════════════
   TOP NAV BAR
   ═══════════════════════════════════════════════════════════════════════════ */

.top-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 0 var(--gap);
}

.nav-brand {
  font-weight: 700;
  font-size: .95rem;
  color: var(--text) !important;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  text-decoration: none !important;
}

.nav-logo {
  height: 28px;
  width: auto;
  object-fit: contain;
}

.nav-brand-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: .9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  padding: .3rem .65rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: .85rem;
  white-space: nowrap;
  transition: color var(--t), background var(--t);
  text-decoration: none !important;
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--raised);
}
.nav-link.active { color: var(--accent-text); font-weight: 500; }

.nav-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
  font-size: .82rem;
  color: var(--text-2);
}

/* Wrapper that holds nav-links + nav-user; becomes dropdown panel on mobile */
.nav-dropdown {
  display: flex;
  flex: 1;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  padding: .2rem .45rem;
  cursor: pointer;
  font-size: .9rem;
  line-height: 1.4;
  transition: background var(--t), color var(--t);
}
.theme-toggle:hover { background: var(--raised); color: var(--text); }


/* ═══════════════════════════════════════════════════════════════════════════
   SITE BANNER  (public player hero)
   ═══════════════════════════════════════════════════════════════════════════ */

.site-banner {
  position: relative;
  min-height: 130px;
  background-color: var(--surface);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.25) 0%, rgba(0,0,0,.65) 100%);
}

.site-banner-inner {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: var(--gap);
}

.site-logo-img {
  max-height: 90px;
  max-width: 260px;
  object-fit: contain;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,.7));
  margin: 0 auto;
}

.site-name-text {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
}
.public-header-text    { font-size: 1.4rem; font-weight: 700; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.public-subheader-text { font-size: 1rem; color: rgba(255,255,255,.85); margin-top: .2rem; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.station-name-label    { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em;
                          color: var(--text-muted); margin-bottom: .5rem; text-align: center; }


/* ═══════════════════════════════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════════════════════════════ */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.table-wrap td:last-child .btn-row { justify-content: flex-end; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }

th {
  text-align: left;
  padding: .55rem .85rem;
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
  background: var(--raised);
  border-bottom: 1px solid var(--border);
}

td {
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--raised); }


/* ═══════════════════════════════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════════════════════════════ */

.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: .3rem;
  cursor: pointer;
}

input[type=text],
input[type=password],
input[type=number],
input[type=email],
input[type=url],
input[type=search],
select,
textarea {
  display: block;
  width: 100%;
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: .42rem .7rem;
  font-family: var(--font);
  font-size: .9rem;
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
  appearance: auto;
}

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

input[type=color] {
  width: 2.6rem;
  height: 2.1rem;
  padding: .1rem .15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--raised);
  cursor: pointer;
  outline: none;
}

textarea { resize: vertical; min-height: 90px; }
textarea.mono { font-family: var(--mono); font-size: .84rem; }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1.25rem;
  margin-bottom: 1.25rem;
}
legend {
  padding: 0 .5rem;
  font-weight: 600;
  font-size: .85rem;
  color: var(--text-2);
}

.form-help {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: .3rem;
  line-height: 1.4;
}

.check-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
}
.check-row label { margin-bottom: 0; color: var(--text); font-weight: 400; }
input[type=checkbox], input[type=radio] {
  width: auto;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 580px) { .form-row-2 { grid-template-columns: 1fr; } }
@media (max-width: 480px) {
  .site-banner-inner { flex-wrap: wrap; justify-content: center; text-align: center; }
  .site-logo-img { max-width: 120px; }
}

.color-row { display: flex; align-items: center; gap: .6rem; }
.color-row input[type=text] { flex: 1; }
.color-row input[type=color] { flex-shrink: 0; }

.img-preview        { max-height: 70px;  border-radius: var(--radius-sm); border: 1px solid var(--border); margin-top: .5rem; object-fit: contain; }
.img-preview-banner { width: 100%; max-height: 110px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); margin-top: .5rem; }


/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════════════════ */

.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .4rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none !important;
  transition: background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
  line-height: 1.45;
  background: var(--raised);
  color: var(--text);
}

button[type=submit]:not(.btn-success):not(.btn-danger):not(.btn-ghost), .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button[type=submit]:not(.btn-success):not(.btn-danger):not(.btn-ghost):hover, .btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}

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

.btn-success {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}
.btn-success:hover { background: color-mix(in srgb, var(--success) 80%, #000); border-color: color-mix(in srgb, var(--success) 80%, #000); }
.btn-success:disabled { opacity: .45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
  padding-left: .5rem;
  padding-right: .5rem;
}
.btn-ghost:hover { background: var(--raised); border-color: var(--border); color: var(--text); }

.btn-sm, button.btn-sm { padding: .22rem .55rem; font-size: .8rem; }

.btn-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }


/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: .85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: var(--raised);
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-body { padding: 1.25rem; }


/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .12rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
}
.badge-success { background: rgba(34,197,94,.13);  color: #4ade80; }
.badge-warn    { background: rgba(245,158,11,.13); color: #fbbf24; }
.badge-danger  { background: rgba(239,68,68,.13);  color: #f87171; }
.badge-muted   { background: var(--raised);         color: var(--text-2); border: 1px solid var(--border); }
.badge-accent  { background: rgba(59,130,246,.13); color: var(--accent-text); }

.badge-live {
  background: var(--live);
  color: #fff;
  animation: pulse-glow 1.4s ease infinite;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(230,57,70,.5); }
  50%       { opacity: .85; box-shadow: 0 0 0 5px rgba(230,57,70,0); }
}


/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════════════════════════ */

.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius);
  border: 1px solid;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.alert-error   { background: rgba(239,68,68,.09);  border-color: rgba(239,68,68,.3);  color: #f87171; }
.alert-success { background: rgba(34,197,94,.09);  border-color: rgba(34,197,94,.3);  color: #4ade80; }
.alert-warn    { background: rgba(245,158,11,.09); border-color: rgba(245,158,11,.3); color: #fbbf24; }


/* ═══════════════════════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h1 { margin-bottom: 0; }

.breadcrumb {
  font-size: .82rem;
  color: var(--text-2);
  margin-bottom: .6rem;
}
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--text); }


/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD INDEX  — tile grid
   ═══════════════════════════════════════════════════════════════════════════ */

.dash-welcome {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.dash-welcome h1 { margin-bottom: .25rem; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: .85rem;
}

.dash-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none !important;
  color: var(--text);
  transition: background var(--t), border-color var(--t), transform var(--t), box-shadow var(--t);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.dash-tile:hover {
  background: var(--raised);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.dash-tile-icon  { font-size: 1.8rem; margin-bottom: .6rem; display: block; line-height: 1; }
.dash-tile-label { font-weight: 600;  font-size: .9rem; margin-bottom: .2rem; display: block; color: var(--text); }
.dash-tile-desc  { font-size: .78rem; color: var(--text-2); display: block; }


/* ═══════════════════════════════════════════════════════════════════════════
   PUBLIC PLAYER
   ═══════════════════════════════════════════════════════════════════════════ */

.player-page {
  max-width: 660px;
  margin: 0 auto;
  padding: 0 var(--gap) var(--gap);
}

.player-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.player-card-main { flex: 1; min-width: 0; }
.player-card-art  { width: 160px; flex-shrink: 0; }
.player-card-art img {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  object-fit: cover;
  display: block;
}
@media (max-width: 500px) {
  .player-card { flex-direction: column-reverse; }
  .player-card-art { width: 100%; }
  .player-card-art img { width: 100%; height: 180px; }
}

.track-status {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .8rem;
  color: var(--text-2);
  margin-bottom: .75rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  transition: background var(--t);
}
.status-dot.on-air { background: var(--success); }
.status-dot.live   { background: var(--live); animation: pulse-glow 1.4s ease infinite; }

.track-title  { font-size: 1.25rem; font-weight: 700; color: var(--text); margin-bottom: .2rem; }
.track-artist { font-size: .9rem;   color: var(--text-2); }

.player-controls {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-top: 1.25rem;
}

#play-btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  border-radius: var(--radius);
  padding: .6rem 1.5rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t);
  flex-shrink: 0;
}
#play-btn:hover { background: var(--accent-dim); }

.time-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
}

.time-remaining {
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent-text);
}

.progress-wrap {
  height: 5px;
  background: var(--raised);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width .5s linear;
  width: 0%;
  border-radius: 3px;
}

.history-section {
  max-height: 365px;
 }

.history-section h2 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: .45rem;
  margin-bottom: .75rem;
}

.history-list { list-style: none; padding: 0; padding-right: .10rem; margin: 0; max-height: 331px; overflow-y: auto; scrollbar-gutter: stable; scrollbar-color: var(--accent) transparent; scrollbar-width: thin; }
.history-list::-webkit-scrollbar { width: 5px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.history-list::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }
.history-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  gap: 1rem;
}
.history-list li:last-child { border-bottom: none; }
.h-track { color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-time  { color: var(--text-3); font-size: .78rem; white-space: nowrap; flex-shrink: 0; }

.player-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-top: .75rem;
  font-size: .78rem;
  color: var(--text-3);
}

.stream-links-section { }
.stream-links-section h2 {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: .45rem;
  margin-bottom: .75rem;
}
.stream-link-label { font-size: .8rem; color: var(--text-2); margin-bottom: .3rem; }
.stream-link-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.stream-link-row input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: .8rem;
  padding: .45rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--raised);
  color: var(--text);
}
.stream-link-row button { flex-shrink: 0; }


/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.login-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: var(--gap);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 370px;
  box-shadow: var(--shadow);
}

.login-card .site-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-2);
  text-align: center;
  margin-bottom: 1.5rem;
  display: block;
}

.login-card h1 {
  font-size: 1.25rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-card .form-group { margin-bottom: .85rem; }

.login-card button[type=submit] {
  width: 100%;
  padding: .55rem;
  font-size: .95rem;
  margin-top: .5rem;
}


/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════════════ */

.text-danger  { color: var(--danger)  !important; }
.text-success { color: var(--success) !important; }
.text-warn    { color: var(--warn)    !important; }
.text-muted   { color: var(--text-2)  !important; }
.text-accent  { color: var(--accent-text) !important; }

.mt-sm { margin-top: var(--gap-sm); }
.mb-sm { margin-bottom: var(--gap-sm); }
.mt-md { margin-top: var(--gap); }
.mb-md { margin-bottom: var(--gap); }

.d-flex       { display: flex; }
.gap-sm       { gap: var(--gap-sm); }
.items-center { align-items: center; }
.flex-wrap    { flex-wrap: wrap; }

.missing { color: var(--warn); }

form.inline { display: inline; }

.drag-handle { cursor: grab; color: var(--text-2); text-align: center; width: 1.5rem; }
tr.dragging  { opacity: .4; }

.eq-rack { display: flex; gap: 1.25rem; align-items: flex-end; flex-wrap: wrap; padding: .5rem 0; }
.eq-band { display: flex; flex-direction: column; align-items: center; gap: .5rem; width: 3.5rem; }
.eq-band input[type="number"] { width: 3.5rem; text-align: center; }
.eq-slider-wrap { height: 120px; width: 3.5rem; display: flex; align-items: center; justify-content: center; }
.eq-band input[type="range"] { width: 120px; transform: rotate(-90deg); }
.eq-band-label { font-size: .75rem; color: var(--text-2); }
.eq-preamp { border-right: 1px solid var(--border); padding-right: 1.25rem; margin-right: .25rem; }

/* Cookie consent banner */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: .85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: 0 -2px 12px rgba(0,0,0,.35);
  font-size: .875rem;
}
.cookie-banner p { margin: 0; flex: 1; min-width: 0; color: var(--text-2); }
.cookie-banner .btn-row { flex-shrink: 0; gap: .5rem; }

/* Volume slider */
#volume-slider { accent-color: var(--accent); max-width: 180px; cursor: pointer; -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px; outline: none; background: color-mix(in srgb, var(--accent) 28%, var(--border)); }
#volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }
#volume-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); cursor: pointer; border: none; }

/* ── Library hub cards ───────────────────────────────────────────────────── */
.hub-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--gap);
  margin-top: var(--gap);
}
.hub-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1rem;
  text-decoration: none !important;
  color: var(--text);
  gap: .4rem;
  transition: border-color var(--t), background var(--t);
}
.hub-card:hover { border-color: var(--accent); background: var(--surface); }
.hub-card-icon { font-size: 2rem; line-height: 1; }
.hub-card-label { font-weight: 600; font-size: 1.05rem; }
.hub-card-count { font-size: .85rem; color: var(--text-2); }

/* ── Mobile responsive nav ───────────────────────────────────────────────── */
.nav-hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 1.2rem;
  line-height: 1;
  padding: .25rem .45rem;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-hamburger:hover { color: var(--text); border-color: var(--text-3); }

@media (max-width: 768px) {
  /* Keep the nav bar compact — dropdown is an overlay, not in document flow */
  .top-nav { height: var(--nav-h); }
  .nav-inner {
    flex-wrap: nowrap;
    align-items: center;
    padding: 0 var(--gap);
    gap: .5rem;
    height: 100%;
  }
  .nav-brand { flex: 1; }
  .nav-hamburger { display: block; }

  /* Dropdown panel floats below the nav bar without pushing content */
  .nav-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 20px rgba(0,0,0,.2);
    z-index: 201;
    flex-direction: column;
    padding: .2rem 0 .55rem;
  }
  .top-nav.nav-open .nav-dropdown { display: flex; }

  /* Nav links: full-width stacked */
  .nav-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    overflow-x: visible;
    padding: .15rem var(--gap) .4rem;
    gap: 0;
  }
  .nav-link { width: 100%; padding: .45rem .6rem; font-size: .9rem; }

  /* User section below nav links, separated by a line */
  .nav-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: .35rem;
    padding: .4rem var(--gap) .1rem;
    border-top: 1px solid var(--border);
  }

  /* Public / username / Logout / theme — stacked like nav links */
  .nav-user-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 0;
  }
  .nav-user-links > * {
    display: block;
    width: 100%;
    padding: .45rem .6rem;
    font-size: .9rem;
    text-align: left;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    cursor: pointer;
    text-decoration: none !important;
  }
  .nav-user-links > *:hover {
    background: var(--raised);
    color: var(--text);
  }

  .main-wrap { padding: var(--gap); }
}

/* ── Drag-and-drop ───────────────────────────────────────────────────────────── */
tr.dragging { opacity: .45; background: var(--raised-2, #1e2533); }

/* ── Buffering indicator ─────────────────────────────────────────────────────── */
.buf-indicator {
  font-size: .8rem;
  color: var(--text-2);
  margin-top: .4rem;
  animation: pulse-opacity 1.2s ease-in-out infinite;
}
@keyframes pulse-opacity { 0%,100% { opacity:.4 } 50% { opacity:1 } }

/* ── Tooltips ────────────────────────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--raised-2, #1e2533);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .25rem .55rem;
  border-radius: var(--radius-sm, 4px);
  font-size: .75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}

@keyframes spin { to { transform: rotate(360deg); } }
.nav-spin {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
[data-tooltip]:hover::after { opacity: 1; }
