/* Ventana de EMI que escribe una consulta, «piensa» y dibuja el gráfico (emi_demo.js).
   La usan la portada y la página «Productos»; sus piezas (cuadro de la consulta, puntos de
   «pensando») sirven también a las otras demos de Productos. */

.emi-bar-title {
    margin-left: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    line-height: 10px;
}

.emi-body {
    background: #f7f9fc;
    padding: 1.25rem;
    text-align: left;
    color: var(--ud-ink);
}

.emi-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.emi-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.emi-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--ud-navy-2);
    line-height: 1.1;
}

.emi-role {
    font-size: 0.72rem;
    color: var(--ud-muted);
}

.emi-input {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 46px;
    padding: 0.65rem 0.9rem;
    background: white;
    border: 1px solid var(--ud-line);
    border-radius: 12px;
    font-size: 0.88rem;
    color: var(--ud-navy-2);
    box-shadow: 0 4px 14px rgba(18, 44, 67, 0.05);
}

.emi-input > i {
    color: var(--ud-blue);
}

.emi-caret {
    display: inline-block;
    width: 2px;
    height: 1.05em;
    margin-left: 1px;
    vertical-align: -2px;
    background: var(--ud-blue);
    animation: emiBlink 1s steps(1) infinite;
}

@keyframes emiBlink {
    50% { opacity: 0; }
}

.emi-result {
    position: relative;
    margin-top: 0.9rem;
    padding: 1rem 1rem 0.5rem;
    min-height: 238px;
    background: white;
    border: 1px solid var(--ud-line);
    border-radius: 14px;
}

.emi-thinking {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.emi-thinking span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ud-blue);
    animation: emiDot 1s ease-in-out infinite;
}

.emi-thinking span:nth-child(2) { animation-delay: 0.15s; }
.emi-thinking span:nth-child(3) { animation-delay: 0.3s; }

@keyframes emiDot {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-6px); opacity: 1; }
}

.emi-result.is-thinking .emi-thinking { opacity: 1; }

.emi-chart {
    opacity: 0;
    transition: opacity 0.35s ease;
}

.emi-result.is-ready .emi-chart { opacity: 1; }

.emi-chart-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ud-navy-2);
    margin: 0;
}

.emi-chart-sub {
    font-size: 0.72rem;
    color: var(--ud-muted);
    margin: 0 0 0.25rem;
}

.emi-chart svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.emi-svg-label {
    font-size: 11px;
    fill: #8a97a6;
    font-family: inherit;
}

.emi-svg-value {
    font-size: 11px;
    font-weight: 700;
    fill: var(--ud-navy-2);
    font-family: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.emi-svg-value.is-on { opacity: 1; }

.emi-line {
    fill: none;
    stroke: var(--ud-blue);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-dashoffset 1.3s ease-out;
}

.emi-area {
    opacity: 0;
    transition: opacity 0.8s ease 0.6s;
}

.emi-area.is-on { opacity: 1; }

.emi-point {
    fill: white;
    stroke: var(--ud-blue);
    stroke-width: 2.5;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0);
    transition: transform 0.3s ease;
}

.emi-point.is-on { transform: scale(1); }

.emi-bar {
    transform-box: fill-box;
    transform-origin: bottom;
    transform: scaleY(0);
    transition: transform 0.7s cubic-bezier(.2, .8, .2, 1);
}

.emi-bar.is-on { transform: scaleY(1); }

@media (prefers-reduced-motion: reduce) {
    .emi-caret { animation: none; }
}
