/* ===========================
   SOUZA WEB RÁDIO — styles
   =========================== */

:root {
  --accent:      #ff6b35;
  --accent2:     #ff2d7a;
  --accent-glow: rgba(255,107,53,.35);

  /* Dark theme (default) */
  --bg:          #0b0b0f;
  --bg2:         #13131a;
  --bg3:         #1c1c27;
  --card-bg:     rgba(255,255,255,.045);
  --card-border: rgba(255,255,255,.08);
  --text:        #f0f0f5;
  --text-muted:  rgba(240,240,245,.45);
  --shadow:      0 32px 64px rgba(0,0,0,.6);
}

[data-theme="light"] {
  --bg:          #f4f1ec;
  --bg2:         #ede8e0;
  --bg3:         #e4ddd3;
  --card-bg:     rgba(255,255,255,.72);
  --card-border: rgba(0,0,0,.08);
  --text:        #1a1612;
  --text-muted:  rgba(26,22,18,.45);
  --shadow:      0 32px 64px rgba(0,0,0,.14);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Sora', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  transition: background .4s, color .4s;
}

/* ─── Background ─── */
.bg-wrap {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  pointer-events: none;
}
.orb {
  position: absolute; border-radius: 50%;
  filter: blur(90px); opacity: .25;
  transition: opacity .5s;
}
[data-theme="light"] .orb { opacity: .12; }

.orb1 {
  width: 520px; height: 520px;
  background: radial-gradient(circle, #ff6b35, transparent 70%);
  top: -160px; left: -100px;
  animation: drift1 18s ease-in-out infinite alternate;
}
.orb2 {
  width: 420px; height: 420px;
  background: radial-gradient(circle, #ff2d7a, transparent 70%);
  bottom: -120px; right: -80px;
  animation: drift2 22s ease-in-out infinite alternate;
}
.orb3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #8b2fff, transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%,-50%);
  animation: drift3 15s ease-in-out infinite alternate;
}
#waveCanvas {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: .07;
}
[data-theme="light"] #waveCanvas { opacity: .04; }

@keyframes drift1 { from{transform:translate(0,0)} to{transform:translate(60px,80px)} }
@keyframes drift2 { from{transform:translate(0,0)} to{transform:translate(-50px,-60px)} }
@keyframes drift3 { from{transform:translate(-50%,-50%) scale(1)} to{transform:translate(-48%,-52%) scale(1.15)} }

/* ─── Theme toggle ─── */
.theme-toggle {
  position: fixed; top: 20px; right: 20px; z-index: 100;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  cursor: pointer; color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s, box-shadow .3s, background .4s;
}
.theme-toggle:hover { transform: scale(1.1); box-shadow: 0 0 18px var(--accent-glow); }
.theme-toggle svg { width: 20px; height: 20px; transition: opacity .3s, transform .3s; }
.icon-moon { display: block; }
.icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun  { display: block; }

/* ─── Main container ─── */
.container {
  position: relative; z-index: 1;
  width: 100%; max-width: 480px;
  padding: 24px 20px 40px;
  display: flex; flex-direction: column;
  align-items: center; gap: 28px;
}

/* ─── Logo ─── */
.logo-wrap {
  animation: logoIn .9s cubic-bezier(.16,1,.3,1) both;
}
.logo-svg {
  width: 160px; height: 160px;
  filter: drop-shadow(0 0 24px var(--accent-glow));
  transition: filter .4s;
}
[data-theme="light"] .logo-svg { filter: drop-shadow(0 4px 18px rgba(0,0,0,.15)); }

@keyframes logoIn {
  from { opacity:0; transform: scale(.7) rotate(-10deg); }
  to   { opacity:1; transform: scale(1) rotate(0deg); }
}

