:root {
  --bg:        #1c1712;
  --panel:     #241d16;
  --panel-2:   #2c2319;
  --line:      #3a2f22;
  --cream:     #f2e9dc;
  --muted:     #a3927c;
  --amber:     #e8a33d;
  --rust:      #c4432b;
  --font-display: 'Big Shoulders Display', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--bg);
}

body {
  background:
    radial-gradient(ellipse at top left, rgba(232,163,61,0.06), transparent 60%),
    var(--bg);
  color: var(--cream);
  font-family: var(--font-mono);
  overflow: hidden;
}

/* CONTENEDOR PRINCIPAL - 2 Columnas */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: calc(100vh - 92px); /* Descontamos la altura del reproductor */
  width: 100vw;
}

/* ---------- MENÚ LATERAL ESTILO SPOTIFY RETRO ---------- */
.spotify-sidebar {
  width: 260px;
  background-color: var(--panel); 
  border-right: 1px solid var(--line);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: bold;
  color: var(--amber); 
  padding: 10px 12px;
  letter-spacing: 1.5px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

/* Caja de Navegación Principal */
.sidebar-nav {
  background-color: var(--panel-2);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--line);
}

/* Botones del menú lateral */
.spotify-sidebar .rack-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  text-align: left;
  padding: 12px 16px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s ease;
  width: 100%;
}

.spotify-sidebar .rack-btn:hover {
  color: var(--cream);
  background-color: rgba(255, 255, 255, 0.05);
}

.spotify-sidebar .rack-btn.active {
  color: var(--amber);
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 3px 0 0 var(--amber); /* Línea vertical retro */
}

.spotify-sidebar .rack-btn .icon {
  font-size: 16px;
}

/* Caja de Biblioteca */
.sidebar-library {
  background-color: var(--panel-2);
  border-radius: 8px;
  padding: 12px;
  flex: 1; 
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
}

.library-title {
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Botón + minimalista */
.add-playlist-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 6px;
  transition: color 0.2s;
  line-height: 1;
}

.add-playlist-btn:hover {
  color: var(--amber);
}

/* Contenedor con scroll para las cintas */
.library-shelf {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 4px;
}

/* Cada playlist */
.playlist-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  border-radius: 6px;
  color: var(--cream);
  font-size: 13.5px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.playlist-row:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.playlist-row .count {
  font-size: 10.5px;
  background-color: var(--line);
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 10px;
}

/* Scrollbar para la biblioteca */
.library-shelf::-webkit-scrollbar {
  width: 5px;
}
.library-shelf::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 10px;
}


/* ---------- CONTENIDO PRINCIPAL (DERECHA) ---------- */
.main {
  overflow-y: auto;
  padding: 24px 32px 40px;
  height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  position: sticky;
  top: 0;
  background-color: var(--bg);
  padding: 10px 0;
  z-index: 10;
}

.deck-led {
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--amber);
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 4px;
  white-space: nowrap;
}

.deck-led.playing {
  color: #8fd694;
}

.search-wrap {
  flex: 1;
  display: flex;
  gap: 8px;
}

#searchInput {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--cream);
  padding: 10px 14px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

#searchInput:focus {
  outline: 2px solid var(--amber);
}

#searchBtn {
  background: var(--amber);
  color: #1c1712;
  border: none;
  padding: 0 18px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  letter-spacing: 0.5px;
}

#searchBtn:hover {
  background: #f0b158;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 28px;
  color: var(--cream);
  margin: 0 0 16px;
  letter-spacing: 0.5px;
}

.view.hidden {
  display: none !important;
}

.tracklist {
  display: flex;
  flex-direction: column;
}

.track-row {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  border-radius: 4px;
}

.track-row:hover {
  background: var(--panel-2);
}

.track-row.current {
  background: var(--panel-2);
  color: var(--amber);
}

.track-num {
  color: var(--rust);
  font-size: 12px;
  font-weight: 700;
}

.track-meta {
  overflow: hidden;
}

.track-name {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-dur {
  font-size: 11px;
  color: var(--muted);
}

.track-add {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 4px;
  cursor: pointer;
}

.track-add:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.empty-msg {
  color: var(--muted);
  font-size: 13px;
  padding: 20px 0;
}


/* ---------- REPRODUCTOR BARRA INFERIOR ---------- */
/* ---------- PLAYER BAR CORREGIDO ---------- */
.player {
  height: 96px;
  background-color: var(--panel);
  border-top: 1px solid var(--line);
  display: grid;
  /* Distribución de espacio equilibrada y profesional */
  grid-template-columns: 150px 200px auto 360px 140px;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

/* 1. Casete */
.cassette {
  width: 130px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 400px;
}
.tape-svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
  transition: transform 0.3s ease;
}
.cassette:hover .tape-svg {
  transform: rotateX(10deg) translateY(-2px);
}

/* Centrado de los engranajes */
#reel-left { transform-origin: 55px 49px; }
#reel-right { transform-origin: 95px 49px; }
.reel.spin { animation: spinTape 2.5s linear infinite; }
@keyframes spinTape {
  to { transform: rotate(360deg); }
}

/* 2. Info Canción */
.now-playing {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.np-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}
.np-artist {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 3. Botones de Control (Estilo Hi-Fi minimalista) */
.transport {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
}
.tbtn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 10px;
}
.tbtn svg {
  width: 100%;
  height: 100%;
}
.tbtn:hover {
  color: var(--cream);
  border-color: var(--cream);
  background-color: var(--line);
}

/* Botón Play destacado en ámbar */
.tbtn.play {
  background: var(--amber);
  color: #1c1712;
  border: none;
  width: 46px;
  height: 46px;
  box-shadow: 0 4px 12px rgba(232, 163, 61, 0.3);
}
.tbtn.play:hover {
  transform: scale(1.06);
  background: #f0b158;
}

/* 4. Barra de Progreso Analógica (Scrub) */
.scrub {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
}
.scrub input[type=range] {
  flex: 1;
}

/* 5. Volumen */
.volwrap {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.vol-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- PERSONALIZACIÓN DE SLIDERS RETRO (INPUT RANGE) ---------- */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  outline: none;
}

/* Estilo para la "bolita" (Thumb) */
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--amber);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.2s;
  border: 2px solid var(--panel);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
  background: var(--cream);
}

/* Estilo para Firefox */
input[type=range]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--amber);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--panel);
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  transition: transform 0.1s ease;
}
input[type=range]::-moz-range-thumb:hover {
  transform: scale(1.25);
  background: var(--cream);
}


/* ---------- DISEÑO RESPONSIVO ---------- */
@media (max-width: 960px) {
  .player {
    grid-template-columns: 150px 1fr auto; /* Oculta barras en tablets */
  }
  .scrub, .volwrap {
    display: none;
  }
}