/**
 * whatsapp-chat-bot.css
 * Widget de chat flotante con preguntas predefinidas para WhatsApp
 * LAM Logistic - 2025
 */

/* Contenedor principal del widget */
#whatsapp-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Botón flotante principal */
#whatsapp-chat-button {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    padding: 14px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    animation: slideInUp 0.8s ease 0.5s forwards;
    opacity: 0;
    position: relative;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#whatsapp-chat-button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 30px rgba(37, 211, 102, 0.6);
}

#whatsapp-chat-button.chat-button-active {
    border-radius: 50%;
    padding: 16px;
    width: 60px;
    height: 60px;
}

#whatsapp-chat-button.chat-button-active .chat-button-text {
    display: none;
}

/* Ícono del botón */
.chat-button-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: pulse 2s infinite;
}

.chat-button-icon svg {
    width: 100%;
    height: 100%;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Texto del botón */
.chat-button-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.chat-main-text {
    font-size: 15px;
    font-weight: 700;
}

.chat-sub-text {
    font-size: 12px;
    opacity: 0.95;
}

/* Ícono de cerrar */
.chat-close-icon {
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

/* Badge de notificación */
.chat-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff3b30;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 3px solid white;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.15);
    }
}

/* Caja de chat */
#whatsapp-chat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

#whatsapp-chat-box.chat-box-hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

#whatsapp-chat-box.chat-box-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header del chat */
.chat-header {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.chat-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar svg {
    width: 28px;
    height: 28px;
}

.chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
}

.chat-header-text p {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.chat-header-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-header-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Cuerpo del chat */
.chat-body {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    background: #f0f2f5;
}

/* Mensaje del bot */
.chat-message-bot {
    margin-bottom: 20px;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

/* Opciones de chat */
.chat-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.chat-option {
    background: white;
    border: 2px solid #e5e7eb;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #333;
    text-align: left;
}

.chat-option:hover {
    border-color: #25d366;
    background: #f0fdf4;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
}

.option-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    font-weight: 600;
}

.option-arrow {
    color: #25d366;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-option:hover .option-arrow {
    opacity: 1;
}

/* Mensaje personalizado */
.chat-custom-message {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.chat-custom-message input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.chat-custom-message input:focus {
    border-color: #25d366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.chat-custom-message button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-custom-message button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    #whatsapp-chat-widget {
        bottom: 15px;
        right: 15px;
    }

    #whatsapp-chat-button {
        padding: 12px 16px;
    }

    .chat-button-text {
        display: none;
    }

    #whatsapp-chat-button {
        border-radius: 50%;
        padding: 14px;
        width: 56px;
        height: 56px;
    }

    .chat-button-icon {
        width: 28px;
        height: 28px;
    }

    #whatsapp-chat-box {
        width: calc(100vw - 30px);
        bottom: 75px;
        right: 0;
    }

    .chat-body {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    #whatsapp-chat-box {
        width: calc(100vw - 20px);
        right: -5px;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-body {
        padding: 15px;
        max-height: 350px;
    }

    .chat-option {
        padding: 10px 12px;
        font-size: 13px;
    }

    .option-icon {
        font-size: 18px;
    }
}

/* Scrollbar personalizado */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #25d366;
    border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #128c7e;
}
