/*
 * Estilos del chatbot tipo WhatsApp
 */

#customer-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
}

.customer-chatbot-wrapper {
    /* Aumentar el ancho para una apariencia más amplia */
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
    position: relative; /* Permitir posicionar elementos absolutos como el modal dentro del chat */
    /* Transición suave al mostrar u ocultar el chat */
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.customer-chatbot-header {
    /* Encabezado oscuro similar a WhatsApp */
    background: #005f3b;
    color: #fff;
    padding: 12px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1002;
}
/* Contenedor para título y subtítulo */
.customer-chatbot-header .cb-title-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}
/* Título principal en el encabezado */
.customer-chatbot-header .cb-title {
    font-size: 16px;
    font-weight: bold;
    line-height: 1.2;
}
/* Subtítulo (descripción o agente) */
.customer-chatbot-header .cb-subtitle {
    font-size: 12px;
    color: #c0d8c2;
    margin-top: 2px;
}
/* Contenedor para iconos de acciones (teléfono, email, etc.) */
.customer-chatbot-header .cb-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-right: 26px;
}
/* Iconos en acciones */
.customer-chatbot-header .cb-actions a {
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}
/* Botón de minimizar/cerrar */
/* Botón de minimizar/cerrar con apariencia más cuidada */
.customer-chatbot-header button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 24px;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
}
.customer-chatbot-header button:hover {
    background: rgba(255,255,255,0.3);
}

/* Etiqueta de tipo de cuenta o empresa dentro del encabezado */
.customer-chatbot-header .cb-badge {
    /* Ocultar la etiqueta "Empresa" o similares */
    display: none;
}

/* Estado (en línea) debajo del título */
.customer-chatbot-header .cb-status {
    font-size: 12px;
    color: #d0d0d0;
    margin-top: 2px;
}

.customer-chatbot-messages {
    flex: 1;
    padding: 12px;
    background: #f5f5f5;
    /* Habilitar scroll para ver el historial completo */
    overflow-y: auto;
    /* Aumentar la altura máxima para mostrar más mensajes antes de activar el scroll */
    max-height: 300px;
    height: auto;
}

.customer-chatbot-message {
    margin-bottom: 8px;
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 16px;
    clear: both;
    line-height: 1.3;
    word-wrap: break-word;
    font-size: 14px;
    /* Animación de aparición suave para cada mensaje */
    animation: fadeInMessage 0.3s ease;
}

/* Definición de keyframes para animación de mensajes */
@keyframes fadeInMessage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.customer-chatbot-message.user {
    /* Burbuja del usuario: color verde claro estilo WhatsApp */
    background: #dcf8c6;
    margin-left: auto;
    border-bottom-right-radius: 0;
    color: #333;
}

.customer-chatbot-message.bot {
    /* Burbuja del bot: fondo blanco con borde ligero */
    background: #ffffff;
    margin-right: auto;
    border-bottom-left-radius: 0;
    color: #333;
    border: 1px solid #ddd;
}

/* Tarjeta de promoción o mensajes combinados (imagen + texto + botón) */
.customer-chatbot-card {
    background: #ffffff;
    border: 1px solid #eee;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 8px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-width: 80%;
    margin-bottom: 10px;
}

/* Imagen dentro de la tarjeta */
.customer-chatbot-card .cb-card-image {
    border-radius: 8px;
    margin-bottom: 8px;
}

/* Texto dentro de la tarjeta */
.customer-chatbot-card .cb-card-text {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
}

/* Botón dentro de la tarjeta */
.customer-chatbot-card .cb-link-button {
    margin-top: auto;
    width: fit-content;
    background: #25d366;
    color: #fff;
    transition: background 0.2s ease;
}

.customer-chatbot-card .cb-link-button:hover {
    background: #128c7e;
}

.cb-carousel-bubble {
    max-width: 100%;
    background: transparent !important;
    padding: 0;
}

.cb-services-carousel {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.cb-services-carousel::-webkit-scrollbar {
    height: 6px;
}

.cb-services-carousel::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.18);
    border-radius: 999px;
}

