/**
 * Artist Autocomplete Component Styles
 *
 * Provides styling for the ArtistAutocomplete component.
 * Uses design tokens from design-tokens.css for consistency.
 */

/* ==================== WRAPPER ==================== */
.artist-autocomplete-wrapper {
    position: relative;
    width: 100%;
}

/* ==================== INPUT ==================== */
.artist-autocomplete-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    padding-right: 40px; /* Space for clear button */
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: inherit;
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    box-sizing: border-box;
}

.artist-autocomplete-input::placeholder {
    color: var(--text-tertiary);
}

.artist-autocomplete-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-primary-bg-10);
}

/* ==================== CLEAR BUTTON ==================== */
.artist-autocomplete-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: background-color var(--transition-fast), color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.artist-autocomplete-clear:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ==================== DROPDOWN ==================== */
.artist-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
}

/* Custom scrollbar for dropdown */
.artist-autocomplete-dropdown::-webkit-scrollbar {
    width: var(--scrollbar-width);
}

.artist-autocomplete-dropdown::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: var(--radius-lg);
}

.artist-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-lg);
}

.artist-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ==================== RESULT ITEMS ==================== */
.artist-autocomplete-item {
    display: flex;
    align-items: center;
    padding: var(--space-3);
    cursor: pointer;
    border-bottom: 1px solid var(--border-primary);
    transition: background-color var(--transition-fast);
}

.artist-autocomplete-item:last-child {
    border-bottom: none;
}

.artist-autocomplete-item:hover,
.artist-autocomplete-item.highlighted {
    background: var(--bg-hover);
}

/* Artist image */
.artist-autocomplete-item .artist-image {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.artist-autocomplete-item .artist-image-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.artist-autocomplete-item .artist-image-placeholder::before {
    content: '';
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23666' viewBox='0 0 24 24'%3E%3Cpath d='M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0.5;
}

/* Artist info section */
.artist-autocomplete-item .artist-info {
    flex: 1;
    min-width: 0;
    margin-left: var(--space-3);
}

.artist-autocomplete-item .artist-name-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.artist-autocomplete-item .artist-name {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.artist-autocomplete-item .artist-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.artist-autocomplete-item .artist-genres {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.artist-autocomplete-item .separator {
    color: var(--text-tertiary);
}

.artist-autocomplete-item .artist-followers {
    white-space: nowrap;
}

/* ==================== BADGES ==================== */
.artist-badge {
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
    flex-shrink: 0;
}

.artist-badge-ready {
    background: var(--accent-primary-bg-15);
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary-bg-20);
}

/* Green dot indicator for artists ready for recommendations */
.artist-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: inline-block;
    flex-shrink: 0;
}

.artist-badge-known {
    background: var(--badge-muted-bg);
    color: var(--badge-muted-text);
}

/* ==================== LOADING STATE ==================== */
.artist-autocomplete-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-6);
    color: var(--text-secondary);
}

.artist-autocomplete-loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--bg-hover);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== EMPTY & ERROR STATES ==================== */
.artist-autocomplete-empty,
.artist-autocomplete-error {
    padding: var(--space-6);
    text-align: center;
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.artist-autocomplete-error {
    color: var(--color-error);
}

/* ==================== MOBILE RESPONSIVE ==================== */
@media (max-width: 600px) {
    .artist-autocomplete-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: var(--space-3);
    }

    .artist-autocomplete-item {
        padding: var(--space-2);
    }

    .artist-autocomplete-item .artist-image {
        width: 40px;
        height: 40px;
    }

    .artist-autocomplete-item .artist-image-placeholder {
        width: 40px;
        height: 40px;
    }

    .artist-autocomplete-item .artist-name {
        font-size: var(--text-sm);
    }

    .artist-autocomplete-item .artist-meta {
        font-size: var(--text-xs);
    }

    .artist-autocomplete-item .artist-genres {
        max-width: 120px;
    }
}

/* ==================== DARK MODE COMPATIBILITY ==================== */
/* Already using design tokens so this is inherently dark-mode ready */

/* ==================== HIGH CONTRAST / ACCESSIBILITY ==================== */
@media (prefers-contrast: high) {
    .artist-autocomplete-input:focus {
        box-shadow: 0 0 0 2px var(--accent-primary);
    }

    .artist-autocomplete-item.highlighted {
        outline: 2px solid var(--accent-primary);
        outline-offset: -2px;
    }
}

/* ==================== REDUCED MOTION ==================== */
@media (prefers-reduced-motion: reduce) {
    .artist-autocomplete-loading .spinner {
        animation: none;
    }

    .artist-autocomplete-input,
    .artist-autocomplete-clear,
    .artist-autocomplete-item {
        transition: none;
    }
}
