/**
 * WIN98 PLAYER RETRO - Estilos mínimos (la mayoría están inline)
 */

/* Estilos base de ventana Win98 */
#playerWindow {
  font-family: 'MS Sans Serif', 'Tahoma', sans-serif;
  display: none;
  position: fixed;
  top: 100px;
  left: 180px;
  width: 640px;
  max-width: calc(100vw - 20px);
  z-index: 300;
  user-select: none;
  overflow: hidden;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  box-shadow: 2px 2px 0 #000;
  background: #c0c0c0;
  box-sizing: border-box;
}

#playerWindow,
#playerWindow * {
  box-sizing: border-box;
}

.wa-titlebar {
  height: 32px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  cursor: grab;
  background: linear-gradient(to bottom, #cc1100, #8b0000);
}

.wa-titlebar:active {
  cursor: grabbing;
}

.wa-titlebar-brand,
.wa-titlebar-controls {
  display: flex;
  align-items: center;
}

.wa-titlebar-brand {
  min-width: 0;
  gap: 6px;
}

.wa-titlebar-icon {
  font-size: 15px;
  line-height: 1;
}

.wa-titlebar-text {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-family: Tahoma, sans-serif;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.3px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-titlebar-controls {
  flex-shrink: 0;
  gap: 3px;
}

.wa-titlebar-btn {
  width: 20px;
  height: 18px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #000;
  background: #d4d0c8;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #404040;
  border-bottom: 1px solid #404040;
  font-size: 10px;
  font-weight: bold;
  line-height: 1;
}

.wa-player-body {
  padding: 22px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  background: #c0c0c0;
}

.wa-album-box {
  width: 180px;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  background: #333;
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

.wa-album-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.wa-album-placeholder {
  display: none;
  font-size: 48px;
  opacity: 0.4;
}

.wa-info-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.wa-field-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

/* Artist y Track forman un mismo bloque; la barra y el transporte necesitan
   más aire para que se lean como controles separados. */
.wa-field-row + .wa-field-row {
  margin-top: -6px;
}

.wa-field-label {
  color: #000;
  font-family: Tahoma, sans-serif;
  font-size: 12px;
  font-weight: bold;
}

.wa-field-value {
  min-width: 0;
  min-height: 38px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
  color: #000;
  background: #f0f0f0;
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  font-family: Tahoma, sans-serif;
  font-size: 12px;
}

.wa-artist-field {
  color: #555;
}

.wa-track-field {
  cursor: pointer;
}

.wa-track-title {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-progress-bar {
  height: 24px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  background: #d4d0c8;
  border-top: 2px solid #808080;
  border-left: 2px solid #808080;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  margin-top: 4px;
}

.wa-progress-fill {
  width: 0%;
  height: 100%;
  background: #555;
}

.wa-progress-head {
  width: 0;
  height: 0;
  position: absolute;
  top: 0;
  left: 0%;
}

.wa-transport-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 2px;
  padding-top: 4px;
}

.wa-transport-button {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #000;
  background: #d4d0c8;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  font-family: Tahoma, sans-serif;
  font-size: 14px;
}

/* Ícono de pausa dibujado en CSS (dos barras), en vez del carácter "⏸"
   (U+23F8). Ese Unicode no existe en Tahoma, así que el navegador cae a
   la fuente de emoji del sistema -- en iOS el variation selector U+FE0E
   lo arregla, pero en Android sigue mostrando un glyph raro/a color de
   todas formas. Dibujarlo directo evita depender de cualquier fuente. */
.wa-pause-icon {
  display: inline-block;
  width: 10px;
  height: 13px;
  position: relative;
  vertical-align: -1px;
}

.wa-pause-icon::before,
.wa-pause-icon::after {
  content: '';
  position: absolute;
  top: 0;
  width: 3px;
  height: 100%;
  background: currentColor;
}

.wa-pause-icon::before {
  left: 0;
}

.wa-pause-icon::after {
  right: 0;
}

/* Botones del reproductor con efectos hover */
#playerWindow button,
#playerWindow div[onclick] {
  transition: all 0.05s;
}

/* Los 5 botones de transporte (« » ▶/⏸ ■ ⏸) son <button> nativos, a
   diferencia del resto de controles de la UI que son <div onclick> --
   sin esto, iOS/Safari les pinta su propio "anillo de foco" nativo (con
   el color de acento del sistema, naranja o azul según el dispositivo)
   por encima del estilo Win98 en cuanto reciben foco tras un tap, y ese
   foco se queda pegado hasta que otro elemento lo roba. appearance:none
   los aplana a apariencia custom, y el reset de :focus/:focus-visible
   evita que quede ese tinte de color después de tocarlos. */
#playerWindow button {
  -webkit-appearance: none;
  appearance: none;
}

#playerWindow button:focus,
#playerWindow button:focus-visible {
  outline: none;
  background: #d4d0c8;
  box-shadow: none;
}

