/* ════════════════════════════════════════════
   TIDAL NOW PLAYING v2 — Widget CSS
   Temas: dark | light | glass
   Portadas: plain | vinyl
════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');

.tnp-widget {
  --tnp-radius:  14px;
  --tnp-font:    'DM Sans', -apple-system, sans-serif;
  --tnp-accent:  #00E8C6;
  --tnp-green:   #1fda6e;

  display:       flex;
  width:         100%;
  max-width:     500px;
  border-radius: var(--tnp-radius);
  overflow:      hidden;
  font-family:   var(--tnp-font);
  position:      relative;
  box-sizing:    border-box;
}

/* ── Temas ── */
.tnp-theme-dark {
  --tnp-bg:     #0e0e0e;
  --tnp-bg2:    #1a1a1a;
  --tnp-text:   #f0f0f0;
  --tnp-sub:    #777;
  --tnp-border: rgba(255,255,255,0.07);
  background:   var(--tnp-bg);
  box-shadow:   0 12px 50px rgba(0,0,0,0.7), 0 0 0 1px var(--tnp-border);
}

.tnp-theme-light {
  --tnp-bg:     #fafafa;
  --tnp-bg2:    #f0f0f0;
  --tnp-text:   #111;
  --tnp-sub:    #777;
  --tnp-border: rgba(0,0,0,0.07);
  background:   var(--tnp-bg);
  box-shadow:   0 4px 30px rgba(0,0,0,0.1), 0 0 0 1px var(--tnp-border);
}

.tnp-theme-glass {
  --tnp-bg:     rgba(10,10,10,0.5);
  --tnp-bg2:    rgba(255,255,255,0.05);
  --tnp-text:   #fff;
  --tnp-sub:    rgba(255,255,255,0.5);
  --tnp-border: rgba(255,255,255,0.12);
  background:   var(--tnp-bg);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:   0 8px 40px rgba(0,0,0,0.4), 0 0 0 1px var(--tnp-border);
}

/* ── States ── */
.tnp-state { width: 100%; display: flex; align-items: center; }

/* Loading */
.tnp-loading {
  padding:   20px 24px;
  gap:       12px;
  color:     var(--tnp-sub);
  font-size: 0.83rem;
  font-weight: 500;
}
.tnp-spinner {
  width:  18px; height: 18px;
  border: 2px solid var(--tnp-border);
  border-top-color: var(--tnp-accent);
  border-radius: 50%;
  animation: tnp-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes tnp-spin { to { transform: rotate(360deg); } }

/* Idle */
.tnp-idle { padding: 18px 20px; flex-direction: column; align-items: flex-start; gap: 12px; }
.tnp-idle-body { display: flex; align-items: center; gap: 12px; }
.tnp-idle-icon { color: var(--tnp-sub); opacity: .4; }
.tnp-idle-icon svg { display: block; }
.tnp-idle-text { display: flex; flex-direction: column; gap: 2px; }
.tnp-idle-title { color: var(--tnp-text); font-weight: 700; font-size: .87rem; }
.tnp-idle-sub   { color: var(--tnp-sub);  font-size: .75rem; }

/* Error */
.tnp-error { padding: 18px 22px; gap: 10px; font-size: .82rem; color: #ff6b6b; }

/* ── Playing ── */
.tnp-playing { align-items: stretch; }

/* Cover plain */
.tnp-cover-plain {
  width: 120px; min-width: 120px;
  position: relative; flex-shrink: 0; overflow: hidden;
}
.tnp-cover-plain .tnp-cover {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: opacity .35s ease;
}
.tnp-cover-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, var(--tnp-bg) 0%, transparent 55%);
  pointer-events: none;
}

/* Cover vinyl */
.tnp-cover-vinyl {
  width: 126px; min-width: 126px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tnp-bg2);
  flex-shrink: 0; position: relative;
}
.tnp-cover-vinyl .tnp-cover        { display: none; }
.tnp-cover-vinyl .tnp-cover-overlay { display: none; }

