/* ── VARIABLES ── */
:root {
  --bg:       #0a0a0f;
  --surface:  #12121a;
  --surface2: #1c1c28;
  --accent:   #e8c547;
  --accent2:  #ff6b35;
  --text:     #f0eee8;
  --muted:    #7a7888;
  --radius:   10px;
  --header-h: 56px;
  --tabs-h:   44px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  height: 100%;
  height: 100dvh;
}
body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ── HEADER fijo ── */
header {
  flex-shrink: 0;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top) 16px 0;
  padding-top: calc(env(safe-area-inset-top) + 10px);
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: var(--bg);
  z-index: 50;
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 3px;
  color: var(--accent);
  user-select: none;
}
.logo span { color: var(--accent2); }

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

.install-btn {
  background: var(--accent);
  color: #0a0a0f;
  border: none;
  padding: 6px 14px;
  border-radius: 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: opacity .15s;
}
.install-btn:hover { opacity: .85; }

.sw-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.1);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.sw-dot { width: 6px; height: 6px; border-radius: 50%; background: #444; }
.sw-dot.active { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,.5); }

/* ── REPRODUCTOR fijo ── */
.player-section {
  flex-shrink: 0;
  padding: 12px 12px 0;
  background: var(--bg);
}

.player-wrap {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 9;
}

video {
  width: 100%; height: 100%;
  display: none;
  background: #000;
}
video.loaded { display: block; }

.video-placeholder {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
  color: var(--muted);
  font-size: 13px;
}
.video-placeholder.hidden { display: none; }

.play-icon-big {
  width: 56px; height: 56px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .2s;
}
.play-icon-big:hover { transform: scale(1.1); }
.play-icon-big svg { margin-left: 4px; }

/* ── CONTROLES ── */
.controls {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,.85) 0%, transparent 100%);
  padding: 32px 12px 10px;
  display: none;
}
.controls.visible { display: block; }

.progress-area {
  margin-bottom: 8px;
  cursor: pointer;
  padding: 4px 0;
}
.progress-track {
  height: 3px;
  background: rgba(255,255,255,.18);
  border-radius: 2px;
  position: relative;
  transition: height .15s;
}
.progress-area:hover .progress-track { height: 5px; }
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  pointer-events: none;
}
.progress-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  position: absolute;
  top: 50%; left: 0%;
  transform: translateY(-50%);
  margin-left: -6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.progress-area:hover .progress-thumb { opacity: 1; }

.ctrl-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctrl-btn {
  background: none; border: none;
  color: var(--text);
  cursor: pointer; padding: 4px;
  display: flex; align-items: center;
  transition: color .15s, transform .1s;
  opacity: .85;
}
.ctrl-btn:hover { color: var(--accent); opacity: 1; transform: scale(1.1); }
.ctrl-btn:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }

.time-display {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.spacer { flex: 1; }
.quality-badge {
  font-size: 10px;
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  color: var(--muted);
}

.vol-wrap { display: flex; align-items: center; gap: 5px; }
.vol-slider {
  -webkit-appearance: none; appearance: none;
  width: 56px; height: 3px;
  background: rgba(255,255,255,.2);
  border-radius: 2px; outline: none; cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent);
}

