* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --card-bg: #ffffff;
  --page-bg: #efefef;
  --accent: #00f39a;
  --muted: #666;
  --border: #e6e6e6;
  --radius: 8px;
  --card-padding: 14px;
  --title-font: "Helvetica Neue", Arial, sans-serif;
}

.chart-list {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* CARD */
.chart-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-right: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

/* RANK column */
.rank-col {
  position: relative;
  width: 62px;
  min-width: 62px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #000;
  margin-right: -14px;
}

.rank-number {
  font-weight: 900;
  font-size: 36px;
  color: #000;
  line-height: 1;
}

.rank-badge {
  display: inline-block;
  font-weight: 700;
  font-size: 15px;
  padding: 6px 6px;
  background: var(--accent);
  color: #000;
  border-radius: 3px;
  margin-top: 8px;
  transform: rotate(-90deg);
  transform-origin: center;
}

/* COVER */
.cover-col {
  width: 100px;
  min-width: 100px;
}

.cover-wrap {
  width: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  border-radius: 4px;
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.solid-cover {
  width: 100%;
  aspect-ratio: 1/1;
  background-color: #933838ff;
  border-radius: 4px;
}

.solid-cover-rank-1 {
  width: 100%;
  aspect-ratio: 1/1;
  background-color: #933838ff;
  border-radius: 4px;
  border-left: 6px solid var(--accent);
}

/* Position/Status column */
.position-status-col {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
}

.c-svg {
  display: inline-block;
}

.c-svg.down {
  transform: rotate(180deg);
  transform-origin: center;
}

/* META */
.meta-col {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.track-title {
  margin: 0;
  font-family: var(--title-font);
  font-size: 16px;
  font-weight: 700;
  color: #000;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

.artist-link {
  display: inline-block;
  color: #333;
  text-decoration: none;
  font-size: 14px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.artist-link:hover {
  text-decoration: underline;
}

/* Right column */
.right-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}

.icons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn,
.pm-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #000;
  cursor: pointer;
  border-radius: 50%;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
}

.pm-btn {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  border: 0;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04) inset;
}

.pm-btn:hover {
  background: #f5f5f5;
}

.stat-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  width: 56px;
  text-align: right;
  line-height: 1.2;
}

.stat-value {
  font-weight: 800;
  font-size: 13px;
  min-width: 26px;
  text-align: center;
}

.mobile-only {
  display: none;
}

.desktop-only {
  display: flex;
}

/* RESPONSIVE */
@media (min-width: 721px) {
  /* Desktop: estilos para rank 1 */
  .rank-col.rank-1 {
    background-color: var(--accent);
  }

  .cover-col.rank-1 {
    width: 195px;
  }

  .cover-img.rank-1 {
    border-left: 6px solid var(--accent);
  }

  .track-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 720px) {
  .chart-list {
    gap: 8px;
  }

  .chart-card {
    gap: 10px;
    padding: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
    position: relative;
  }

  .rank-col {
    width: 35px;
    min-width: 35px;
    margin-right: 0;
    gap: 6px;
  }

  .rank-number {
    font-size: 22px;
    line-height: 1;
  }

  .rank-badge {
    display: none;
  }

  .position-status-col {
    position: absolute;
    left: 10px;
    top: 42px;
    min-width: auto;
    width: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .c-svg {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }

  .c-svg svg {
    width: 14px;
    height: 14px;
    display: block;
  }

  .c-svg.down {
    transform: rotate(180deg);
    transform-origin: center;
  }

  .cover-col {
    width: 60px;
    min-width: 60px;
    margin-left: 5px;
  }

  .cover-wrap {
    border-radius: 6px;
  }

  .meta-col {
    flex: 1;
    width: calc(100% - 115px);
    gap: 6px;
    order: 1;
    min-width: 0;
  }

  .meta-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .track-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
  }

  .artist-link {
    font-size: 13px;
    color: #666;
    line-height: 1.2;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  .right-col {
    position: absolute;
    right: 10px;
    top: 10px;
    width: auto;
    min-width: auto;
    flex-direction: column;
    gap: 4px;
  }

  .icons {
    order: 1;
    flex-direction: column;
  }

  .stat-grid {
    display: none !important;
  }

  .pm-btn {
    width: 30px;
    height: 30px;
  }

  .pm-btn svg {
    width: 16px;
    height: 16px;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: flex;
  }

  .stat-row-mobile {
    display: flex;
    width: 100%;
    gap: 14px;
    justify-content: flex-start;
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    margin-top: 2px;
    flex-wrap: wrap;
  }

  .stat-row-mobile > div {
    display: flex;
    gap: 4px;
    align-items: center;
  }

  .stat-row-mobile .stat-label {
    font-weight: 600;
    width: auto;
    text-align: left;
  }

  .stat-row-mobile .stat-value {
    font-weight: 700;
    min-width: auto;
    text-align: left;
  }
}

/* CHART TITLE Y CONTROLS */
.billboard-chart-page {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.charts-title {
  padding-bottom: 20px;
  padding-top: 15px;
  font-size: 80px;
  font-weight: 900;
  line-height: 1;
  margin: 0;
}

.chart-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.controls-right {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-btn-cabecera {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  color: #000;
  cursor: pointer;
}

.icon-btn-cabecera svg {
  width: 20px;
  height: 20px;
  display: block;
}

.icon-btn-cabecera:hover {
  background: #f5f5f5;
}

.week-badge {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid #000;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
  background: transparent;
  color: #000;
  border-radius: 2px;
}

@media (max-width: 720px) {
  .charts-title {
    font-size: 40px;
  }

  .week-badge {
    font-size: 10px;
    padding: 6px 10px;
  }
}

/* ESTILOS DEL MODAL (mantenidos del archivo original) */
.detail-overlay {
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.detail-overlay.hidden {
  display: none;
}

.detail-box {
  background: #fff;
  border-radius: 12px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
  position: relative;
  padding: 32px;
}

.detail-box-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.detail-box-close:hover {
  background: #f0f0f0;
}

.detail-box-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}

.detail-box-cover {
  width: 240px;
  height: 240px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.detail-box-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.detail-box-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 8px;
  line-height: 1.2;
}

.detail-box-artist {
  font-size: 16px;
  color: #666;
  margin-bottom: 16px;
}

.detail-box-rank {
  font-size: 20px;
  font-weight: 700;
  color: #000;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.detail-box-rank small {
  font-size: 12px;
  color: #999;
  font-weight: 400;
  text-transform: uppercase;
}

.detail-box-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.detail-btn {
  width: 100%;
  padding: 14px 20px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  color: #000;
}

.detail-btn:hover {
  background: #f5f5f5;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.detail-btn svg {
  width: 20px;
  height: 20px;
}

.detail-btn-spotify {
  background: #1db954;
  border-color: #1db954;
  color: #fff;
}

.detail-btn-spotify:hover {
  background: #1ed760;
}

.detail-btn-youtube {
  background: #ff0000;
  border-color: #ff0000;
  color: #fff;
}

.detail-btn-youtube:hover {
  background: #cc0000;
}

.detail-btn-apple {
  background: #fa243c;
  border-color: #fa243c;
  color: #fff;
}

.detail-btn-apple:hover {
  background: #d91e35;
}

@media (max-width: 720px) {
  .detail-box {
    padding: 24px;
  }

  .detail-box-cover {
    width: 200px;
    height: 200px;
  }

  .detail-box-title {
    font-size: 20px;
  }
}