/* ─── Station info ─── */
.station-info {
  text-align: center;
  animation: fadeUp .7s .2s cubic-bezier(.16,1,.3,1) both;
}
.live-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,45,122,.15);
  border: 1px solid rgba(255,45,122,.3);
  padding: 4px 14px; border-radius: 99px;
  font-size: .7rem; font-weight: 600; letter-spacing: .1em;
  color: #ff6b9e; text-transform: uppercase; margin-bottom: 12px;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ff2d7a;
  box-shadow: 0 0 6px #ff2d7a;
  animation: blink 1.4s ease infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

.station-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(2.2rem, 8vw, 3rem);
  letter-spacing: .06em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}
.station-tagline {
  margin-top: 8px;
  font-size: .82rem; color: var(--text-muted); font-weight: 400;
  letter-spacing: .02em;
}

@keyframes fadeUp {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ─── Player card ─── */
.player-card {
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(24px);
  border-radius: 24px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 22px;
  transition: background .4s, border-color .4s, box-shadow .4s;
  animation: fadeUp .7s .4s cubic-bezier(.16,1,.3,1) both;
}

/* ─── Visualizer ─── */
.visualizer {
  display: flex; align-items: flex-end;
  justify-content: center; gap: 3px;
  height: 48px; overflow: hidden;
}
.visualizer span {
  flex: 1; max-width: 12px;
  background: linear-gradient(to top, var(--accent), var(--accent2));
  border-radius: 4px 4px 2px 2px;
  height: 4px;
  transform-origin: bottom;
  transition: height .1s;
}
.visualizer.playing span {
  animation: bar var(--d, .9s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}
.visualizer span:nth-child(1)  { --d:.72s; --delay:0s;     }
.visualizer span:nth-child(2)  { --d:.88s; --delay:.07s;   }
.visualizer span:nth-child(3)  { --d:.65s; --delay:.14s;   }
.visualizer span:nth-child(4)  { --d:.94s; --delay:.04s;   }
.visualizer span:nth-child(5)  { --d:.78s; --delay:.18s;   }
.visualizer span:nth-child(6)  { --d:.60s; --delay:.09s;   }
.visualizer span:nth-child(7)  { --d:.85s; --delay:.22s;   }
.visualizer span:nth-child(8)  { --d:.70s; --delay:.03s;   }
.visualizer span:nth-child(9)  { --d:.92s; --delay:.16s;   }
.visualizer span:nth-child(10) { --d:.67s; --delay:.11s;   }
.visualizer span:nth-child(11) { --d:.80s; --delay:.05s;   }
.visualizer span:nth-child(12) { --d:.73s; --delay:.20s;   }
.visualizer span:nth-child(13) { --d:.88s; --delay:.08s;   }
.visualizer span:nth-child(14) { --d:.62s; --delay:.15s;   }
.visualizer span:nth-child(15) { --d:.95s; --delay:.01s;   }
.visualizer span:nth-child(16) { --d:.76s; --delay:.24s;   }
.visualizer span:nth-child(17) { --d:.83s; --delay:.12s;   }
.visualizer span:nth-child(18) { --d:.69s; --delay:.06s;   }
.visualizer span:nth-child(19) { --d:.91s; --delay:.19s;   }
.visualizer span:nth-child(20) { --d:.74s; --delay:.13s;   }

@keyframes bar {
  from { height: 4px; }
  to   { height: calc(8px + var(--h, 36px)); }
}
.visualizer span:nth-child(odd)  { --h: 30px; }
.visualizer span:nth-child(even) { --h: 42px; }
.visualizer span:nth-child(3n)   { --h: 22px; }
.visualizer span:nth-child(5n)   { --h: 44px; }

/* ─── Now playing ─── */
.now-playing {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: rgba(255,107,53,.07);
  border: 1px solid rgba(255,107,53,.15);
  border-radius: 14px;
}
.np-icon { font-size: 1.4rem; flex-shrink: 0; }
.np-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.np-label { font-size: .68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; }
.np-title {
  font-size: .95rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ─── Controls ─── */
.controls {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}

/* Volume */
.volume-wrap {
  display: flex; align-items: center; gap: 10px; flex: 1;
}
.vol-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px;
  transition: color .2s;
  flex-shrink: 0;
}
.vol-btn:hover { color: var(--accent); }
.vol-btn svg { width: 20px; height: 20px; display: block; }

.vol-slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val, 80%), rgba(255,255,255,.15) var(--val, 80%));
  outline: none; cursor: pointer;
  transition: height .2s;
}
.vol-slider:hover { height: 6px; }
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: white;
  box-shadow: 0 0 6px rgba(0,0,0,.3);
  transition: transform .2s;
}
.vol-slider:hover::-webkit-slider-thumb { transform: scale(1.25); }
.vol-slider::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: white; border: none;
  box-shadow: 0 0 6px rgba(0,0,0,.3);
}

