/* ══════════════════════════════════════════
   RELAY — Cards (station cards)
   ══════════════════════════════════════════ */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.featured-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* ── Station card ── */
.station-card {
  background: var(--relay-surface);
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--relay-transition);
  position: relative;
  display: flex;
  flex-direction: column;
}

.station-card:hover {
  border-color: var(--relay-border-active);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.station-card.playing {
  border-color: var(--relay-cyan);
  box-shadow: 0 0 0 1px var(--relay-cyan-dim), 0 8px 24px rgba(6, 182, 212, 0.15);
}

/* ── Card image area ── */
.card-img-area {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--relay-surface-2);
}

.card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 16px;
  background: var(--relay-surface-2);
}

/* Quand l'image a échoué → on la masque via JS (class .img-error) */
.card-img.img-error {
  display: none;
}

/* Placeholder visible par défaut, caché si logo présent (.img-behind) */
.card-img-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: var(--relay-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--relay-cyan);
  font-size: 2.5rem;
  opacity: 0.5;
}

/* Caché derrière l'image quand le logo est disponible
   (redevient visible si l'image échoue via .img-error) */
.card-img-placeholder.img-behind {
  z-index: 0;
}
.card-img {
  z-index: 1;
}

/* ── Chip count ── */
.chip-count {
  opacity: 0.5;
  font-size: 0.7rem;
}

/* ── Card body ── */
.card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--relay-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-genre {
  font-size: 0.75rem;
  color: var(--relay-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-country {
  font-size: 0.75rem;
  color: var(--relay-text-muted);
  flex-shrink: 0;
}

/* ── Card actions ── */
.card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--relay-transition);
}

.station-card:hover .card-actions {
  opacity: 1;
}

.card-action-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: var(--relay-text-dim);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--relay-transition);
  backdrop-filter: blur(4px);
}

.card-action-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  color: var(--relay-cyan);
}

.card-action-btn.favorited {
  color: #ef4444;
}

/* ── Playing indicator on card ── */
.card-playing-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 99px;
  background: var(--relay-gradient);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
}

.station-card.playing .card-playing-badge {
  display: flex;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }

  .card-actions {
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
