/* Estilos del Asistente Virtual Conversacional de Carrocerías Abogcars */

/* Cápsula Flotante Unificada: Asesor Virtual + WhatsApp Directo */
.capsula-flotante {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    background: #18191a;
    padding: 4px;
    border-radius: 35px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.2s;
}

.capsula-flotante.oculta {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(12px) scale(0.95);
}

.capsula-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 28px;
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1.2;
}

/* Lado Asesor Virtual */
.capsula-asesor {
    background: transparent;
    color: #f8f9fa;
}

.capsula-asesor .capsula-icono {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--acento);
    color: #fff;
    font-size: 1.05rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.capsula-asesor:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.capsula-asesor:hover .capsula-icono {
    transform: scale(1.08);
}

/* Separador sutil */
.capsula-separador {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 2px;
}

/* Lado WhatsApp Directo */
.capsula-whatsapp {
    background: #25d366;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.capsula-whatsapp .capsula-icono {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.capsula-whatsapp:hover {
    background: #20bd5a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.5);
    color: #ffffff !important;
}

/* En celulares pequeños: compacto y elegante */
@media (max-width: 576px) {
    .capsula-flotante {
        bottom: 18px;
        right: 18px;
        padding: 3px;
    }
    .capsula-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        gap: 6px;
    }
    .capsula-asesor .capsula-icono {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
    .capsula-whatsapp .capsula-icono {
        font-size: 1rem;
    }
}

/* En la tienda, cuando la barra inferior del pedido está visible */
body.con-pedido .capsula-flotante {
    bottom: 80px;
}

.asistente-float,
.capsula-flotante {
    display: none !important;
}

/* Ventana de Chat */
.chat-widget {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 380px;
    height: 560px;
    max-height: calc(100vh - 40px);
    background-color: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    overflow: hidden;
    border: 1px solid #e3e7ec;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-widget.oculto {
    display: none !important;
}

/* Cabecera del Chat */
.chat-header {
    background-color: var(--carbon);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--acento);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--acento);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
}

.chat-header-titulo {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.chat-header-subtitulo {
    font-size: 0.75rem;
    color: var(--plata);
    margin: 0;
}

.chat-header-botones {
    display: flex;
    gap: 6px;
}

.chat-btn-accion {
    background: transparent;
    border: none;
    color: var(--plata);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.15s;
}

.chat-btn-accion:hover {
    color: #fff;
}

/* Área de Mensajes */
.chat-mensajes {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background-color: var(--claro);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Burbujas de Mensaje */
.mensaje-fila {
    display: flex;
    flex-direction: column;
    max-width: 88%;
}

.mensaje-fila.asistente {
    align-self: flex-start;
}

.mensaje-fila.usuario {
    align-self: flex-end;
}

.burbuja {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.asistente .burbuja {
    background-color: #fff;
    color: #24292f;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.usuario .burbuja {
    background-color: var(--acento);
    color: #fff;
    border-bottom-right-radius: 2px;
}

/* Chips / Botones Interactivos */
.chat-opciones {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.chat-chip {
    background-color: #fff;
    color: var(--acento-oscuro);
    border: 1px solid var(--acento);
    padding: 5px 12px;
    border-radius: 16px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chat-chip:hover {
    background-color: var(--acento);
    color: #fff;
}

/* Tarjetas de Producto dentro del Chat */
.chat-productos {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.chat-producto-card {
    background-color: #fff;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.chat-producto-img {
    width: 65px;
    height: 65px;
    object-fit: cover;
    border-radius: 6px;
    background-color: #eaeef2;
    flex-shrink: 0;
}

.chat-producto-info {
    flex: 1;
    min-width: 0;
}

.chat-producto-titulo {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0 0 2px;
    color: var(--negro);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-producto-sub {
    font-size: 0.75rem;
    color: #57606a;
    margin: 0 0 4px;
}

.chat-producto-precio {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--acento);
    margin: 0;
}

.chat-producto-aviso {
    font-size: 0.78rem;
    font-weight: 600;
    color: #198754;
    background-color: #e8f5e9;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin: 2px 0 4px;
}

.chat-aviso-confirmacion {
    font-size: 0.76rem;
    font-weight: 700;
    color: #553c00;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 6px;
    padding: 5px 8px;
    margin-top: 6px;
    text-align: center;
}

.chat-producto-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    border: none;
    background-color: #25d366;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    text-decoration: none;
}

.chat-producto-btn:hover {
    background-color: #1ebc59;
    color: #fff;
}

/* Indicador de "Escribiendo..." */
.chat-escribiendo {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background-color: #fff;
    border-radius: 12px;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-punto {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #8c959f;
    animation: saltar 1.4s infinite ease-in-out both;
}

.chat-punto:nth-child(1) { animation-delay: -0.32s; }
.chat-punto:nth-child(2) { animation-delay: -0.16s; }

@keyframes saltar {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Área de Entrada de Texto */
.chat-footer {
    padding: 10px 12px;
    background-color: #fff;
    border-top: 1px solid #d0d7de;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input {
    flex: 1;
    border: 1px solid #d0d7de;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.chat-input:focus {
    border-color: var(--acento);
}

.chat-btn-enviar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--acento);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.15s;
    flex-shrink: 0;
}

.chat-btn-enviar:hover {
    background-color: var(--acento-oscuro);
}

/* Adaptación completa a móviles */
@media (max-width: 576px) {
    .chat-widget {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
}
