/**
 * Artist Card Component Styles
 *
 * Reusable artist card with image, metadata, favorite, audio, and rating.
 * Responsive: horizontal on desktop, vertical on mobile.
 */

/* ============================================
   CARD CONTAINER
   ============================================ */

.artist-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    padding: var(--space-2, 8px);
    margin: 0 -8px;
    background: transparent;
    border-radius: var(--radius-lg, 12px);
    transition: background 0.2s ease;
    cursor: pointer;
}

.artist-card:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .artist-card {
        flex-direction: row;
        gap: var(--space-3, 12px);
        padding: var(--space-2, 8px);
    }
}

/* ============================================
   ARTIST IMAGE
   ============================================ */

.artist-card__image {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.artist-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.artist-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-md, 8px);
    font-size: 16px;
    font-weight: 700;
    color: white;
}

/* ============================================
   ARTIST INFO
   ============================================ */

.artist-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Row 1: Name + Heart on left, Controls on right */
.artist-card__top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.artist-card__name-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.artist-card__name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary, #fff);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Row 2: Metadata on left, Song title on right */
.artist-card__bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.artist-card__meta {
    font-size: 12px;
    color: var(--text-tertiary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================
   AUDIO CONTROLS
   ============================================ */

.artist-card__controls {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    /* No gap - use margin on rating instead for smooth animation */
}

.artist-card__play-btn {
    position: relative;
    width: 26px;
    height: 36px; /* Larger tap target */
    margin-top: -5px; /* Overflow above row */
    margin-bottom: -5px; /* Overflow below row */
    padding: 0;
    background: transparent;
    border: none;
    color: #1DB954;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

/* Visual circle - stays 26x26 */
.artist-card__play-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 26px;
    height: 26px;
    background: rgba(29, 185, 84, 0.2);
    border-radius: 50%;
    transition: background 0.15s ease;
}

.artist-card__play-btn:hover::before {
    background: rgba(29, 185, 84, 0.3);
}

.artist-card__play-btn:hover {
    transform: scale(1.05);
}

.artist-card__play-btn svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    transition: opacity 0.15s ease;
    z-index: 1; /* Above the ::before */
}

/* Show play icon by default, hide pause */
.artist-card__play-icon {
    opacity: 1;
}

.artist-card__pause-icon {
    opacity: 0;
}

/* When playing, show pause icon, hide play */
.artist-card__play-btn.playing .artist-card__play-icon {
    opacity: 0;
}

.artist-card__play-btn.playing .artist-card__pause-icon {
    opacity: 1;
}

/* Loading state */
.artist-card__play-btn.loading {
    opacity: 0.6;
    cursor: wait;
}

/* Error state */
.artist-card__play-btn.error::before {
    background: rgba(239, 68, 68, 0.2);
}

.artist-card__play-btn.error {
    color: #ef4444;
}

.artist-card__song-title {
    font-size: 12px;
    color: var(--text-tertiary, rgba(255, 255, 255, 0.3));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    /* Hidden by default - revealed on play */
    opacity: 0;
    transform: translateX(12px);
    pointer-events: none;
    transition: opacity 200ms ease-out, transform 200ms ease-out;
    transition-delay: 50ms; /* Slight stagger after thumbs */
}

/* Expanded state - show song title */
.artist-card.expanded .artist-card__song-title {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* ============================================
   RATING (THUMBS UP/DOWN)
   ============================================ */

.artist-card__rating {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    /* Hidden by default - collapsed width so play button stays right */
    opacity: 0;
    max-width: 0;
    margin-right: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 200ms ease-out, max-width 200ms ease-out, margin-right 200ms ease-out;
}

/* Expanded state - show rating controls (slides left, play stays in place) */
.artist-card.expanded .artist-card__rating {
    opacity: 1;
    max-width: 55px; /* Enough for two thumb buttons + gap */
    margin-right: 6px;
    pointer-events: auto;
}

.artist-card__thumb {
    width: 22px;
    height: 36px; /* Larger tap target */
    margin-top: -7px; /* Overflow above row */
    margin-bottom: -7px; /* Overflow below row */
    padding: 0;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.artist-card__thumb svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.artist-card__thumb:hover {
    color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

/* Active states */
.artist-card__thumb--up.artist-card__thumb--active {
    color: #22c55e; /* Green */
}

.artist-card__thumb--down.artist-card__thumb--active {
    color: #ef4444; /* Red */
}

/* Loading state */
.artist-card__thumb.loading {
    opacity: 0.5;
    cursor: wait;
}

/* ============================================
   FAVORITE BUTTON
   ============================================ */

.artist-card__favorite {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* Override favorite button - larger tap target */
.artist-card .fav-btn {
    opacity: 1;
    width: 22px;
    height: 36px; /* Larger tap target */
    margin-top: -7px; /* Overflow above row */
    margin-bottom: -7px; /* Overflow below row */
    display: flex;
    align-items: center;
    justify-content: center;
}

.artist-card .fav-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ============================================
   SIZE VARIANTS
   ============================================ */

.artist-card--small .artist-card__image {
    width: 48px;
    height: 48px;
}

.artist-card--small .artist-card__name {
    font-size: 14px;
}

.artist-card--small .artist-card__meta,
.artist-card--small .artist-card__song-title {
    font-size: 12px;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .artist-card__song-title {
        font-size: 11px;
    }
}

/* ============================================
   STATES
   ============================================ */

/* Disable hover on cards when clicking buttons */
.artist-card:has(button:hover) {
    cursor: default;
}

/* Visual feedback when card is clicked (not buttons) */
.artist-card:active:not(:has(button:active)) {
    transform: scale(0.98);
}
