/* ADHDRadio — Retro Radio-Dial Aesthetic
   Warm amber/cream panel, tuning-dial motif, monospace display font.
   Self-contained: no external CDN, no @font-face needed. */

/* ── Reset + base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette */
  --amber-glow:   #ffb347;
  --amber-bright: #ffd080;
  --amber-dark:   #c87800;
  --cream:        #f5e9c8;
  --cream-dark:   #e8d4a0;
  --panel-bg:     #2a1e0a;
  --panel-mid:    #3d2b10;
  --panel-light:  #5a4020;
  --needle-color: #ff4400;
  --text-primary: #ffe8a0;
  --text-muted:   #a88040;
  --text-dim:     #7a5830;
  --green-glow:   #40ff80;
  --red-glow:     #ff3030;
  --border-brass: #8a6020;
  --shadow-deep:  rgba(0,0,0,0.7);

  /* Typography */
  --font-display: 'Courier New', 'Lucida Console', monospace;
  --font-ui:      'Trebuchet MS', 'Gill Sans', system-ui, sans-serif;
}

html, body {
  min-height: 100vh;
  background: #0d0800;
  background-image:
    radial-gradient(ellipse at 30% 20%, #1a0e00 0%, transparent 60%),
    radial-gradient(ellipse at 70% 80%, #100800 0%, transparent 60%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px 48px;
  font-family: var(--font-ui);
}

/* ── App wrapper ────────────────────────────────────────────────────────────── */
#app {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* ── Dial ───────────────────────────────────────────────────────────────────── */
#dial-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

#dial {
  position: relative;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 35%, #6a4a18 0%, #3a2808 55%, #1e1204 100%);
  border: 4px solid var(--border-brass);
  box-shadow:
    0 0 0 2px #2a1800,
    0 0 20px rgba(255,180,60,0.25),
    inset 0 2px 8px rgba(255,200,80,0.15),
    inset 0 -4px 12px rgba(0,0,0,0.6);
}

/* Tick marks around the dial */
.dial-tick {
  position: absolute;
  width: 3px;
  height: 12px;
  background: var(--amber-dark);
  top: 8px;
  left: calc(50% - 1.5px);
  transform-origin: 1.5px 82px;
  transform: rotate(calc(var(--i) * 30deg));
  opacity: 0.6;
  border-radius: 2px;
}

#dial-needle {
  position: absolute;
  width: 3px;
  height: 72px;
  background: linear-gradient(to bottom, var(--needle-color), #ff8800);
  bottom: 50%;
  left: calc(50% - 1.5px);
  transform-origin: 50% 100%;
  transform: rotate(-130deg);
  border-radius: 3px 3px 0 0;
  box-shadow: 0 0 6px var(--needle-color);
  transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

#dial-center {
  position: absolute;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 40% 35%, #c88030, #5a2800);
  border: 2px solid var(--border-brass);
  border-radius: 50%;
  top: calc(50% - 9px);
  left: calc(50% - 9px);
  box-shadow: 0 0 8px rgba(255,150,50,0.5);
}

#on-air-badge {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 3px;
  color: var(--panel-bg);
  background: var(--text-muted);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid var(--border-brass);
  opacity: 0.3;
  transition: opacity 0.3s, background 0.3s, color 0.3s, box-shadow 0.3s;
  text-shadow: none;
}

/* ON AIR glows when scanning */
#app.scanning #on-air-badge {
  opacity: 1;
  background: var(--green-glow);
  color: #001a00;
  box-shadow: 0 0 10px var(--green-glow), 0 0 24px rgba(64,255,128,0.4);
  animation: onair-pulse 1.8s ease-in-out infinite;
}

#app.paused #on-air-badge {
  opacity: 1;
  background: var(--amber-glow);
  color: #1a0800;
  box-shadow: 0 0 10px var(--amber-glow), 0 0 20px rgba(255,179,71,0.4);
}

@keyframes onair-pulse {
  0%, 100% { box-shadow: 0 0 8px var(--green-glow), 0 0 18px rgba(64,255,128,0.3); }
  50%       { box-shadow: 0 0 16px var(--green-glow), 0 0 36px rgba(64,255,128,0.6); }
}

