:root[data-theme="dark"] {
  --bg: #080c14;
  --bg2: #0e1520;
  --bg3: #141c2e;
  --surface: #1a2235;
  --surface2: #1f2b40;
  --border: #2a3d5a;
  --text: #e8f0ff;
  --text2: #7a9cc0;
  --text3: #4a6080;
  --accent: #00d4ff;
  --accent2: #0099cc;
  --green: #00ff88;
  --red: #ff3355;
  --orange: #ff9500;
  --glow: 0 0 20px rgba(0,212,255,0.3);
  --glow2: 0 0 40px rgba(0,212,255,0.15);
  --shadow: 0 8px 32px rgba(0,0,0,0.6);
}
:root[data-theme="light"] {
  --bg: #f0f4ff;
  --bg2: #e8eef8;
  --bg3: #dde5f5;
  --surface: #ffffff;
  --surface2: #f5f8ff;
  --border: #c5d3e8;
  --text: #1a2235;
  --text2: #4a6080;
  --text3: #8aa0c0;
  --accent: #0077cc;
  --accent2: #0055aa;
  --green: #00aa55;
  --red: #cc2244;
  --orange: #dd7700;
  --glow: 0 0 20px rgba(0,119,204,0.2);
  --glow2: 0 0 40px rgba(0,119,204,0.1);
  --shadow: 0 8px 32px rgba(0,0,0,0.12);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Rajdhani', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.4s, color 0.4s;
  overflow-x: hidden;
}

/* GRID BACKGROUND */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.4s;
}
[data-theme="light"] body::before { opacity: 0.5; }

/* HEADER */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,12,20,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  transition: background 0.4s, border-color 0.4s;
}
[data-theme="light"] header { background: rgba(240,244,255,0.9); }

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 70px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: var(--glow);
  animation: pulse-logo 3s ease-in-out infinite;
}
@keyframes pulse-logo {
  0%,100% { box-shadow: 0 0 15px rgba(0,212,255,0.4); }
  50% { box-shadow: 0 0 30px rgba(0,212,255,0.8); }
}
.logo-text {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: 20px;
  color: var(--text);
  letter-spacing: 2px;
}
.logo-text span { color: var(--accent); }

/* SEARCH */
.search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px 10px 42px;
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  outline: none;
  transition: all 0.3s;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: var(--glow);
}
.search-input::placeholder { color: var(--text3); }
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 16px;
  pointer-events: none;
}
.autocomplete-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  z-index: 200;
  display: none;
  box-shadow: var(--shadow);
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 15px;
  transition: background 0.2s;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--surface2); }
.autocomplete-item .ac-name { font-weight: 600; }
.autocomplete-item .ac-sub { font-size: 12px; color: var(--text3); }

/* HEADER ACTIONS */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-shrink: 0;
}

.btn-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s;
}
.btn-icon:hover { border-color: var(--accent); color: var(--accent); box-shadow: var(--glow); }

.font-size-badge {
  font-family: 'Orbitron', monospace;
  font-size: 10px;
  color: var(--text3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 5px;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s;
}
.font-size-badge:hover { border-color: var(--accent); color: var(--accent); }

/* FILTERS BAR */
.filters-bar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  transition: all 0.4s;
}
.filters-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 12px;
  color: var(--text3);
  font-family: 'Orbitron', monospace;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.filter-chip:hover, .filter-chip.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(0,212,255,0.08);
}
.filter-select {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}
.filter-select:hover, .filter-select:focus {
  border-color: var(--accent);
  color: var(--accent);
}

/* MAIN */
main {
  position: relative;
  z-index: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.section-title {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--text3);
  text-transform: uppercase;
}
.station-count {
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  color: var(--accent);
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.3);
  padding: 4px 10px;
  border-radius: 20px;
}

/* CARDS GRID */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

