/* ============================================================
   RadioStream Pro v2 — Stylesheet
   Aesthetic: Studio de grabación de lujo — negro profundo,
   ámbar cálido, tipografía editorial
   ============================================================ */

:root {
  --bg:         #0a0a0f;
  --bg2:        #111118;
  --bg3:        #1a1a24;
  --surface:    #16161f;
  --border:     rgba(255,255,255,.07);
  --border2:    rgba(255,255,255,.12);

  --amber:      #f5a623;
  --amber-dim:  #c4821a;
  --amber-glow: rgba(245,166,35,.15);
  --red-live:   #ff3b3b;
  --green:      #2ecc71;
  --blue:       #4f8ef7;

  --text:       #e8e8f0;
  --text-dim:   #888897;
  --text-muted: #555566;

  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --font-head:  'Syne', sans-serif;
  --font-body:  'DM Sans', sans-serif;
  --font-mono:  'DM Mono', monospace;

  --shadow:     0 4px 24px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 48px rgba(0,0,0,.7);
  --glow-amber: 0 0 20px rgba(245,166,35,.25), 0 0 60px rgba(245,166,35,.1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Grain overlay */
.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.04'/%3E%3C/svg%3E");
}

/* ── Tipografía ─────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; color: var(--text); }
a { color: var(--amber); text-decoration: none; transition: color .2s; }
a:hover { color: var(--amber-dim); }
p { color: var(--text-dim); margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }
code { font-family: var(--font-mono); font-size: .85em; color: var(--amber); }

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(12px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.brand { display: flex; align-items: center; gap: .75rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-logo { width: 36px; height: 36px; object-fit: contain; border-radius: 8px; }
.brand-icon { font-size: 1.5rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name   { font-family: var(--font-head); font-weight: 700; font-size: .95rem; }
.brand-slogan { font-size: .7rem; color: var(--text-muted); }

.main-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav-link {
  display: flex; align-items: center; gap: .4rem;
  padding: .45rem .75rem; border-radius: var(--radius);
  font-size: .82rem; color: var(--text-dim); transition: all .2s;
}
.nav-link svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.nav-link:hover, .nav-link.active {
  color: var(--text); background: var(--bg3);
}
.nav-link.active { color: var(--amber); }
.nav-logout { color: var(--text-muted) !important; }
.nav-logout:hover { color: var(--red-live) !important; background: rgba(255,59,59,.1) !important; }

/* ── Main content ───────────────────────────────────────────── */
.main-content {
  flex: 1; max-width: 1200px; width: 100%; margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  text-align: center; padding: 1.25rem;
  font-size: .75rem; color: var(--text-muted);
}

/* ── Grid layouts ───────────────────────────────────────────── */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; }
  .main-content { padding: 1.25rem 1rem; }
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color .2s;
}
.card:hover { border-color: var(--border2); }

.card-title {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-head); font-size: .9rem; font-weight: 600;
  color: var(--text); margin-bottom: 1.25rem;
}
.card-title svg { width: 18px; height: 18px; stroke: var(--amber); fill: none; stroke-width: 2; flex-shrink: 0; }

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: .25rem;
}
.stat-card.live { border-color: rgba(255,59,59,.3); background: rgba(255,59,59,.04); }
.stat-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub   { font-size: .72rem; color: var(--text-dim); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .3rem .75rem; border-radius: 99px;
  font-size: .75rem; font-weight: 600; letter-spacing: .03em;
}
.badge-live    { background: rgba(255,59,59,.12); color: #ff6b6b; border: 1px solid rgba(255,59,59,.25); }
.badge-offline { background: rgba(255,255,255,.05); color: var(--text-dim); border: 1px solid var(--border); }
.badge-amber   { background: var(--amber-glow); color: var(--amber); border: 1px solid rgba(245,166,35,.2); }

.pulse {
  display: inline-block; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red-live);
  animation: pulse-anim 1.4s ease-in-out infinite;
}
@keyframes pulse-anim { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.75)} }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1.25rem; border-radius: var(--radius);
  font-family: var(--font-body); font-size: .85rem; font-weight: 500;
  border: none; cursor: pointer; transition: all .2s; text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