/* Play button */
.play-btn {
  width: 70px; height: 70px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none; cursor: pointer; color: white;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 30px var(--accent-glow);
  transition: transform .2s, box-shadow .2s;
  flex-shrink: 0;
  position: relative;
}
.play-btn:hover { transform: scale(1.08); box-shadow: 0 0 45px rgba(255,107,53,.5); }
.play-btn:active { transform: scale(.95); }
.play-btn svg { width: 26px; height: 26px; position: absolute; transition: opacity .2s; }

/* State management */
.icon-play    { opacity: 1; }
.icon-pause   { opacity: 0; }
.icon-loading { opacity: 0; animation: spin 1s linear infinite; }

.play-btn.playing .icon-play    { opacity: 0; }
.play-btn.playing .icon-pause   { opacity: 1; }
.play-btn.playing .icon-loading { opacity: 0; }

.play-btn.loading .icon-play    { opacity: 0; }
.play-btn.loading .icon-pause   { opacity: 0; }
.play-btn.loading .icon-loading { opacity: 1; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Share button */
.share-btn {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: color .2s, border-color .2s, transform .2s;
}
.share-btn:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.08); }
.share-btn svg { width: 19px; height: 19px; }

/* ─── Status bar ─── */
.status-bar {
  display: flex; align-items: center; gap: 8px;
  justify-content: center;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  transition: background .4s, box-shadow .4s;
}
.status-dot.on {
  background: #22d05a;
  box-shadow: 0 0 8px #22d05a;
  animation: blink 2s ease infinite;
}
.status-dot.error { background: #ff4444; }
.status-dot.loading { background: var(--accent); animation: blink .8s ease infinite; }

.status-text {
  font-size: .78rem; color: var(--text-muted); font-weight: 400;
}

/* ─── Footer ─── */
.footer {
  text-align: center; animation: fadeUp .7s .6s cubic-bezier(.16,1,.3,1) both;
}
.footer p { font-size: .73rem; color: var(--text-muted); margin-bottom: 12px; }
.social-links { display: flex; gap: 12px; justify-content: center; }
.social-link {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card-bg); border: 1px solid var(--card-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); text-decoration: none;
  transition: color .2s, border-color .2s, transform .2s;
}
.social-link:hover { color: var(--accent); border-color: var(--accent); transform: scale(1.12); }
.social-link svg { width: 17px; height: 17px; }

/* ─── Toast ─── */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--bg3); border: 1px solid var(--card-border);
  padding: 10px 22px; border-radius: 99px;
  font-size: .82rem; color: var(--text); font-weight: 500;
  box-shadow: var(--shadow); z-index: 200;
  transition: transform .3s cubic-bezier(.16,1,.3,1), opacity .3s;
  opacity: 0; white-space: nowrap;
  backdrop-filter: blur(12px);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ─── Responsive ─── */
@media (max-width: 400px) {
  .container { padding: 20px 14px 32px; }
  .logo-svg { width: 130px; height: 130px; }
  .player-card { padding: 22px 16px; }
  .play-btn { width: 60px; height: 60px; }
}

@media (min-width: 600px) {
  .container { max-width: 520px; }
  .logo-svg { width: 190px; height: 190px; }
  .play-btn { width: 78px; height: 78px; }
}

@media (min-width: 900px) {
  .container { max-width: 540px; }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
