/**
 * Author Search Dropdown Component
 * Requirements: 12.4
 * 
 * Features:
 * - Dynamic author search with AJAX
 * - Dropdown results display
 * - Author selection
 */

.author-search-dropdown {
    position: relative;
    width: 100%;
    max-width: 300px;
}

.author-search-dropdown__input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.author-search-dropdown__icon {
    position: absolute;
    left: 12px;
    color: #9ca3af;
    pointer-events: none;
}

.author-search-dropdown__input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #ffffff;
    transition: all 0.2s ease;
}

.author-search-dropdown__input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.author-search-dropdown__input::placeholder {
    color: #9ca3af;
}

.author-search-dropdown__clear {
    position: absolute;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.author-search-dropdown__clear:hover {
    background: #f3f4f6;
    color: #111827;
}

.author-search-dropdown__results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
}

.author-search-dropdown__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #6b7280;
}

.author-search-dropdown__loading .spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

.author-search-dropdown__list {
    padding: 4px;
}

.author-search-dropdown__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.author-search-dropdown__item:hover {
    background: #f3f4f6;
}

.author-search-dropdown__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #e5e7eb;
}

.author-search-dropdown__info {
    flex: 1;
    min-width: 0;
}

.author-search-dropdown__name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.author-search-dropdown__username {
    font-size: 13px;
    color: #6b7280;
}

.author-search-dropdown__count {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}

.author-search-dropdown__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    color: #9ca3af;
    text-align: center;
}

.author-search-dropdown__empty svg {
    margin-bottom: 12px;
    opacity: 0.5;
}

.author-search-dropdown__empty p {
    margin: 0;
    font-size: 14px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .author-search-dropdown {
        max-width: 100%;
    }
    
    .author-search-dropdown__results {
        max-height: 240px;
    }
}

/* Dark mode support */
[data-theme="dark"] .author-search-dropdown__input {
    background: #111827;
    border-color: #374151;
    color: #f9fafb;
}

[data-theme="dark"] .author-search-dropdown__input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

[data-theme="dark"] .author-search-dropdown__clear:hover {
    background: #374151;
    color: #f9fafb;
}

[data-theme="dark"] .author-search-dropdown__results {
    background: #1f2937;
    border-color: #374151;
}

[data-theme="dark"] .author-search-dropdown__item:hover {
    background: #374151;
}

[data-theme="dark"] .author-search-dropdown__name {
    color: #f9fafb;
}

[data-theme="dark"] .author-search-dropdown__username {
    color: #9ca3af;
}

[data-theme="dark"] .author-search-dropdown__avatar {
    background: #374151;
}
