/* --- Variables de Color y Tipografía de Spotify --- */
:root {
  --font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  
  --background-base: #080808;
  --background-highlight:#9af894;
  --background-press: #000;
  --background-elevated-base: #fafafa;
  --background-elevated-highlight: #ffffff;
  
  --text-base: #070707;
  --text-subdued: #a7a7a7;
  --text-bright-accent: #1ed760; /* Verde Spotify */
  
  --essential-base: #ffffff;
  --essential-subdued: #727272;
  
  --decorative-subdued: #393939;

  --card-radius: 8px;
  --container-padding: 24px;
}

/* --- Reseteo y Estilos Globales --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--background-base);
  color: var(--text-base);
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  color: var(--text-base);
  font-weight: 700;
  margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; }

p {
  color: var(--text-subdued);
}

a, .btn-link {
  color: var(--text-bright-accent);
  text-decoration: none;
  cursor: pointer;
}
a:hover, .btn-link:hover {
  text-decoration: underline;
}

.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.muted {
  color: var(--text-subdued);
}

/* --- Layout Principal (Grid) --- */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr; /* Dos columnas de igual tamaño */
  gap: var(--container-padding);
  padding-top: var(--container-padding);
}

.left-col, .right-col {
  display: flex;
  flex-direction: column;
  gap: var(--container-padding);
}

/* --- Cabecera --- */
.header {
  background-color: var(--background-elevated-base);
  padding: 16px 0;
  border-bottom: 1px solid var(--decorative-subdued);
}
.header-grid {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* --- Tarjetas (Cards) --- */
.card {
  background-color: var(--background-elevated-base);
  border-radius: var(--card-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.card-header h3 {
  margin-bottom: 0;
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.small-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--container-padding);
    padding: 0;
    background: none;
}
.card-short {
    background-color: var(--background-elevated-base);
    border-radius: var(--card-radius);
    padding: 20px;
}
.compact-list {
    list-style: none;
    padding-left: 0;
    font-size: 14px;
}
.compact-list li {
    padding: 4px 0;
    border-bottom: 1px solid var(--decorative-subdued);
}
.compact-list li:last-child {
    border-bottom: none;
}

/* --- Listas (Top Canciones) --- */
.list {
  display: flex;
  flex-direction: column;
}
.list-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 6px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}
.list-item:hover {
  background-color: var(--background-highlight);
}
.list-rank {
  font-size: 1rem;
  color: var(--text-subdued);
  width: 30px;
  text-align: center;
  flex-shrink: 0;
}
.list-main {
  flex-grow: 1;
  margin-left: 16px;
}
.list-title {
  font-weight: 600;
  color: var(--text-base);
}
.list-sub {
  color: var(--text-subdued);
  font-size: 0.875rem;
}
.list-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--text-subdued);
}
.plays {
  font-weight: bold;
}

/* --- Tablas --- */
.table-wrapper {
  overflow-y: auto;
  max-height: 400px; /* Altura por defecto */
}
.small-scroll {
    max-height: 300px;
}
.table-compact {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table-compact th, .table-compact td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--decorative-subdued);
}
.table-compact thead th {
  color: var(--text-subdued);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 12px;
  position: sticky;
  top: 0;
  background-color: var(--background-elevated-base);
}
.table-compact tbody tr:hover {
  background-color: var(--background-highlight);
}
.table-compact tbody td {
    color: var(--text-subdued);
}
.table-compact tbody td.station-name,
.table-compact tbody td.play-title {
    color: var(--text-base);
    font-weight: 500;
}

