/* ============================================================
   WhatsApp Chat Widget - Floating Button & Modal
   ============================================================ */

/* Botón Flotante de WhatsApp */
.whatsapp-float-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
    z-index: 999;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    animation: slideInUp 0.5s ease-out, pulse 2s infinite;
}

.whatsapp-float-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 32px rgba(37, 211, 102, 0.6);
}

.whatsapp-float-btn svg {
    width: 36px;
    height: 36px;
    fill: white;
}

/* Tooltip del botón */
.whatsapp-tooltip {
    position: absolute;
    right: 80px;
    top: 50%;
    transform: translateY(-50%);
    background: #2C3E50;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border: 8px solid transparent;
    border-left-color: #2C3E50;
}

.whatsapp-float-btn:hover .whatsapp-tooltip {
    opacity: 1;
}

/* Badge de notificación (opcional) */
.whatsapp-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #E31937;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    animation: bounce 2s infinite;
}

/* Modal de Chat */
.whatsapp-modal {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 400px;
    max-width: calc(100vw - 60px);
    max-height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transform: scale(0.8) translateY(20px);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    flex-direction: column;
}

.whatsapp-modal.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

/* Header del Modal */
.whatsapp-modal-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.whatsapp-modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.whatsapp-modal-title svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.whatsapp-modal-title h3 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 700;
}

.whatsapp-modal-close {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.whatsapp-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Body del Modal */
.whatsapp-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 400px;
    flex: 1;
}

/* Mensaje de Bienvenida */
.whatsapp-welcome {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #25D366;
}

.whatsapp-welcome p {
    margin: 0;
    font-size: 0.95rem;
    color: #065F46;
    line-height: 1.6;
}

/* Sección de FAQs */
.faqs-section h4 {
    font-size: 1rem;
    color: #2C3E50;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Categorías de FAQs */
.faq-category {
    margin-bottom: 1.5rem;
}

.faq-category-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #128C7E;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.faq-category-icon {
    font-size: 1.125rem;
}

/* Items de FAQ (acordeón) */
.faq-item {
    margin-bottom: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s;
}

.faq-item:hover {
    border-color: #25D366;
}

.faq-question {
    padding: 0.875rem 1rem;
    background: white;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #2C3E50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.faq-question:hover {
    background: #f9fafb;
}

.faq-question-icon {
    font-size: 1.25rem;
    color: #25D366;
    transition: transform 0.3s;
}

.faq-item.active .faq-question-icon {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: #f9fafb;
    padding: 0 1rem;
}

.faq-item.active .faq-answer {
    max-height: 300px;
    padding: 1rem;
}

.faq-answer p {
    margin: 0;
    font-size: 0.875rem;
    color: #6B7280;
    line-height: 1.6;
    white-space: pre-line;
}

/* Footer del Modal con botones de acción */
.whatsapp-modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.whatsapp-action-btn {
    padding: 0.875rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    text-decoration: none;
}

.btn-whatsapp-primary {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}

.btn-whatsapp-secondary {
    background: white;
    color: #E31937;
    border: 2px solid #E31937;
}

.btn-whatsapp-secondary:hover {
    background: #E31937;
    color: white;
    transform: translateY(-2px);
}

/* Animaciones */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 8px 32px rgba(37, 211, 102, 0.6);
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Overlay opcional para móviles */
.whatsapp-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.whatsapp-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Responsive Design */
@media (max-width: 640px) {
    .whatsapp-float-btn {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }

    .whatsapp-float-btn svg {
        width: 32px;
        height: 32px;
    }

    .whatsapp-tooltip {
        display: none;
    }

    .whatsapp-modal {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 80vh;
    }

    .whatsapp-modal-body {
        max-height: calc(80vh - 180px);
    }
}
