﻿html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.chat-shell {
    height: 100dvh;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--c-fondo);
    overflow: hidden;
}

/* ── Header ── */
.chat-header {
    background: var(--c-primario);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.header-title {
    font-size: 15px;
    font-weight: 500;
    color: white;
    margin: 0;
}

.header-sub {
    font-size: 11px;
    color: var(--c-texto-claro);
    margin: 2px 0 0;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4caf50;
    display: inline-block;
    margin-right: 5px;
    animation: pulse 2s infinite;
}

.status-text {
    font-size: 11px;
    color: #4caf50;
}

@keyframes pulse {
    0%,100% {
        opacity: 1
    }

    50% {
        opacity: .4
    }
}

/* ── Sugerencias ── */
.suggestions {
    background: white;
    border-bottom: 1px solid #e1e8f0;
    padding: 10px 16px;
    flex-shrink: 0;
}

.sug-label {
    font-size: 10px;
    color: var(--c-texto-claro);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.sug-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.sug-chip {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid var(--c-acento);
    color: var(--c-acento);
    background: transparent;
    cursor: pointer;
    transition: all .15s;
}

    .sug-chip:hover {
        background: var(--c-acento);
        color: white;
    }

/* ── Mensajes ── */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    -webkit-overflow-scrolling: touch;
}

.bubble-user {
    background: var(--c-primario);
    color: white;
    padding: 10px 14px;
    border-radius: 16px 16px 4px 16px;
    font-size: 13px;
    max-width: 78%;
    align-self: flex-end;
    line-height: 1.5;
}

.agent-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c-primario);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
    margin-top: 2px;
}

.bubble-agent {
    background: var(--c-burbuja);
    border: 1px solid #e1e8f0;
    padding: 12px 14px;
    border-radius: 4px 16px 16px 16px;
    font-size: 13px;
    color: var(--c-texto);
    max-width: 85%;
    line-height: 1.6;
}

/* ── Métricas ── */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 8px;
    margin: 10px 0;
}

.metric-card {
    background: var(--c-secundario);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: center;
}

.metric-label {
    font-size: 10px;
    color: var(--c-texto-claro);
    margin-bottom: 3px;
}

.metric-val {
    font-size: 17px;
    font-weight: 500;
    color: var(--c-primario);
}

.metric-delta {
    font-size: 10px;
    color: var(--c-delta);
    margin-top: 2px;
}

    .metric-delta.neg {
        color: #ef5350;
    }

/* ── Gráfica ── */
.chart-wrap {
    background: var(--c-secundario);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0;
}

.chart-lbl {
    font-size: 10px;
    color: var(--c-texto-claro);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 56px;
}

.chart-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
}

.chart-bar {
    border-radius: 3px 3px 0 0;
    width: 100%;
    background: var(--c-acento);
    transition: opacity .2s;
}

    .chart-bar:hover {
        opacity: .75;
    }

.chart-bar-lbl {
    font-size: 9px;
    color: var(--c-texto-claro);
}

/* ── Tabla ── */
.msg-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 12px;
    margin: 8px 0;
}

    .msg-table th {
        background: var(--c-secundario);
        color: var(--c-primario);
        padding: 7px 10px;
        text-align: left;
        border-bottom: 2px solid var(--c-acento);
        font-weight: 500;
    }

    .msg-table td {
        padding: 6px 10px;
        border-bottom: 1px solid #f0f5fb;
        color: var(--c-texto);
        text-align: right;
    }

    .msg-table td:first-child {
        text-align: left;
    }

    .msg-table tr:hover td {
        background: var(--c-secundario);
    }

/* ── Acciones ── */
.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.action-btn {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #e1e8f0;
    background: white;
    color: var(--c-texto-claro);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all .15s;
}

    .action-btn:hover {
        border-color: var(--c-acento);
        color: var(--c-acento);
    }

    .action-btn.excel {
        border-color: #43a047;
        color: #43a047;
    }

    .action-btn.copy {
        border-color: #9ca3af;
        color: #9ca3af;
    }

/* ── Typing ── */
.typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-acento);
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.2s infinite ease-in-out;
}

    .typing-dot:nth-child(2) {
        animation-delay: .2s;
    }

    .typing-dot:nth-child(3) {
        animation-delay: .4s;
    }

@keyframes bounce {
    0%,60%,100% {
        transform: translateY(0);
        opacity: .4
    }

    30% {
        transform: translateY(-5px);
        opacity: 1
    }
}

/* ── Input ── */
.input-area {
    background: white;
    border-top: 1px solid #e1e8f0;
    padding: 12px 16px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.input-field {
    flex: 1;
    border: 1.5px solid #e1e8f0;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--c-texto);
    outline: none;
    transition: border .2s;
}

    .input-field:focus {
        border-color: var(--c-acento);
    }

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--c-acento);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .15s;
}

    .send-btn:hover {
        opacity: .85;
    }

    .send-btn:disabled {
        opacity: .4;
        cursor: not-allowed;
    }

@media (max-width: 767px) {
    .action-btn span {
        display: none;
    }

    .bubble-user, .bubble-agent {
        max-width: 90%;
    }

    .metric-grid {
        grid-template-columns: repeat(2,1fr);
    }
}