/* --- Formularios y Botones --- */
button, select, input {
  font-family: inherit;
  font-size: 14px;
  border-radius: 50px;
  border: 1px solid transparent;
  padding: 8px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-outline {
  background-color: transparent;
  border: none;
  color: transparent;
  padding: 0;
  margin: 0;
  box-shadow: none;
}
.btn-outline:hover {
  transform: none;
}


.btn-ghost {
  background-color: transparent;
  color: var(--text-subdued);
  border: none;
}
.btn-ghost:hover {
  color: var(--text-base);
}

.btn-primary {
    background-color: var(--text-bright-accent);
    color: var(--background-press);
    font-weight: bold;
    border: none;
}
.btn-primary:hover {
    transform: scale(1.05);
    background-color: #22f26e;
}

.select-sm, .input-sm {
  background-color: var(--background-elevated-highlight);
  color: var(--text-base);
  border: 1px solid var(--decorative-subdued);
  padding: 6px 12px;
}
.select-sm:focus, .input-sm:focus {
  outline: none;
  border-color: var(--essential-base);
}
.form-inline {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.form-inline input {
    flex-grow: 1;
    border-radius: 6px;
}

/* --- Modal --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 1000;
}
.modal.open {
  opacity: 1;
  visibility: visible;
}
.modal-panel {
  background-color: var(--background-elevated-highlight);
  padding: 30px;
  border-radius: var(--card-radius);
  width: 90%;
  max-width: 600px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-panel.large {
    max-width: 800px;
}
.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-subdued);
  cursor: pointer;
}
.modal-close:hover {
  color: var(--text-base);
}
.modal-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin: 20px 0;
    padding: 16px;
    background-color: var(--background-highlight);
    border-radius: 6px;
}
.breakdown-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 16px 0;
}
.breakdown-row {
    background-color: var(--background-highlight);
    padding: 8px 12px;
    border-radius: 4px;
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 20px 0;
  color: var(--text-subdued);
  font-size: 0.8rem;
  border-top: 1px solid var(--decorative-subdued);
  margin-top: var(--container-padding);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 12px;
}
::-webkit-scrollbar-track {
  background: var(--background-elevated-base);
}
::-webkit-scrollbar-thumb {
  background-color: var(--essential-subdued);
  border-radius: 20px;
  border: 3px solid var(--background-elevated-base);
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-subdued);
}

/* --- Media Queries --- */
@media (max-width: 1024px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
    .header-grid {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    .card-header, .card-actions {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .small-cards {
        grid-template-columns: 1fr;
    }
}

/* ========================================================= */
/* --- MEJORA SPOTIFY: Cuadrículas y Tarjetas con imágenes --- */
/* ========================================================= */

/* ========================================================= */
/* === SECCIÓN TOP GLOBAL (Estilo Spotify Web Real) === */
/* ========================================================= */

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.album-card {
  background-color: var(--background-elevated-base);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  overflow: hidden;
}

.album-card:hover {
  background-color: var(--background-elevated-highlight);
  transform: scale(1.03);
}

.album-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 10px;
  display: block;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.album-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-base);
  margin-bottom: 3px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-card p {
  font-size: 0.8rem;
  color: var(--text-subdued);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Adaptable a pantallas pequeñas === */
@media (max-width: 900px) {
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
  }
}

@media (max-width: 600px) {
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
  .album-card h3 {
    font-size: 0.8rem;
  }
  .album-card p {
    font-size: 0.75rem;
  }
  /* 🔧 Corrección de tamaños de imagen */
.thumb,
.station-logo,
.artist-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
}

/* Opcional: mejora visual en tablas */
.station-name img {
  margin-right: 6px;
  vertical-align: middle;
}

/* Asegura que las imágenes nunca se desborden */
img {
  max-width: 100%;
  height: auto;
  display: inline-block;
}

}
/* ========================================================= */
/* === CORRECCIÓN FINAL IMÁGENES (Estilo Spotify Escritorio) === */
/* ========================================================= */

/* Imágenes pequeñas como portadas, artistas, estaciones */
.thumb,
.station-logo,
.artist-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-block;
}

/* Imágenes dentro de tablas o listas */
.station-name img,
.play-title img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Evitar desbordes de imágenes en general */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Imágenes de álbum (cuadradas, como en Spotify Web) */
.album-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}
