/* ============================================================
   Radio Ultra – stylesheet
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0f0f1a;
  --surface:  #1a1a2e;
  --surface2: #232342;
  --border:   #2e2e50;
  --accent:   #7c3aed;
  --accent2:  #a855f7;
  --text:     #e2e8f0;
  --muted:    #94a3b8;
  --green:    #22c55e;
  --red:      #ef4444;
  --radius:   12px;
  --player-h: 72px;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

/* ── HEADER ── */
.site-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  position: sticky; top: 0; z-index: 100;
}
.header-inner { max-width: 1200px; margin: auto; }
.logo-area {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.logo-icon { font-size: 2rem; }
h1 { font-size: 1.4rem; font-weight: 700; color: var(--accent2); }
.tagline { font-size: .8rem; color: var(--muted); }

.header-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

#search {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 24px;
  padding: 8px 16px;
  font-size: .9rem;
  width: 220px;
  outline: none;
  transition: border-color .2s;
}
#search:focus { border-color: var(--accent); }

.genre-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
}
.chip:hover, .chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── STICKY PLAYER ── */
.sticky-player {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--player-h);
  background: linear-gradient(90deg, #1a1a3e, #16213e);
  border-top: 1px solid var(--border);
  z-index: 200;
  box-shadow: 0 -4px 24px rgba(0,0,0,.6);
}
.player-inner {
  max-width: 1200px; margin: auto;
  height: 100%;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
}
.player-logo {
  width: 44px; height: 44px; flex-shrink: 0; position: relative;
}
.player-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }

.player-info { flex: 1; min-width: 0; }
.player-name { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-meta  { display: block; font-size: .78rem; color: var(--accent2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.player-controls { display: flex; align-items: center; gap: 12px; }
.btn-play-main, .btn-stop {
  width: 40px; height: 40px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
.btn-play-main { background: var(--accent); color: #fff; }
.btn-stop      { background: var(--surface2); color: var(--muted); }
.btn-play-main:hover, .btn-stop:hover { transform: scale(1.1); }

.btn-wake {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); cursor: pointer;
  background: var(--surface2); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.btn-wake svg { width: 18px; height: 18px; }
.btn-wake:hover { border-color: var(--accent); }
.btn-wake.active { background: rgba(124,58,237,.25); border-color: var(--accent); color: #fff; }

.volume-wrap { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
#volume { accent-color: var(--accent); width: 80px; cursor: pointer; }

/* ── MAIN / GRID ── */
.main-content {
  max-width: 1200px; margin: 24px auto; padding: 0 20px;
  padding-bottom: calc(var(--player-h) + 24px);
}
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

/* ── STATION CARD ── */
.station-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: transform .15s, border-color .2s, box-shadow .2s;
  position: relative;
}
.station-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(124,58,237,.25);
}
.station-card.playing {
  border-color: var(--accent2);
  box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(124,58,237,.3);
}
.station-card.offline { opacity: .6; }

.card-logo {
  width: 64px; height: 64px; position: relative; align-self: center;
}
.card-logo img {
  width: 100%; height: 100%; object-fit: contain; border-radius: 8px;
}
.logo-fallback {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  font-weight: 700; font-size: 1.3rem; color: #fff;
}
.status-dot {
  position: absolute; bottom: 0; right: 0;
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--surface);
}
.dot-green { background: var(--green); }
.dot-red   { background: var(--red); }

.card-info { flex: 1; }
.card-info h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }
.genre-tag {
  display: inline-block; font-size: .72rem;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 20px; padding: 2px 10px; color: var(--muted);
}
.meta-text {
  margin-top: 6px; font-size: .78rem; color: var(--accent2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.btn-card-play {
  align-self: flex-end;
  background: var(--accent); color: #fff;
  border: none; border-radius: 50%;
  width: 36px; height: 36px; font-size: .9rem;
  cursor: pointer; transition: background .2s, transform .15s;
}
.btn-card-play:hover { background: var(--accent2); transform: scale(1.1); }

.no-results { text-align: center; color: var(--muted); padding: 40px; }

/* ── FOOTER ── */
.site-footer {
  text-align: center; font-size: .8rem; color: var(--muted);
  padding: 12px 0 calc(var(--player-h) + 16px);
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ── ADMIN GLOBAL ── */
.admin-wrap { max-width: 960px; margin: 40px auto; padding: 0 20px; }
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.admin-header h1 { color: var(--accent2); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 8px; font-size: .9rem; font-weight: 500; cursor: pointer; text-decoration: none; border: none; transition: all .2s; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); }
.btn-danger  { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent); }

table.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
table.admin-table th { background: var(--surface2); padding: 12px 16px; text-align: left; font-size: .82rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
table.admin-table td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
table.admin-table tr:hover td { background: rgba(124,58,237,.07); }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: .95rem; outline: none;
  transition: border-color .2s;
}
.form-control:focus { border-color: var(--accent); }
.form-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
.card-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: .9rem; }
.alert-success { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.4); color: #86efac; }
.alert-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.4);  color: #fca5a5; }

.badge { display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: .75rem; }
.badge-green { background: rgba(34,197,94,.2); color: #86efac; }
.badge-red   { background: rgba(239,68,68,.2);  color: #fca5a5; }
.badge-gray  { background: var(--surface2); color: var(--muted); }

.stream-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.stream-row .form-control { flex: 1; }
.btn-rm { background: #7f1d1d; color: #fca5a5; border: none; border-radius: 6px; padding: 8px 12px; cursor: pointer; }
.btn-rm:hover { background: var(--red); color: #fff; }
#addStreamBtn { margin-top: 6px; }

/* LOGIN */
.login-wrap { max-width: 360px; margin: 100px auto; padding: 0 20px; }
.login-wrap h1 { color: var(--accent2); margin-bottom: 28px; }

/* Responsive */
@media (max-width: 600px) {
  .station-grid { grid-template-columns: 1fr 1fr; }
  #volume { width: 60px; }
  .genre-filter { display: none; }
}
@media (max-width: 400px) {
  .station-grid { grid-template-columns: 1fr; }
}