#playerWindow button:hover,
#playerWindow div[onclick]:hover {
  opacity: 0.95;
  filter: brightness(1.05);
}

#playerWindow button:active,
#playerWindow div[onclick]:active {
  filter: brightness(0.9);
}

/* Canvas del visualizador (oculto en este diseño) */
#vizCanvas {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Animación de apertura del reproductor */
@keyframes playerSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#playerWindow[style*='display: block'],
#playerWindow[style*='display: '] {
  animation: playerSlideIn 0.2s ease-out;
}

/* Responsive - ajustes para móvil */
@media (max-width: 580px) {
  #playerWindow {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 42px);
    /* left/top: en cascada por JS, ver window-manager.js showWindow(). */
    overflow: hidden;
  }

  .wa-titlebar {
    height: 34px;
    padding: 4px 5px;
  }

  .wa-titlebar-btn {
    width: 28px;
    height: 26px;
  }

  .wa-player-body {
    max-height: calc(100dvh - 76px);
    padding: 14px;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    overflow-y: auto;
  }

  .wa-album-box {
    width: 128px;
    height: 128px;
    justify-self: center;
  }

  .wa-info-panel {
    gap: 14px;
  }

  .wa-field-row + .wa-field-row {
    margin-top: -4px;
  }

  .wa-field-row {
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 8px;
  }

  .wa-field-value {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 11px;
  }

  .wa-progress-bar {
    height: 22px;
    margin-top: 2px;
  }

  .wa-transport-controls {
    gap: 8px;
    margin-top: 2px;
    padding-top: 2px;
  }

  .wa-transport-button {
    min-height: 44px;
    padding: 6px 4px;
  }
}

@media (max-width: 360px) {
  .wa-player-body {
    padding: 12px;
    gap: 12px;
  }

  .wa-album-box {
    width: 112px;
    height: 112px;
  }

  .wa-transport-controls {
    gap: 6px;
  }
}

/* Tablet */
@media (max-width: 768px) and (min-width: 581px) {
  #playerWindow {
    width: 90vw !important;
    max-width: 620px !important;
    max-height: calc(100dvh - 42px);
    top: min(8vh, 60px) !important;
    left: calc((100vw - min(90vw, 620px)) / 2) !important;
    right: auto !important;
    transform: none !important;
  }

  .wa-player-body {
    max-height: calc(100dvh - 76px);
    padding: 18px;
    grid-template-columns: 148px minmax(0, 1fr);
    gap: 18px;
    overflow-y: auto;
  }

  .wa-album-box {
    width: 148px;
    height: 148px;
  }

  .wa-transport-controls {
    gap: 8px;
  }

  .wa-transport-button {
    min-height: 42px;
    padding: 7px 6px;
  }
}

/* Teléfonos y tablets táctiles en horizontal suelen superar los 768px de
   ancho. Mantener aquí el layout compacto evita que vuelvan al espaciado de
   escritorio solo por rotar el dispositivo. */
@media (hover: none) and (pointer: coarse) and (max-width: 1024px) and (orientation: landscape) {
  #playerWindow {
    width: min(90vw, 620px) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 42px);
    top: 20px !important;
    left: calc((100vw - min(90vw, 620px)) / 2) !important;
    right: auto !important;
    transform: none !important;
  }

  .wa-player-body {
    max-height: calc(100dvh - 76px);
    padding: 14px;
    grid-template-columns: 132px minmax(0, 1fr);
    gap: 16px;
    overflow-y: auto;
  }

  .wa-album-box {
    width: 132px;
    height: 132px;
  }

  .wa-info-panel {
    gap: 10px;
  }

  .wa-field-row + .wa-field-row {
    margin-top: -2px;
  }

  .wa-field-value {
    min-height: 34px;
    padding: 6px 8px;
  }

  .wa-progress-bar {
    height: 20px;
    margin-top: 2px;
  }

  .wa-transport-controls {
    gap: 8px;
    margin-top: 2px;
    padding-top: 0;
  }

  .wa-transport-button {
    min-height: 40px;
    padding: 5px 4px;
  }
}