.tnp-vinyl {
  width: 90px; height: 90px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  animation: tnp-vspin 4s linear infinite;
  box-shadow: 0 4px 24px rgba(0,0,0,.55);
  position: relative;
  flex-shrink: 0;
}
.tnp-vinyl-grooves {
  position: absolute; inset: 0; border-radius: 50%;
  background: repeating-radial-gradient(
    circle at center,
    transparent 0, transparent 5px,
    rgba(0,0,0,.18) 5px, rgba(0,0,0,.18) 6px
  );
}
.tnp-vinyl-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--tnp-bg);
  box-shadow: 0 0 0 3px var(--tnp-accent);
}
@keyframes tnp-vspin { to { transform: rotate(360deg); } }

/* Info */
.tnp-info {
  flex: 1; padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0; justify-content: center;
}

/* Top row */
.tnp-top-row {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  margin-bottom: 5px; flex-wrap: wrap;
}

/* Badge */
.tnp-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .58rem; font-weight: 700;
  letter-spacing: .13em; text-transform: uppercase;
  color: var(--tnp-sub);
}
.tnp-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--tnp-green);
  animation: tnp-pulse 1.5s ease-in-out infinite; flex-shrink: 0;
}
@keyframes tnp-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%     { opacity:.35; transform:scale(.65); }
}

/* Track text */
.tnp-track-title {
  margin: 0; font-size: .97rem; font-weight: 700;
  color: var(--tnp-text); line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tnp-track-artist {
  margin: 0; font-size: .8rem;
  color: var(--tnp-sub);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tnp-track-album {
  margin: 0; font-size: .72rem;
  color: var(--tnp-sub); opacity: .65;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Actions */
.tnp-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; flex-wrap: wrap;
}
.tnp-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 600;
  text-decoration: none; opacity: .75;
  transition: opacity .2s; white-space: nowrap;
}
.tnp-link:hover { opacity: 1; }
.tnp-link svg   { flex-shrink: 0; }
.tnp-link-tidal  { color: var(--tnp-accent); }
.tnp-link-lastfm { color: var(--tnp-sub); }

/* ── User chip ── */
.tnp-user-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--tnp-bg2); border: 1px solid var(--tnp-border);
  border-radius: 99px; padding: 3px 8px 3px 3px;
  text-decoration: none; flex-shrink: 0;
  transition: background .2s, border-color .2s;
}
a.tnp-user-chip:hover {
  background: rgba(0,232,198,.1);
  border-color: rgba(0,232,198,.35);
}
.tnp-user-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--tnp-accent); color: #000;
  font-size: .58rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.tnp-user-name {
  font-size: .7rem; font-weight: 600;
  color: var(--tnp-text); white-space: nowrap;
  max-width: 90px; overflow: hidden; text-overflow: ellipsis;
}
.tnp-user-follow {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .6rem; font-weight: 700;
  color: var(--tnp-accent); white-space: nowrap;
}
.tnp-user-idle { width: 100%; }

/* ── Responsive ── */
@media (max-width: 440px) {
  .tnp-cover-plain { width: 96px; min-width: 96px; }
  .tnp-cover-vinyl { width: 100px; min-width: 100px; }
  .tnp-vinyl       { width: 74px; height: 74px; }
  .tnp-info        { padding: 12px 13px; }
  .tnp-track-title { font-size: .88rem; }
  .tnp-user-name   { max-width: 66px; }
}

@media (max-width: 320px) {
  .tnp-playing { flex-direction: column; }
  .tnp-cover-plain,
  .tnp-cover-vinyl { width: 100%; min-width: unset; height: 100px; }
  .tnp-cover-plain .tnp-cover { height: 100px; }
  .tnp-cover-overlay {
    background: linear-gradient(to bottom, transparent 40%, var(--tnp-bg) 100%);
  }
}
