/* Asistente de consultas — usa las variables --sc-* de styles.css */

.sc-chat-boton {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: var(--sc-primary);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 8px 26px rgba(60, 40, 110, .35);
    z-index: 900;
    transition: transform .15s, background .15s;
}

.sc-chat-boton:hover { transform: scale(1.06); }
.sc-chat-boton--abierto { background: var(--sc-primary-d); }

/* Oculto por defecto. Se muestra solo con la clase 'abierto'.
   OJO: no alcanza con el atributo [hidden] porque el display:flex de la clase
   le ganaría y el panel no se cerraría nunca. Por eso el default es display:none. */
.sc-chat-panel {
    display: none;
    position: fixed;
    right: 20px;
    bottom: 88px;
    width: 350px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(40, 30, 70, .28);
    flex-direction: column;
    overflow: hidden;
    z-index: 900;
}

.sc-chat-panel--abierto { display: flex; }

.sc-chat-cab {
    background: var(--sc-primary);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sc-chat-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    padding: 3px;
    flex-shrink: 0;
}

.sc-chat-avatar--marca {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sc-primary);
    font-size: 1.1rem;
    padding: 0;
}

.sc-chat-cab__txt { flex: 1; line-height: 1.25; }
.sc-chat-cab strong { display: block; font-size: 1rem; }
.sc-chat-cab small { opacity: .85; font-size: .78rem; }

.sc-chat-cerrar {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    opacity: .85;
}
.sc-chat-cerrar:hover { opacity: 1; }

.sc-chat-cuerpo {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--sc-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sc-chat-msg {
    max-width: 82%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: .92rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.sc-chat-msg--bot {
    background: #fff;
    color: var(--sc-ink);
    border: 1px solid var(--sc-line);
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.sc-chat-msg--yo {
    background: var(--sc-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}

/* Puntitos de "escribiendo" */
.sc-chat-escribiendo { display: flex; gap: 4px; align-items: center; }
.sc-chat-escribiendo span {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--sc-ink-soft);
    animation: sc-chat-latido 1s infinite;
}
.sc-chat-escribiendo span:nth-child(2) { animation-delay: .15s; }
.sc-chat-escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes sc-chat-latido { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

/* Zona de respuesta (botones o campo) */
.sc-chat-entrada { border-top: 1px solid var(--sc-line); background: #fff; }

.sc-chat-opciones {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 12px;
}

.sc-chat-opcion {
    background: #fff;
    border: 1px solid var(--sc-primary);
    color: var(--sc-primary);
    padding: 10px 14px;
    border-radius: 999px;
    font-size: .9rem;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.sc-chat-opcion:hover { background: var(--sc-soft); }

.sc-chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding: 10px;
    flex-wrap: wrap;
}

.sc-chat-form input, .sc-chat-form textarea {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--sc-line);
    border-radius: 12px;
    padding: 9px 12px;
    font-size: .92rem;
    font-family: inherit;
    resize: none;
}

.sc-chat-form input:focus, .sc-chat-form textarea:focus {
    outline: none;
    border-color: var(--sc-primary);
}

.sc-chat-enviar {
    background: var(--sc-primary);
    color: #fff;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    flex-shrink: 0;
}

.sc-chat-saltar {
    background: none;
    border: none;
    color: var(--sc-ink-soft);
    font-size: .82rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 4px;
}

@media (max-width: 480px) {
    .sc-chat-panel {
        right: 8px;
        left: 8px;
        bottom: 82px;
        width: auto;
        max-width: none;
    }
}