/* Needle sweep animation on hop */
@keyframes needle-sweep {
  0%   { transform: rotate(var(--needle-from, -130deg)); }
  40%  { transform: rotate(var(--needle-to, 0deg)) rotate(15deg); }
  100% { transform: rotate(var(--needle-to, 0deg)); }
}

/* ── Panel ──────────────────────────────────────────────────────────────────── */
#panel {
  width: 100%;
  background:
    linear-gradient(160deg, var(--panel-mid) 0%, var(--panel-bg) 100%);
  border: 2px solid var(--border-brass);
  border-radius: 12px;
  box-shadow:
    0 0 0 1px #1a0e00,
    0 4px 32px var(--shadow-deep),
    inset 0 1px 0 rgba(255,200,80,0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Panel header ───────────────────────────────────────────────────────────── */
#panel-header {
  background: linear-gradient(90deg, #1a0e00, var(--panel-mid), #1a0e00);
  border-bottom: 1px solid var(--border-brass);
  padding: 12px 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#panel-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: bold;
  color: var(--amber-bright);
  letter-spacing: 2px;
  text-shadow: 0 0 10px var(--amber-glow), 0 0 24px rgba(255,179,71,0.5);
}

#panel-tagline {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── Section base ───────────────────────────────────────────────────────────── */
#panel > section {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(138, 96, 32, 0.25);
}
#panel > section:last-child { border-bottom: none; }

/* ── Now-playing ────────────────────────────────────────────────────────────── */
#now-playing {
  min-height: 62px;
  background: #0e0800;
  border-bottom: 1px solid var(--border-brass) !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

#np-station {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--amber-bright);
  text-shadow: 0 0 8px rgba(255,208,128,0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#np-location {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 1px;
}

#np-website {
  font-size: 11px;
  color: var(--amber-dark);
  text-decoration: none;
  word-break: break-all;
  transition: color 0.2s;
}
#np-website:hover { color: var(--amber-bright); text-decoration: underline; }

/* ── Transport ──────────────────────────────────────────────────────────────── */
#transport {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

button {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid var(--border-brass);
  padding: 8px 14px;
  background: linear-gradient(160deg, var(--panel-light), var(--panel-bg));
  color: var(--amber-glow);
  text-shadow: 0 0 6px rgba(255,179,71,0.4);
  transition: background 0.15s, box-shadow 0.15s, color 0.15s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,200,80,0.1);
}
button:hover:not(:disabled) {
  background: linear-gradient(160deg, #7a5830, var(--panel-mid));
  box-shadow: 0 0 10px rgba(255,179,71,0.3), inset 0 1px 0 rgba(255,200,80,0.2);
  color: var(--amber-bright);
}
button:active:not(:disabled) {
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

#btn-start {
  flex: 1;
  background: linear-gradient(160deg, #3a2808, #1a0e00);
  border-color: var(--amber-dark);
  color: var(--amber-bright);
  font-size: 14px;
}
#btn-start:hover:not(:disabled) {
  background: linear-gradient(160deg, #5a3a10, #2a1800);
}
#app.scanning #btn-start { color: var(--red-glow); border-color: var(--red-glow); }
#app.scanning #btn-start:hover { color: #ff6060; }

/* ── Interval + volume ──────────────────────────────────────────────────────── */
#interval-control, #volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

label, #interval-control span, #volume-control span {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-display);
  letter-spacing: 1px;
  white-space: nowrap;
}

input[type="number"] {
  width: 64px;
  background: #0e0800;
  border: 1px solid var(--border-brass);
  border-radius: 4px;
  color: var(--amber-bright);
  font-family: var(--font-display);
  font-size: 15px;
  text-align: center;
  padding: 5px;
  outline: none;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}
input[type="number"]:focus {
  border-color: var(--amber-glow);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.5), 0 0 6px rgba(255,179,71,0.3);
}

#vol-pct {
  min-width: 38px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--amber-bright);
}

input[type="range"] {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--amber-dark), var(--panel-light));
  outline: none;
  cursor: pointer;
  border: none;
}
input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, var(--amber-bright), var(--amber-dark));
  border: 2px solid var(--border-brass);
  box-shadow: 0 0 6px rgba(255,179,71,0.5);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--amber-glow);
  border: 2px solid var(--border-brass);
  cursor: pointer;
}