.btn-primary  { background: var(--amber); color: #0a0a0f; }
.btn-primary:hover { background: var(--amber-dim); color: #0a0a0f; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn-secondary:hover { border-color: var(--amber); color: var(--amber); }
.btn-danger   { background: rgba(255,59,59,.15); color: var(--red-live); border: 1px solid rgba(255,59,59,.2); }
.btn-danger:hover { background: rgba(255,59,59,.25); }
.btn-sm  { padding: .4rem .9rem; font-size: .78rem; }
.btn-lg  { padding: .9rem 1.5rem; font-size: .95rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block; font-size: .8rem; font-weight: 500;
  color: var(--text-dim); margin-bottom: .4rem;
}
.form-input,
.form-select {
  width: 100%; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: var(--radius);
  padding: .65rem 1rem; color: var(--text);
  font-family: var(--font-body); font-size: .9rem;
  transition: border-color .2s, box-shadow .2s;
  appearance: none;
}
.form-input:focus,
.form-select:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-glow);
}
.form-input[type="file"] { padding: .5rem; cursor: pointer; }
.form-input::placeholder { color: var(--text-muted); }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
  padding: .9rem 1.25rem; border-radius: var(--radius);
  font-size: .85rem; margin-bottom: 1.25rem;
}
.alert-success { background: rgba(46,204,113,.1); color: #2ecc71; border: 1px solid rgba(46,204,113,.2); }
.alert-error   { background: rgba(255,59,59,.1);  color: #ff6b6b; border: 1px solid rgba(255,59,59,.2); }

/* ── Page header ────────────────────────────────────────────── */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap;
}
.page-header-left h1 { font-size: 1.75rem; margin-bottom: .2rem; }
.page-header-left p  { margin: 0; font-size: .85rem; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fade-in   { animation: fade-in .4s ease both; }
.fade-in-1 { animation-delay: .1s; }
.fade-in-2 { animation-delay: .2s; }
.fade-in-3 { animation-delay: .3s; }

/* ── Login ──────────────────────────────────────────────────── */
.login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 2rem 1rem; min-height: 100vh;
}
.login-box {
  width: 100%; max-width: 400px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-xl); padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo h1 { font-size: 1.4rem; margin-bottom: .3rem; }
.login-logo p  { font-size: .82rem; color: var(--text-muted); }

/* ── Player público ─────────────────────────────────────────── */
.player-hero {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 2rem 1rem;
}
.player-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: var(--radius-xl); padding: 2.5rem 2rem;
  box-shadow: var(--shadow-lg); text-align: center;
}
.player-logo {
  width: 140px; height: 140px; object-fit: contain;
  border-radius: 20px; border: 1px solid var(--border2);
}
.player-logo-placeholder {
  width: 140px; height: 140px; line-height: 140px;
  font-size: 4rem; background: var(--bg3);
  border-radius: 20px; border: 1px solid var(--border2);
  display: inline-block;
}
.player-station { font-size: 1.4rem; margin-bottom: .3rem; }
.player-genre   { font-size: .8rem; color: var(--text-muted); margin-bottom: 1rem; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 1.25rem; }
.play-btn {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--amber); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s, box-shadow .2s; box-shadow: var(--glow-amber);
}
.play-btn:hover     { transform: scale(1.06); }
.play-btn.playing   { box-shadow: 0 0 0 4px var(--amber-glow), var(--glow-amber); }
.play-btn svg       { width: 28px; height: 28px; }
.vol-row { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.vol-row input { flex: 1; }
.player-now { margin-top: .5rem; font-size: .85rem; }

/* ── Encoder ────────────────────────────────────────────────── */
.encoder-wrap {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 860px) {
  .encoder-wrap { grid-template-columns: 1fr; }
}

.source-tabs { display: flex; gap: .5rem; flex-wrap: wrap; }
.source-tab {
  display: flex; align-items: center; gap: .4rem;
  padding: .5rem 1rem; border-radius: var(--radius);
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text-dim); cursor: pointer; font-size: .83rem;
  font-family: var(--font-body); transition: all .2s;
}
.source-tab:hover  { border-color: var(--border2); color: var(--text); }
.source-tab.active { border-color: var(--amber); color: var(--amber); background: var(--amber-glow); }

.vu-wrap { display: flex; gap: 2px; align-items: flex-end; height: 48px; }
.vu-bar  { flex: 1; border-radius: 2px 2px 0 0; background: var(--green); transition: height .08s, background .2s; min-height: 2px; }

#waveCanvas {
  width: 100%; height: 60px; display: block;
  border-radius: var(--radius); background: var(--bg2);
}

.slider-wrap { display: flex; flex-direction: column; gap: .4rem; }
.slider-label { display: flex; justify-content: space-between; font-size: .78rem; color: var(--text-dim); }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px;
  background: var(--bg3); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); cursor: pointer;
  box-shadow: 0 0 0 2px var(--amber-glow);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); cursor: pointer; border: none;
}

.enc-timer {
  font-family: var(--font-mono); font-size: 2.5rem;
  color: var(--amber); letter-spacing: .05em;
  text-shadow: var(--glow-amber);
}

.btn-danger.btn-lg { font-size: .95rem; padding: .9rem 1.5rem; }