.cb-service-card {
    min-width: 180px;
    max-width: 180px;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid #e8e8e8;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

.cb-service-card-image {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.cb-service-card-title {
    padding: 10px 12px 4px;
    font-size: 14px;
    font-weight: 700;
    color: #1f1f1f;
}

.cb-service-card-price {
    padding: 0 12px 10px;
    font-size: 13px;
    color: #0b7a52;
    font-weight: 600;
}

.cb-service-card-button {
    margin: auto 12px 12px;
    border: none;
    border-radius: 10px;
    background: #25d366;
    color: #fff;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cb-service-card-button:hover {
    background: #128c7e;
}

/* Estilo para enlaces y botones dentro de los mensajes del bot */
.customer-chatbot-message.bot .cb-link-button {
    display: inline-block;
    margin-top: 4px;
    margin-right: 4px;
    padding: 6px 10px;
    background: #25d366;
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-size: 13px;
    transition: background 0.2s ease;
}
.customer-chatbot-message.bot .cb-link-button:hover {
    background: #128c7e;
}

.customer-chatbot-input {
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    padding: 8px;
    background: #f7f7f7;
}

.customer-chatbot-input input[type="text"] {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 16px;
    font-size: 14px;
}

.customer-chatbot-input button {
    margin-left: 8px;
    background: #128C7E;
    border: none;
    color: #fff;
    padding: 6px 12px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
}

.customer-chatbot-input button:disabled {
    background: #a4d7d1;
    cursor: not-allowed;
}

.customer-chatbot-typing {
    font-style: italic;
    font-size: 12px;
    margin: 4px 0;
    color: #555;
}

.customer-chatbot-minimized .customer-chatbot-wrapper {
    display: none;
}

.customer-chatbot-floating-button {
    position: fixed;
    right: 20px;
    bottom: 20px;
    background: #25d366;
    min-width: 180px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 0 16px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.22);
    cursor: pointer;
    color: #fff;
}

.customer-chatbot-floating-button .cb-floating-text {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.customer-chatbot-floating-button svg {
    width: 26px;
    height: 26px;
    fill: #fff;
}

/*
 * Ajustes responsivos para pantallas móviles.
 * Cuando el ancho de pantalla es menor o igual a 480px, el chat ocupa
 * todo el ancho de la pantalla y se posiciona al fondo sin margen.
 */
@media (max-width: 480px) {
    #customer-chatbot-container {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        margin: 0;
    }
    .customer-chatbot-floating-button {
        right: 12px;
        bottom: 12px;
        min-width: 160px;
        height: 52px;
        padding: 0 14px;
        border-radius: 14px;
    }
    .customer-chatbot-floating-button .cb-floating-text {
        font-size: 13px;
    }
    .customer-chatbot-wrapper {
        width: 100%;
        max-width: 100%;
        border-radius: 0;
    }
    .customer-chatbot-messages {
        max-height: 50vh;
    }
    /* Ajustar la entrada para que ocupe el 100% */
    .customer-chatbot-input input[type="text"] {
        font-size: 16px;
    }
    .customer-chatbot-input button {
        font-size: 16px;
    }
}

/* ------------------------------------------------------------------ */
/* Estilos para el formulario modal de captación de leads */
/* La superposición cubre toda la pantalla y centra la caja del formulario */
.customer-chatbot-modal-overlay {
    position: absolute;
    top: 66px;
    left: 0;
    width: 100%;
    height: calc(100% - 66px);
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Caja del modal que contiene los campos y el botón */
.customer-chatbot-modal {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.customer-chatbot-modal h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

/* Campos de entrada dentro del modal */
.customer-chatbot-modal input[type="text"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
}

/* Botón de acción en el modal */
.customer-chatbot-modal button {
    background: #25d366;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}
.customer-chatbot-modal button:hover {
    background: #128c7e;
}

.customer-chatbot-open-lead-popup-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: #25d366;
    color: #fff;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.customer-chatbot-open-lead-popup-button:hover {
    background: #128c7e;
}


.customer-chatbot-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    line-height: 1;
    margin-right: 8px;
}

.customer-chatbot-inline-lead-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #25d366;
    color: #fff;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.customer-chatbot-inline-lead-button:hover {
    background: #128c7e;
}

.customer-chatbot-open-order-popup-button,
.customer-chatbot-inline-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #0f766e;
    color: #fff;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease;
}

.customer-chatbot-open-order-popup-button:hover,
.customer-chatbot-inline-order-button:hover {
    background: #115e59;
}

.customer-chatbot-order-modal textarea {
    width: 100%;
    min-height: 90px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    resize: vertical;
    font: inherit;
    box-sizing: border-box;
    margin-bottom: 12px;
}
