/* ===================================================
   OnAir365 — Modern Theme v2.0
   CSS Custom Properties drive per-station branding.
   Defaults set here; overridden per-page via PHP inline <style>.
   =================================================== */

:root {
  --brand-primary: #6c3fc2;
  --brand-accent:  #00d4aa;
  --brand-dark:    #0f0e17;
  --brand-surface: rgba(255, 255, 255, 0.06);
  --brand-border:  rgba(255, 255, 255, 0.11);
  --brand-text:    #ffffff;
  --brand-muted:   rgba(255, 255, 255, 0.55);
  --radius:        16px;
  --radius-sm:     8px;
  --transition:    0.22s ease;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--brand-dark);
  color: var(--brand-text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* === HEADER === */
header.site-header {
  background: rgba(15, 14, 23, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--brand-border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo img {
  height: 42px;
  width: auto;
  display: block;
}

.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  color: var(--brand-text);
  padding: 8px 18px;
  border-radius: 50px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.btn-logout:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: #fff;
}

/* === DASHBOARD === */
.site-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 56px 32px;
}

.dashboard-header {
  text-align: center;
  margin-bottom: 48px;
}

.dashboard-header h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  line-height: 1.1;
}

.dashboard-header p {
  color: var(--brand-muted);
  font-size: 1rem;
  max-width: 440px;
  margin: 0 auto;
}

/* === STATION GRID === */
.stations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.station-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--brand-text);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.station-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  border-color: var(--brand-primary);
}

.station-card-image {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.station-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 20px;
}

.station-initial {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 2.6rem;
  letter-spacing: -0.02em;
  color: rgba(255, 255, 255, 0.9);
}

.station-card-body {
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.station-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.35;
}

.station-card-play {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.station-card:hover .station-card-play {
  background: var(--brand-accent);
  transform: scale(1.12);
}

.station-card-play svg {
  width: 13px;
  height: 13px;
  fill: #fff;
  margin-left: 2px;
}

/* === STATION PLAYER PAGE === */
.station-page {
  min-height: calc(100vh - 72px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  position: relative;
}

/* Subtle radial glow from brand colour */
.station-page::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(108, 63, 194, 0.18), transparent 70%);
  background: radial-gradient(ellipse 80% 60% at 50% 0%, color-mix(in srgb, var(--brand-primary) 22%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.station-page > * { position: relative; z-index: 1; }

/* Logo */
.station-logo {
  width: 128px;
  height: 128px;
  border-radius: var(--radius);
  object-fit: contain;
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  padding: 14px;
  margin-bottom: 28px;
}

.station-logo-placeholder {
  width: 128px;
  height: 128px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 2.8rem;
  color: #fff;
}

.station-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 5.5vw, 3.2rem);
  letter-spacing: -0.035em;
  margin-bottom: 8px;
  line-height: 1.1;
}

.station-tagline {
  color: var(--brand-muted);
  font-size: 1rem;
  margin-bottom: 44px;
}

/* === EQUALIZER BARS === */
.equalizer {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 34px;
  margin: 0 auto 28px;
}

.eq-bar {
  width: 5px;
  border-radius: 3px;
  background: var(--brand-accent);
  transform-origin: bottom;
  transition: opacity 0.3s;
}

.eq-bar:nth-child(1) { animation: eq 0.72s ease-in-out infinite alternate; }
.eq-bar:nth-child(2) { animation: eq 0.94s ease-in-out 0.10s infinite alternate; }
.eq-bar:nth-child(3) { animation: eq 0.63s ease-in-out 0.20s infinite alternate; }
.eq-bar:nth-child(4) { animation: eq 1.01s ease-in-out 0.15s infinite alternate; }
.eq-bar:nth-child(5) { animation: eq 0.77s ease-in-out 0.05s infinite alternate; }

@keyframes eq {
  from { height: 6px;  opacity: 0.5; }
  to   { height: 34px; opacity: 1;   }
}

.equalizer.paused .eq-bar {
  animation-play-state: paused;
  height: 6px;
  opacity: 0.3;
}

/* === NOW PLAYING === */
.now-playing-wrap {
  margin-bottom: 40px;
}

.now-playing-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--brand-accent);
  font-weight: 600;
  margin-bottom: 6px;
}

