/**
 * AI Blog Search - Two-Phase Live Search
 * Phase 1: Instant "🔍 Resultados" 
 * Phase 2: Replaces with "⚡ Resultados con IA"
 */

/* ── Dropdown Container ──────────────────────── */
#aibs-live-results {
    position: fixed;
    z-index: 999999;
    background: #fff;
    border-radius: 12px;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    border-top: 3px solid #16a085;
    max-height: 520px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
}

#aibs-live-results.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#aibs-live-results * {
    box-sizing: border-box;
}

/* Scrollbar */
#aibs-live-results::-webkit-scrollbar {
    width: 5px;
}

#aibs-live-results::-webkit-scrollbar-track {
    background: transparent;
}

#aibs-live-results::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 5px;
}

/* ── Section Header ──────────────────────────── */
.aibs-section-header {
    padding: 8px 16px;
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    border-bottom: 1px solid #f3f4f6;
    background: #fafbfc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 9px 9px 0 0;
}

.aibs-ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #6366f1, #ec4899);
    color: #fff;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.aibs-ai-loading-hint {
    font-size: 10px;
    color: #6366f1;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.aibs-dots-inline {
    animation: aibs-fade-dots 1.5s ease-in-out infinite;
}

@keyframes aibs-fade-dots {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

.aibs-ai-loading-pulse {
    animation: aibs-pulse-badge 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

@keyframes aibs-pulse-badge {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
    }
    50% {
        opacity: 0.6;
        box-shadow: 0 0 5px rgba(99, 102, 241, 0.2);
    }
}

/* ── Result Item ─────────────────────────────── */
.aibs-result-item {
    display: flex !important;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none !important;
    color: #1f2937 !important;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
    align-items: flex-start;
    animation: aibs-slide-in 0.25s ease both;
}

.aibs-result-item.aibs-ai-item {
    border-left: 3px solid #6366f1;
}

@keyframes aibs-slide-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aibs-result-item:hover {
    background: #f9fafb;
}

.aibs-result-item:last-child {
    border-bottom: none;
}

/* Thumbnail */
.aibs-result-thumb {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.aibs-result-thumb-placeholder {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0e7ff, #fce7f3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Content */
.aibs-result-content {
    flex: 1;
    min-width: 0;
}

.aibs-result-title {
    font-size: 13px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 2px 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aibs-result-excerpt {
    font-size: 11.5px;
    color: #6b7280;
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aibs-result-meta {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.aibs-result-date {
    font-size: 10px;
    color: #9ca3af;
}

.aibs-result-tag {
    display: inline-block;
    padding: 1px 6px;
    background: #eef1f6;
    color: #4a5568;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 500;
}

/* ── AI Terms Hint ───────────────────────────── */
.aibs-ai-terms {
    padding: 6px 16px;
    font-size: 10px;
    color: #9ca3af;
    background: #fafbfc;
    border-top: 1px solid #f3f4f6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Footer ──────────────────────────────────── */
.aibs-results-footer {
    padding: 10px 16px;
    text-align: center;
    border-top: 1px solid #f3f4f6;
    background: #fafbfc;
    border-radius: 0 0 12px 12px;
}

.aibs-results-footer a {
    font-size: 12px;
    color: #16a085 !important;
    text-decoration: none !important;
    font-weight: 600;
}

.aibs-results-footer a:hover {
    text-decoration: underline !important;
}

/* ── Loading ─────────────────────────────────── */
.aibs-search-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 8px;
    color: #9ca3af;
    font-size: 13px;
}

.aibs-dots {
    display: inline-flex;
    gap: 3px;
}

.aibs-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #16a085;
    animation: aibs-bounce 1.2s ease-in-out infinite;
}

.aibs-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.aibs-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes aibs-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.5);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ── No Results ──────────────────────────────── */
.aibs-no-results {
    padding: 20px 16px;
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
}

.aibs-no-results-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 6px;
}