/**
 * Search Autocomplete Styles for Articles Page
 */

.search-autocomplete-container {
    position: relative;
    width: 100%;
    z-index: 10000;
}

.search-autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    max-height: 500px;
    overflow-y: auto;
    z-index: 99999;
    animation: slideDown 0.2s ease-out;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-results {
    padding: 8px;
}

.autocomplete-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-color: #3b82f6;
    transform: translateX(-2px);
}

.autocomplete-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.autocomplete-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.autocomplete-content {
    flex: 1;
    min-width: 0;
    text-align: right;
}

.autocomplete-title {
    font-family: 'Alegreya', serif;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
    line-height: 1.4;
}

.autocomplete-item:hover .autocomplete-title,
.autocomplete-item.selected .autocomplete-title {
    color: #2563eb;
}

.autocomplete-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.autocomplete-category {
    display: inline-flex;
    padding: 2px 8px;
    background: #f59e0b;
    color: white;
    font-size: 12px;
    font-weight: 500;
    border-radius: 6px;
    font-family: 'Alegreya', serif;
}

.autocomplete-excerpt {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 4px;
}

.autocomplete-item mark {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

.autocomplete-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
    font-family: 'Alegreya', serif;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

.autocomplete-no-results,
.autocomplete-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #6b7280;
    font-family: 'Alegreya', serif;
    text-align: center;
}

.autocomplete-no-results strong {
    color: #1f2937;
}

.autocomplete-error {
    color: #ef4444;
}

.search-autocomplete-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 8px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 8px;
}

.search-autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

@media (max-width: 768px) {
    .search-autocomplete-dropdown {
        max-height: 400px;
        border-radius: 12px;
    }

    .autocomplete-item {
        padding: 10px;
        gap: 10px;
    }

    .autocomplete-image {
        width: 50px;
        height: 50px;
    }

    .autocomplete-title {
        font-size: 15px;
    }

    .autocomplete-excerpt {
        font-size: 13px;
    }
}