/* ── TABS fijos ── */
.tabs {
  flex-shrink: 0;
  height: var(--tabs-h);
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: var(--bg);
  padding: 0 8px;
}
.tab {
  padding: 0 16px;
  font-size: 13px;
  font-weight: 500;
  font-family: 'DM Sans', sans-serif;
  color: var(--muted);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  transition: color .2s, border-color .2s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── ÁREA DE CONTENIDO scrollable ── */
.content-area {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.panel {
  display: none;
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}
.panel.active { display: block; }

/* ── INFO ── */
.video-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.video-subtitle { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.video-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tag {
  font-size: 11px; padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,.12);
  color: var(--muted);
}
.tag.genre { border-color: var(--accent2); color: var(--accent2); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 12px;
  border: 1px solid rgba(255,255,255,.05);
}
.stat-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
.stat-value { font-family: 'Bebas Neue', sans-serif; font-size: 20px; letter-spacing: 1px; }
.stat-value.green { color: #4ade80; }
.stat-value.amber { color: var(--accent); }

/* ── CATÁLOGO ACORDEÓN ── */
.catalogue-grid { display: block; }

.cat-item { border-bottom: 1px solid rgba(255,255,255,.06); }
.cat-item:first-child { border-top: 1px solid rgba(255,255,255,.06); }

.cat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
  border-radius: 6px;
}
.cat-row:hover { background: rgba(255,255,255,.04); }
.cat-row:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }

.cat-left { display: flex; align-items: center; gap: 10px; }
.cat-arrow { color: var(--muted); flex-shrink: 0; transition: transform .2s ease; }
.cat-name { font-size: 14px; font-weight: 500; color: var(--text); }
.cat-count {
  font-size: 11px; color: var(--muted);
  background: rgba(255,255,255,.07);
  padding: 2px 8px; border-radius: 20px; flex-shrink: 0;
}

.cat-videos { display: none; padding: 0 0 6px 26px; }
.cat-videos.open { display: block; }

.video-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.video-item:hover { background: rgba(255,255,255,.05); }
.video-item:focus-visible { outline: 2px solid var(--accent); }
.video-item.active-video { background: rgba(232,197,71,.1); }
.video-item.active-video .vi-icon { color: var(--accent); }
.video-item.active-video .vi-title { color: var(--accent); }

.vi-icon { color: var(--muted); flex-shrink: 0; }
.vi-title { font-size: 13px; color: var(--muted); line-height: 1.4; transition: color .15s; }
.video-item:hover .vi-title { color: var(--text); }

/* ── BOTÓN MODO AUDIO ── */
#audioModeBtn.active { color: var(--accent); opacity: 1; }

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,.1);
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
  z-index: 200;
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── RESPONSIVE ── */
@media (max-width: 400px) {
  .vol-slider { display: none; }
  .sw-badge   { display: none; }
}

/* ── BARRA DE ACTUALIZACIÓN ── */
.update-bar {
  position: fixed;
  bottom: -80px;
  left: 12px; right: 12px;
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 300;
  transition: bottom .35s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.6);
}
.update-bar.show { bottom: 24px; }
.update-bar span { flex: 1; font-size: 13px; color: var(--text); }
.update-bar button {
  border: none; border-radius: 20px;
  padding: 6px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px; font-weight: 500;
  cursor: pointer;
}
#updateBtn     { background: var(--accent); color: #0a0a0f; }
#updateDismiss { background: rgba(255,255,255,.1); color: var(--muted); }



/* ── REPRODUCTOR AUDIO ── */
.audio-player {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  position: relative;
}

.audio-stop-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  opacity: .7;
}
.audio-stop-btn:hover { opacity: 1; color: var(--accent2) !important; }

.audio-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
}

.audio-cover {
  width: 80px; height: 80px;
  background: rgba(232,197,71,.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  animation: audio-pulse 2s ease-in-out infinite;
}

@keyframes audio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232,197,71,.3); }
  50%       { box-shadow: 0 0 0 12px rgba(232,197,71,0); }
}

.audio-info { text-align: center; }
.audio-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--text);
  margin-bottom: 4px;
}
.audio-genre { font-size: 12px; color: var(--muted); }

.audio-progress-area {
  width: 100%;
  cursor: pointer;
  padding: 6px 0;
}
.audio-progress-area .progress-track { height: 3px; }
.audio-progress-area:hover .progress-track { height: 5px; }

.audio-time {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}



.audio-play-btn {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0a0a0f !important;
  opacity: 1 !important;
}
.audio-play-btn:hover { transform: scale(1.08) !important; }

#audioStopBtn {
  position: absolute;
  right: 5px;
  bottom:15px;
}
