/*
 * Chat-O FAQ por PDF - Estilos del chatbox
 */

.clfaq-wrapper {
    width: 80%;
    margin: 24px auto;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #374151;
}

/* Encabezado con título y descarga */
.clfaq-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.clfaq-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

.clfaq-download {
    display: inline-block;
    flex-shrink: 0;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.clfaq-download:hover,
.clfaq-download:focus {
    background: rgba(255, 255, 255, 0.3);
    text-decoration: none;
}

/* Leyenda explicativa */
.clfaq-legend {
    padding: 14px 20px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    font-size: 13.5px;
    line-height: 1.55;
    color: #1e40af;
}

.clfaq-legend p {
    margin: 0 0 8px 0;
}

.clfaq-legend p:last-child {
    margin-bottom: 0;
}

/* Mensajes */
.clfaq-messages {
    height: 340px;
    overflow-y: auto;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}

.clfaq-msg {
    display: flex;
    max-width: 85%;
}

.clfaq-user {
    align-self: flex-end;
}

.clfaq-bot,
.clfaq-error {
    align-self: flex-start;
}

.clfaq-bubble {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.clfaq-user .clfaq-bubble {
    background: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.clfaq-bot .clfaq-bubble {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-bottom-left-radius: 4px;
}

/* Botón copiar respuesta */
.clfaq-copy-answer {
    align-self: flex-end;
    margin-left: 6px;
    padding: 5px 7px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    cursor: pointer;
    line-height: 0;
    transition: all 0.2s ease;
}

.clfaq-copy-answer:hover {
    background: #eff6ff;
    border-color: #2563eb;
    color: #2563eb;
}

.clfaq-copy-answer.clfaq-copied {
    background: #f0fdf4;
    border-color: #22c55e;
    color: #16a34a;
}

.clfaq-error .clfaq-bubble {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-bottom-left-radius: 4px;
}

/* Indicador de escritura */
.clfaq-typing .clfaq-bubble {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 13px 16px;
}

.clfaq-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: clfaq-blink 1.2s infinite ease-in-out;
}

.clfaq-dot:nth-child(2) { animation-delay: 0.2s; }
.clfaq-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes clfaq-blink {
    0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

/* Área de entrada */
.clfaq-input-area {
    display: flex;
    gap: 10px;
    padding: 14px 20px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.clfaq-input {
    flex: 1;
    padding: 11px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.clfaq-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.clfaq-input:disabled {
    background: #f3f4f6;
    cursor: not-allowed;
}

.clfaq-send {
    padding: 11px 22px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.clfaq-send:hover:not(:disabled) {
    background: #1d4ed8;
}

.clfaq-send:disabled {
    background: #93c5fd;
    cursor: wait;
}

/* Móvil */
@media (max-width: 640px) {
    .clfaq-wrapper {
        margin: 16px 8px;
        border-radius: 12px;
    }

    .clfaq-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .clfaq-messages {
        height: 280px;
        padding: 14px;
    }

    .clfaq-msg {
        max-width: 95%;
    }
}