/* STATION CARD */
.station-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  position: relative;
  animation: card-in 0.5s ease both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.station-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(0,0,0,0.4), var(--glow2);
}
.station-card.playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), var(--glow);
}

.card-accent-bar {
  height: 3px;
  background: var(--card-color, var(--accent));
  transition: height 0.3s;
}
.station-card.playing .card-accent-bar { height: 5px; }

.card-body {
  padding: 20px;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-logo {
  width: 54px; height: 54px;
  border-radius: 14px;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.station-card.playing .card-logo {
  border-color: var(--card-color, var(--accent));
  box-shadow: 0 0 15px var(--card-color, var(--accent));
}
.card-logo img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

.card-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text3);
  font-family: 'Orbitron', monospace;
  letter-spacing: 1px;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
  transition: all 0.3s;
}
.status-dot.live {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: blink 2s ease-in-out infinite;
}
.status-dot.error { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes blink {
  0%,100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.card-name {
  font-family: 'Orbitron', monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
  transition: color 0.3s;
}
.station-card.playing .card-name { color: var(--accent); }

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.meta-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  font-family: 'Rajdhani', sans-serif;
  letter-spacing: 0.5px;
}
.meta-tag.genre { color: var(--orange); border-color: rgba(255,149,0,0.3); background: rgba(255,149,0,0.08); }
.meta-tag.country { color: var(--accent); border-color: rgba(0,212,255,0.3); background: rgba(0,212,255,0.08); }
.meta-tag.language { color: var(--green); border-color: rgba(0,255,136,0.3); background: rgba(0,255,136,0.08); }

/* PLAYER */
.card-player {
  background: var(--bg3);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  transition: all 0.3s;
  display: none;
}
.station-card.playing .card-player { display: block; }

.player-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 30px;
  margin-bottom: 10px;
}
.wave-bar {
  flex: 1;
  background: var(--card-color, var(--accent));
  border-radius: 2px;
  min-height: 4px;
  opacity: 0.6;
  transition: opacity 0.3s;
}
.station-card.playing .wave-bar {
  opacity: 1;
  animation: wave 1.2s ease-in-out infinite;
}
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.15s; }
.wave-bar:nth-child(6) { animation-delay: 0.25s; }
.wave-bar:nth-child(7) { animation-delay: 0.05s; }
.wave-bar:nth-child(8) { animation-delay: 0.35s; }
@keyframes wave {
  0%,100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.play-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--card-color, var(--accent));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.2s;
  box-shadow: 0 0 12px var(--card-color, var(--accent));
}
.play-btn:hover { transform: scale(1.1); }

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.volume-icon { font-size: 14px; color: var(--text3); cursor: pointer; transition: color 0.2s; }
.volume-icon:hover { color: var(--accent); }
.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--card-color, var(--accent));
  box-shadow: 0 0 6px var(--card-color, var(--accent));
}

