/* telco_chat_badges.css — Badges de fuente y polish del markdown del chat.
   Cargado automáticamente por Dash desde assets/. */

/* ── Badges de fuente ───────────────────────────────────────────────────── */

.src-badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 0.78em;
    font-weight: 600;
    border-radius: 999px;
    line-height: 1.5;
    letter-spacing: 0.01em;
    vertical-align: baseline;
    border: 1px solid transparent;
    white-space: nowrap;
}

.src-osiptel  { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.src-inei     { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.src-sunat    { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.src-reniec   { background: #fdf4ff; color: #86198f; border-color: #f5d0fe; }
.src-redatam  { background: #ecfeff; color: #155e75; border-color: #a5f3fc; }

/* ── Markdown rendering del chat (asistente) ────────────────────────────── */

.telco-chat-md {
    /* dcc.Markdown envuelve en un wrapper extra — apuntamos al contenido. */
}

.telco-chat-md p {
    margin: 0 0 8px 0;
}
.telco-chat-md p:last-child {
    margin-bottom: 0;
}

.telco-chat-md strong {
    font-weight: 700;
    color: #0f172a;
}

.telco-chat-md em {
    color: #64748b;
    font-style: italic;
}

/* Tablas markdown — renderiza ranking/comparación legible.
   display:block + overflow-x:auto → si la tabla es más ancha que la burbuja,
   scrollea en horizontal en vez de amontonar el texto (opción A). */
.telco-chat-md table {
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 12px;
    width: 100%;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
/* Las celdas no parten su texto en varias líneas: la columna mantiene su ancho
   natural y, si no entra, la tabla scrollea. */
.telco-chat-md th,
.telco-chat-md td {
    white-space: nowrap;
}
.telco-chat-md thead {
    background: #f1f5f9;
}
.telco-chat-md th {
    padding: 6px 10px;
    text-align: left;
    font-weight: 700;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.telco-chat-md td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #0f172a;
}
.telco-chat-md tr:last-child td {
    border-bottom: none;
}
/* Columnas numéricas alineadas a la derecha — convención: 2da columna
   en adelante suele ser número. */
.telco-chat-md td:not(:first-child),
.telco-chat-md th:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Listas numeradas / bullets — espaciado vendible */
.telco-chat-md ol,
.telco-chat-md ul {
    margin: 6px 0 8px 0;
    padding-left: 22px;
}
.telco-chat-md ol li,
.telco-chat-md ul li {
    margin-bottom: 4px;
    line-height: 1.55;
}

/* Código inline (eg. nombres de UBIGEO o referencia técnica) */
.telco-chat-md code {
    background: #f1f5f9;
    color: #0f172a;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* Blockquote — rara vez usado, pero queda lindo si Claude lo emplea */
.telco-chat-md blockquote {
    border-left: 3px solid #cbd5e1;
    margin: 8px 0;
    padding: 4px 12px;
    color: #475569;
    background: #f8fafc;
}

/* ── Typing indicator (3 puntos animados) ────────────────────────────────── */

.telco-chat-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    font-size: 11px;
    color: #64748b;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.telco-chat-typing-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 4px;
}

.telco-chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: telco-chat-blink 1.2s infinite ease-in-out;
}

.telco-chat-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.telco-chat-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes telco-chat-blink {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%           { opacity: 1;   transform: translateY(-2px); }
}

/* ── Avatar del asistente ────────────────────────────────────────────────── */

.telco-chat-avatar-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.telco-chat-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #2563eb;
    color: #ffffff;
    font-size: 8px;
    font-weight: 700;
    border-radius: 3px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* ── Follow-up chips ─────────────────────────────────────────────────────── */

/* Tira compacta: label + chips en una fila que envuelve (no apilados), para
   ocupar el mínimo alto posible sobre el input y no tapar la respuesta. */
.telco-chat-followups {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 4px 0 8px 0;
    max-width: 100%;
}

.telco-chat-followups-label {
    font-size: 9px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-right: 2px;
}

/* Cada chip en UNA línea con elipsis; el texto completo va en el title (tooltip).
   flex:0 0 auto → NO encoger: como son hijos de un flex container y tienen
   overflow:hidden (que fuerza min-width:0), sin esto se colapsarían a 0px de
   ancho y desaparecerían. Con flex:0 0 auto mantienen su ancho y envuelven. */
.telco-chat-followup {
    flex: 0 0 auto;
    display: inline-block;
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    text-align: left;
    padding: 5px 12px;
    font-size: 11px;
    color: #1e3a8a;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 500;
    line-height: 1.4;
    transition: background 120ms, border-color 120ms;
}

.telco-chat-followup:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.telco-chat-followup::before {
    content: "→";
    margin-right: 6px;
    color: #2563eb;
    font-weight: 700;
}

/* ── Línea de profundización (Comex) ─────────────────────────────────────────
   Una pregunta conversacional del asistente debajo de la respuesta. NO es un
   botón ni un prompt sugerido: el usuario responde escribiendo. */
.comex-chat-deepen {
    display: block;
    max-width: 92%;
    margin: 2px 0 12px 0;
    padding: 8px 12px;
    font-size: 12px;
    font-style: italic;
    line-height: 1.45;
    color: #475569;
    background: #f8fafc;
    border-left: 3px solid #93c5fd;
    border-radius: 0 8px 8px 0;
}
.comex-chat-deepen::before {
    content: "↪ ";
    font-style: normal;
    color: #2563eb;
    font-weight: 700;
}
