/**
 * Spotify Embed Replacement Styles
 */

/* Base embed container */
.spotify-embed-replacement,
.spotify-track-embed,
.spotify-playlist-embed,
.spotify-artist-embed,
.spotify-album-embed {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    transition: all 0.2s ease;
    margin: 1rem 0;
}

.spotify-embed-replacement:hover,
.spotify-track-embed:hover,
.spotify-playlist-embed:hover,
.spotify-artist-embed:hover,
.spotify-album-embed:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Track preview specific padding */
#track-preview {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

#track-preview .spotify-track-embed,
#track-preview .spotify-embed-replacement {
    margin: 0;
}

/* Additional spacing inside embeds */
.spotify-track-embed .d-flex,
.spotify-playlist-embed .d-flex,
.spotify-artist-embed .d-flex,
.spotify-album-embed .d-flex {
    gap: 1.5rem;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .spotify-embed-replacement,
    .spotify-track-embed,
    .spotify-playlist-embed,
    .spotify-artist-embed,
    .spotify-album-embed {
        background: #1f2937;
        border-color: #374151;
        color: #f3f4f6;
    }
    
    .spotify-link {
        color: #9ca3af;
    }
    
    .spotify-link:hover {
        color: #6b7280;
    }
}

/* Image styles */
.spotify-embed-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

/* Circular images for artists */
.spotify-embed-image-circle {
    border-radius: 50%;
}

/* Placeholder for missing images */
.spotify-embed-placeholder {
    width: 80px;
    height: 80px;
    background: #f3f4f6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Circular placeholder for artists */
.spotify-embed-placeholder-circle {
    border-radius: 50%;
}

.spotify-embed-placeholder i {
    font-size: 2rem;
    color: #9ca3af;
}

/* Text styles */
.spotify-embed-title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 0.25rem;
    color: #111827;
    
    /* Truncate long titles */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.spotify-embed-artist {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
    
    /* Truncate long artist names */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spotify-embed-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    
    /* Truncate */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dark mode text */
@media (prefers-color-scheme: dark) {
    .spotify-embed-title {
        color: #f3f4f6;
    }
    
    .spotify-embed-artist {
        color: #d1d5db;
    }
    
    .spotify-embed-meta {
        color: #9ca3af;
    }
    
    .spotify-embed-placeholder {
        background: #374151;
    }
}

/* Spotify link */
.spotify-link {
    color: #6b7280;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.spotify-link:hover {
    color: #374151;
    transform: scale(1.1);
    text-decoration: none;
    background: none !important;
    box-shadow: none !important;
}

.spotify-link:focus {
    outline: none !important;
    box-shadow: none !important;
}

.spotify-link svg {
    width: 20px;
    height: 20px;
}

/* Loading state */
.spotify-embed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Error state */
.spotify-embed-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #ef4444;
    font-size: 0.875rem;
    text-align: center;
}

.spotify-embed-error i {
    font-size: 1.25rem;
    margin-right: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .spotify-embed-image,
    .spotify-embed-placeholder {
        width: 60px;
        height: 60px;
    }
    
    .spotify-embed-title {
        font-size: 0.875rem;
    }
    
    .spotify-embed-artist {
        font-size: 0.75rem;
    }
    
    .spotify-embed-meta {
        font-size: 0.7rem;
    }
    
    .btn-spotify {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Stack button below on very small screens */
    @media (max-width: 400px) {
        .spotify-track-embed {
            padding: 10px;
        }

        .spotify-track-embed .d-flex {
            gap: 1rem;
        }

        .spotify-link {
            margin-top: 0.75rem;
        }
    }
}

/* Compact mode for smaller contexts */
.spotify-embed-compact .spotify-embed-image,
.spotify-embed-compact .spotify-embed-placeholder {
    width: 48px;
    height: 48px;
}

.spotify-embed-compact .spotify-embed-title {
    font-size: 0.875rem;
    -webkit-line-clamp: 1;
}

.spotify-embed-compact .spotify-embed-artist,
.spotify-embed-compact .spotify-embed-meta {
    font-size: 0.75rem;
}

/* Integration with existing styles */
.spotify-embed-container {
    margin: 1rem 0;
}