.now-playing-track {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  font-weight: 600;
  min-height: 1.8em;
  transition: opacity 0.3s;
}

/* === PLAY BUTTON === */
.player-controls {
  margin-bottom: 44px;
}

.btn-play {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  box-shadow: 0 8px 32px rgba(108, 63, 194, 0.45);
  transition: transform var(--transition), box-shadow var(--transition);
}

.btn-play:hover {
  transform: scale(1.09);
  box-shadow: 0 14px 48px rgba(108, 63, 194, 0.65);
}

.btn-play:active { transform: scale(0.96); }

.btn-play svg {
  width: 26px;
  height: 26px;
  fill: #fff;
}

.icon-play  { margin-left: 3px; }

/* Show/hide play vs pause icon */
.btn-play .icon-pause { display: none; }
.btn-play.playing .icon-play  { display: none; }
.btn-play.playing .icon-pause { display: block; }

/* Loading spinner state */
.btn-play.loading {
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  opacity: 0.7;
  cursor: wait;
}

/* === BACK BUTTON === */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 10px 22px;
  border: 1px solid var(--brand-border);
  border-radius: 50px;
  transition: var(--transition);
  background: var(--brand-surface);
}

.btn-back:hover {
  color: var(--brand-text);
  border-color: var(--brand-primary);
  background: rgba(108, 63, 194, 0.12);
}

/* === LOGIN PAGE === */
.login-page {
  min-height: calc(100vh - 72px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.login-card {
  background: var(--brand-surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.login-card h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.2;
}

.login-sub {
  color: var(--brand-muted);
  text-align: center;
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--brand-muted);
  margin-bottom: 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.form-group input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 1rem;
  color: var(--brand-text);
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
  outline: none;
  appearance: none;
}

.form-group input:focus {
  border-color: var(--brand-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(108, 63, 194, 0.22);
}

.form-group input::placeholder { color: rgba(255, 255, 255, 0.28); }

.btn-login {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  margin-top: 10px;
  transition: opacity var(--transition);
  letter-spacing: 0.01em;
}

.btn-login:hover { opacity: 0.88; }

.forgot-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  color: var(--brand-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
}

.forgot-link:hover { color: var(--brand-accent); }

.login-error {
  background: rgba(220, 53, 69, 0.13);
  border: 1px solid rgba(220, 53, 69, 0.38);
  color: #ff8b94;
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  font-size: 0.88rem;
  margin-bottom: 20px;
  text-align: center;
}

/* === STREAM STATUS BADGE === */
/*
   display:none by default — takes zero space, no gap.
   Switches to inline-flex only when JS sets text content,
   which naturally pushes the play button down.
*/
.stream-status {
  display: none;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 5px 14px;
  border-radius: 50px;
  margin-bottom: 24px;
}

.stream-status:not(:empty) { display: inline-flex; }

.stream-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Buffering state */
.stream-status.buffering {
  background: rgba(255, 180, 0, 0.12);
  border: 1px solid rgba(255, 180, 0, 0.3);
  color: #ffb400;
}
.stream-status.buffering::before {
  background: #ffb400;
  animation: pulse-dot 1s ease-in-out infinite;
}

/* Reconnecting state */
.stream-status.reconnecting {
  background: rgba(255, 100, 60, 0.12);
  border: 1px solid rgba(255, 100, 60, 0.3);
  color: #ff7a50;
}
.stream-status.reconnecting::before {
  background: #ff7a50;
  animation: pulse-dot 0.6s ease-in-out infinite;
}

/* Connected/live state */
.stream-status.live {
  background: rgba(0, 212, 100, 0.12);
  border: 1px solid rgba(0, 212, 100, 0.3);
  color: #00d464;
}
.stream-status.live::before { background: #00d464; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  header.site-header { padding: 14px 20px; }
  .site-main { padding: 40px 20px; }
  .stations-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
}

@media (max-width: 540px) {
  header.site-header { padding: 12px 16px; }
  .site-main { padding: 32px 16px; }
  .stations-grid { grid-template-columns: 1fr; }
  .login-card { padding: 36px 24px; }
  .station-page { padding: 40px 16px; }
}
