/* ============ Токени ============ */
:root {
  --ink: #12141c;
  --panel: #1b1e29;
  --panel-2: #21253254;
  --line: #2c3040;
  --paper: #f2ede3;
  --amber: #e8a33d;
  --amber-glow: #ffcf7d;
  --teal: #3fa9a0;
  --text: #eae7de;
  --text-dim: #9a9aa5;
  --danger: #e2645a;

  --font-display: 'Fraunces', serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  padding-bottom: 92px; /* място за плейъра */
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Амбиентно сияние във фона - намек за тунер, което свети зад стрелката */
.tuner-glow {
  position: fixed;
  top: -20%;
  left: 50%;
  width: 900px;
  height: 900px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(232,163,61,0.13) 0%, rgba(232,163,61,0) 65%);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; }

/* ============ Топ бар ============ */
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 32px;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { color: var(--amber); font-size: 22px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: 0.3px;
}
.brand-freq {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1.5px;
}

.search {
  flex: 1;
  max-width: 480px;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel);
}
.search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
}
.search button {
  border: none;
  background: var(--amber);
  color: #241a05;
  font-weight: 600;
  padding: 0 20px;
  cursor: pointer;
  font-family: var(--font-body);
}

.auth-area { display: flex; gap: 10px; margin-left: auto; }

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn.ghost:hover { background: var(--panel); }
.btn.solid { background: var(--amber); color: #241a05; border-color: var(--amber); }
.btn.solid:hover { background: var(--amber-glow); }
.btn.full { width: 100%; }

/* ============ Реклами ============ */
.ad-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(135deg, #191c26, #191c26 10px, #1d212d 10px, #1d212d 20px);
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font-mono);
}
.ad-label { opacity: .6; letter-spacing: 1px; text-transform: uppercase; }
.ad-top { max-width: 1200px; margin: 18px auto 0; height: 90px; }
.ad-side { height: 250px; margin-top: 24px; }

/* ============ Оформление ============ */
.layout {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  padding: 28px 32px 40px;
}

.sidebar { display: flex; flex-direction: column; }

.tabs { display: flex; gap: 6px; margin-bottom: 26px; background: var(--panel); padding: 4px; border-radius: 999px; }
.tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 8px 0;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.tab.active { background: var(--amber); color: #241a05; }

.filter-group { margin-bottom: 26px; }
.filter-group h3 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
}
.chip.active { background: var(--teal); border-color: var(--teal); color: #06211f; }

select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: var(--font-body);
}

/* ============ Съдържание ============ */
.content-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}
.content-head h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  margin: 0;
}
.freq-readout {
  font-family: var(--font-mono);
  color: var(--amber);
  font-size: 13px;
  letter-spacing: 1px;
}

.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.station-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
  position: relative;
}
.station-card:hover { border-color: var(--amber); transform: translateY(-2px); }
.station-card.playing { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; }

.station-logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: #10121a;
  object-fit: cover;
  flex-shrink: 0;
}
.station-info { min-width: 0; }
.station-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.station-sub {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.station-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
}
.station-fav.active { color: var(--amber); }

.empty-state { text-align: center; color: var(--text-dim); padding: 60px 0; }
.hidden { display: none !important; }

/* In-feed реклама сред станциите */
.ad-infeed {
  grid-column: 1 / -1;
  height: 70px;
}

/* ============ Плейър ============ */
.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 20px;
  height: 84px;
  padding: 0 24px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.dial-indicator {
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--amber);
  box-shadow: 0 0 12px var(--amber-glow);
  animation: sweep 6s ease-in-out infinite;
  opacity: .5;
}
@keyframes sweep {
  0%, 100% { left: 0%; }
  50% { left: 100%; }
}

.now-playing { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-logo { width: 44px; height: 44px; border-radius: 8px; background: #10121a; object-fit: cover; }
.np-text { display: flex; flex-direction: column; min-width: 0; }
.np-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }

.player-controls { display: flex; align-items: center; gap: 16px; justify-self: center; }
.play-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--amber);
  color: #241a05;
  font-size: 16px;
  cursor: pointer;
}
.play-btn:hover { background: var(--amber-glow); }

.visualizer { display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.visualizer span {
  width: 3px;
  background: var(--teal);
  border-radius: 2px;
  height: 6px;
}
.visualizer.playing span { animation: bar 900ms ease-in-out infinite; }
.visualizer span:nth-child(1) { animation-delay: 0ms; }
.visualizer span:nth-child(2) { animation-delay: 120ms; }
.visualizer span:nth-child(3) { animation-delay: 240ms; }
.visualizer span:nth-child(4) { animation-delay: 360ms; }
.visualizer span:nth-child(5) { animation-delay: 480ms; }
@keyframes bar {
  0%, 100% { height: 6px; }
  50% { height: 20px; }
}

.player-side { display: flex; align-items: center; gap: 14px; }
.icon-btn { background: none; border: none; color: var(--text-dim); font-size: 18px; cursor: pointer; }
.icon-btn.active { color: var(--amber); }
#volume { width: 90px; accent-color: var(--amber); }

/* ============ Модал ============ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(8,9,13,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 20;
}
.modal {
  position: relative;
  width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer;
}
.modal-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.modal-tab {
  flex: 1;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 8px 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.modal-tab.active { color: var(--text); border-color: var(--amber); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { font-size: 12px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.auth-form input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.form-error { color: var(--danger); font-size: 12px; min-height: 14px; margin: 0; }

/* ============ Респонсив ============ */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .ad-side { display: none; }
  .topbar { flex-wrap: wrap; gap: 12px; }
  .player { grid-template-columns: auto 1fr auto; }
  .player-side { display: none; }
}
