/* --- THEME VARIABLES --- */
:root {
    --font-sans: 'Figtree', sans-serif;
    --brand-blue: #005287;
    --brand-blue-dark: #00416b;
    --brand-orange: #FC4C02;
    --gray-50:  #f8fafc;
    --gray-75:  #f1f5f9;
    --gray-100: #eef2f6;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #4a5568;
    --gray-700: #475569;
    --gray-800: #2d3748;
    --gray-900: #1e293b;
    --shadow-sm: 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
}

/* --- MAIN CONTAINER --- */
.relevanssi-ai-answer {
    font-family: var(--font-sans);
    background: #fff;
    border: 1px solid var(--gray-200);
    padding: 24px;
    border-radius: 12px;
    margin: 0 0 24px;
    box-shadow: var(--shadow-card);
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 0.5s ease-out forwards;
}

/* --- FADE-IN ANIMATION --- */
@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- LOADING ANIMATION --- */
.relevanssi-ai-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 120px;
}

.relevanssi-ai-loader-dot {
    width: 10px;
    height: 10px;
    margin: 0 5px;
    background-color: var(--brand-blue);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.relevanssi-ai-loader-dot:nth-child(1) { animation-delay: -0.32s; }
.relevanssi-ai-loader-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* --- TYPOGRAPHY & SPACING --- */
.relevanssi-ai-answer__title {
    display: block;
    margin-bottom: 4px;
    font-size: 1.25em;
    font-weight: 600;
    color: var(--brand-blue-dark);
}

.relevanssi-ai-answer__subtitle {
    display: block;
    margin-bottom: 16px;
    font-size: 0.9em;
    color: var(--gray-500);
}

.relevanssi-ai-answer__text {
    color: var(--gray-700);
    line-height: 1.6;
    white-space: pre-wrap;
}

/* --- SOURCES LIST --- */
.relevanssi-ai-answer__sources-title {
    display: block;
    margin-top: 24px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--gray-800);
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
}

.relevanssi-ai-answer__sources {
    margin: 0 0 0 20px;
    padding: 0;
    list-style: decimal;
}

.relevanssi-ai-answer__sources li {
    margin-bottom: 16px;
}

.relevanssi-ai-answer__sources a {
    font-weight: 600;
    color: var(--brand-blue);
    text-decoration: none;
    transition: color 0.2s ease;
}

.relevanssi-ai-answer__sources a:hover {
    color: var(--brand-orange);
}

.relevanssi-ai-answer__source-type {
    display: inline-block;
    margin-left: 8px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--gray-75);
    border: 1px solid var(--gray-200);
    font-size: 0.8em;
    font-weight: 500;
    color: var(--gray-600);
}

.relevanssi-ai-answer__source-excerpt {
    color: var(--gray-600);
    margin-top: 4px;
    font-size: 0.9em;
}

/* --- FEEDBACK & ERROR STATES --- */
.relevanssi-ai-feedback {
    margin-top: 20px;
    font-size: 0.9em;
    color: var(--gray-600);
}

.relevanssi-ai-feedback a {
    text-decoration: none;
    font-size: 18px;
    margin-left: 8px;
    opacity: 0.7;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.relevanssi-ai-feedback a:hover {
    opacity: 1;
    transform: scale(1.1);
}

.relevanssi-ai-answer__no-info,
.relevanssi-ai-answer__error {
    border: 1px solid var(--gray-200);
    padding: 16px;
    border-radius: 8px;
    background: var(--gray-50);
    color: var(--gray-700);
}

.relevanssi-ai-answer__error {
    border-color: #fca5a5; /* A light red for errors */
    background-color: #fef2f2;
    color: #991b1b;
}