.player-status {
  font-size: 11px;
  color: var(--text3);
  font-family: 'Orbitron', monospace;
  letter-spacing: 1px;
  text-align: center;
  margin-top: 8px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
.tap-hint {
  font-size: 11px;
  color: var(--text3);
  display: flex; align-items: center; gap: 5px;
}
.share-btn {
  width: 28px; height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.share-btn:hover { border-color: var(--accent); color: var(--accent); }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  display: none;
}
.empty-state.visible { display: block; }
.empty-icon { font-size: 60px; margin-bottom: 16px; opacity: 0.3; }
.empty-title { font-family: 'Orbitron', monospace; color: var(--text2); margin-bottom: 8px; }
.empty-sub { color: var(--text3); font-size: 15px; }

/* TOAST CONTAINER */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: var(--shadow);
  pointer-events: all;
  animation: toast-in 0.4s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
  overflow: hidden;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(100px) scale(0.8); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
.toast.out { animation: toast-out 0.3s ease forwards; }
@keyframes toast-out {
  to { opacity: 0; transform: translateX(100px); height: 0; padding: 0; margin: 0; }
}
.toast-type-info { border-left-color: var(--accent); }
.toast-type-success { border-left-color: var(--green); }
.toast-type-warning { border-left-color: var(--orange); }
.toast-type-error { border-left-color: var(--red); }

.toast-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.toast-icon { font-size: 16px; }
.toast-title { font-family: 'Orbitron', monospace; font-size: 13px; font-weight: 700; }
.toast-body { font-size: 14px; color: var(--text2); line-height: 1.4; }
.toast-close {
  position: absolute; top: 10px; right: 10px;
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: 14px; padding: 2px;
}
.toast-progress {
  position: absolute; bottom: 0; left: 0; height: 2px;
  background: var(--accent);
  animation: progress linear forwards;
}
.toast-type-success .toast-progress { background: var(--green); }
.toast-type-warning .toast-progress { background: var(--orange); }
.toast-type-error .toast-progress { background: var(--red); }
@keyframes progress { from { width: 100%; } to { width: 0%; } }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-icon { font-size: 48px; text-align: center; margin-bottom: 16px; }
.modal-title { font-family: 'Orbitron', monospace; font-size: 20px; text-align: center; margin-bottom: 12px; }
.modal-body { color: var(--text2); text-align: center; line-height: 1.6; margin-bottom: 24px; font-size: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
.btn-modal {
  padding: 10px 24px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-modal.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
.btn-modal:hover { opacity: 0.8; }

/* ACCESSIBILITY BAR */
.a11y-bar {
  position: fixed;
  bottom: 24px; left: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
}
.a11y-bar.visible { pointer-events: all; opacity: 1; transform: translateY(0); }
.a11y-toggle {
  position: fixed;
  bottom: 24px; left: 24px;
  z-index: 501;
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 20px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.a11y-toggle:hover { border-color: var(--accent); color: var(--accent); }
.a11y-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
  position: fixed;
  bottom: 78px; left: 24px;
  z-index: 500;
  opacity: 0; pointer-events: none;
  transform: translateY(10px);
  transition: all 0.3s;
}
.a11y-panel.visible { opacity: 1; pointer-events: all; transform: translateY(0); }
.a11y-label { font-family: 'Orbitron', monospace; font-size: 10px; color: var(--text3); letter-spacing: 1px; margin-bottom: 4px; }
.a11y-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  display: flex; align-items: center; gap: 8px;
}
.a11y-btn:hover { border-color: var(--accent); color: var(--accent); }
.a11y-btn.active { border-color: var(--green); color: var(--green); background: rgba(0,255,136,0.08); }

/* HIGH CONTRAST */
body.high-contrast {
  --text: #ffffff;
  --text2: #dddddd;
  --border: #888888;
  --surface: #111111;
  --bg: #000000;
  --bg2: #0a0a0a;
  --bg3: #1a1a1a;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .header-inner { gap: 12px; }
  .logo-text { font-size: 16px; }
  .search-wrap { max-width: none; flex: 1; }
  .cards-grid { grid-template-columns: 1fr; }
  .header-actions { gap: 6px; }
}

/* NOTIFICATION BADGE */
.notif-badge {
  position: fixed;
  top: 80px; right: 24px;
  background: var(--accent);
  color: #000;
  border-radius: 20px;
  padding: 8px 16px;
  font-family: 'Orbitron', monospace;
  font-size: 12px;
  cursor: pointer;
  box-shadow: var(--glow);
  z-index: 400;
  animation: notif-in 0.5s cubic-bezier(0.34,1.56,0.64,1);
  display: none;
}
.notif-badge.show { display: flex; align-items: center; gap: 6px; }
@keyframes notif-in { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

/* ADMIN LINK */
.admin-link {
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--text3);
  text-decoration: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
  white-space: nowrap;
}
.admin-link:hover { border-color: var(--accent); color: var(--accent); }