/* ── Filters ────────────────────────────────────────────────────────────────── */
#filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 120px;
}
.filter-group label {
  font-size: 11px;
}

select, input[type="text"] {
  background: #0e0800;
  border: 1px solid var(--border-brass);
  border-radius: 4px;
  color: var(--amber-bright);
  font-family: var(--font-display);
  font-size: 13px;
  padding: 6px 8px;
  outline: none;
  width: 100%;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.4);
}
select:focus, input[type="text"]:focus {
  border-color: var(--amber-glow);
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.4), 0 0 6px rgba(255,179,71,0.3);
}
select option {
  background: #1a0e00;
  color: var(--amber-bright);
}

#filter-row2 { margin-top: 0; }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.toggle-label:hover { color: var(--amber-glow); }

input[type="checkbox"] {
  appearance: none;
  width: 18px;
  height: 18px;
  background: #0e0800;
  border: 1px solid var(--border-brass);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: background 0.2s;
}
input[type="checkbox"]:checked {
  background: var(--amber-dark);
  box-shadow: 0 0 6px rgba(255,179,71,0.5);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: 2px solid var(--cream);
  border-top: none;
  border-left: none;
  transform: rotate(40deg);
}

/* ── Favorites ──────────────────────────────────────────────────────────────── */
#favorites-section {
  padding-bottom: 16px;
}

#favorites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
#favorites-header > span {
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

#btn-favorite {
  font-size: 12px;
  padding: 5px 12px;
  color: var(--text-muted);
  border-color: #4a3010;
}
#btn-favorite.active {
  color: var(--amber-bright);
  border-color: var(--amber-dark);
  text-shadow: 0 0 8px rgba(255,208,128,0.8);
  box-shadow: 0 0 8px rgba(255,179,71,0.3), inset 0 1px 0 rgba(255,200,80,0.1);
}

#favorites-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-brass) #0e0800;
}
#favorites-list::-webkit-scrollbar { width: 5px; }
#favorites-list::-webkit-scrollbar-track { background: #0e0800; }
#favorites-list::-webkit-scrollbar-thumb { background: var(--border-brass); border-radius: 3px; }

.fav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #2a1800;
  background: #0e0800;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.fav-item:hover {
  background: #1a0e00;
  border-color: var(--border-brass);
}
.fav-item.playing {
  border-color: var(--amber-dark);
  background: #180c00;
  box-shadow: 0 0 6px rgba(255,179,71,0.2);
}

.fav-name {
  flex: 1;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--amber-bright);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fav-loc {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}
.fav-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  padding: 0 4px;
  cursor: pointer;
  line-height: 1;
  box-shadow: none;
  flex-shrink: 0;
  min-width: unset;
}
.fav-remove:hover { color: var(--red-glow); background: none; box-shadow: none; }

.fav-empty {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  padding: 12px 0;
  letter-spacing: 1px;
}

/* ── Status bar ─────────────────────────────────────────────────────────────── */
#status-bar {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1px;
  text-align: center;
  padding: 8px 20px;
  border-top: 1px solid rgba(138, 96, 32, 0.2);
}

/* ── Scan-hop flash ─────────────────────────────────────────────────────────── */
@keyframes hop-flash {
  0%   { box-shadow: 0 0 0 1px #1a0e00, 0 4px 32px var(--shadow-deep), inset 0 1px 0 rgba(255,200,80,0.1), 0 0 0 0 rgba(255,179,71,0); }
  30%  { box-shadow: 0 0 0 1px #1a0e00, 0 4px 32px var(--shadow-deep), inset 0 1px 0 rgba(255,200,80,0.1), 0 0 24px 6px rgba(255,179,71,0.35); }
  100% { box-shadow: 0 0 0 1px #1a0e00, 0 4px 32px var(--shadow-deep), inset 0 1px 0 rgba(255,200,80,0.1), 0 0 0 0 rgba(255,179,71,0); }
}
#panel.hop { animation: hop-flash 0.5s ease-out; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  #dial { width: 140px; height: 140px; }
  #dial-needle { height: 56px; }
  .dial-tick { transform-origin: 1.5px 62px; }
  #panel-logo { font-size: 18px; }
  #transport { gap: 6px; }
  button { padding: 7px 10px; font-size: 12px; }
}
