/**
 * JOINET MAYOREO - MÓDULO WHATSAPP SCROLL ARRIBA
 * Author: Israel Rivas
 * Version: 1.1.0
 * Description: Módulo de contacto flotante moderno y responsive
 * ========================================================================== */

/* ========================================
   FUENTE GLOBAL - MONTSERRAT
   ======================================== */
* {
    font-family: 'Montserrat', sans-serif !important;
}

/* Excepciones para iconos */
.fa, .fas, .far, .fal, .fab, [class*="fa-"] {
    font-family: 'Font Awesome 6 Free' !important;
}

.joinet-contact-plugin {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
}

/* BOTÓN SCROLL TO TOP */
.joinet-scroll-top-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #dc3545;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.joinet-scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.joinet-scroll-top-btn:hover {
    background-color: #b40214ff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.4);
}

.joinet-scroll-top-btn:active {
    transform: translateY(-1px) scale(0.98);
    transition-duration: 0.1s;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.5);
}

/* ICONO PRINCIPAL DE WHATSAPP */
.joinet-whatsapp-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.joinet-whatsapp-icon::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.joinet-whatsapp-icon:hover::before {
    left: 100%;
}

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

.joinet-whatsapp-icon i {
    font-size: 28px;
    color: white;
    z-index: 1;
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: inline-block;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Prevenir parpadeo durante cambio de iconos */
.joinet-whatsapp-icon.changing i {
    opacity: 0;
    transform: rotate(90deg) scale(0.8);
}

/* Fallback visual si Font Awesome no carga */
.joinet-whatsapp-icon i::before {
    display: inline-block;
}

/* Asegurar que el icono esté centrado */
.joinet-whatsapp-icon i.fab,
.joinet-whatsapp-icon i.fas {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.joinet-whatsapp-icon.active {
    background: linear-gradient(135deg, #ff4757 0%, #c44569 100%);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

.joinet-whatsapp-icon.active:hover {
    box-shadow: 0 6px 16px rgba(255, 71, 87, 0.4);
}

/* PANEL DE CONTACTOS */
.joinet-contact-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.joinet-contact-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header del panel */
.joinet-panel-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    padding: 20px;
    text-align: center;
    color: white;
}

.joinet-panel-header h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.joinet-panel-header p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* Lista de contactos */
.joinet-contact-list {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.joinet-contact-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 12px;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none !important;
    color: inherit;
}

.joinet-contact-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateX(5px);
    text-decoration: none !important;
}

.joinet-contact-item:last-child {
    margin-bottom: 0;
}

/* Iconos de contacto */
.joinet-contact-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.joinet-contact-icon.whatsapp {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
}

.joinet-contact-icon.phone {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.joinet-contact-icon.support {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.joinet-contact-icon::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.joinet-contact-item:hover .joinet-contact-icon::before {
    left: 100%;
}

.joinet-contact-icon i {
    font-size: 20px;
    color: white;
    z-index: 1;
}

/* Información de contacto */
.joinet-contact-info {
    flex: 1;
}

.joinet-contact-info h4 {
    margin: 0 0 3px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.joinet-contact-info p {
    margin: 0;
    font-size: 13px;
    color: #7f8c8d;
    line-height: 1.3;
}

.joinet-contact-info .phone-number {
    font-weight: 500;
    color: #34495e;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .joinet-contact-plugin {
        bottom: 15px;
        right: 15px;
    }

    .joinet-scroll-top-btn {
        bottom: 85px;
        right: 15px;
        width: 55px;
        height: 55px;
        font-size: 18px;
    }

    .joinet-whatsapp-icon {
        width: 55px;
        height: 55px;
    }

    .joinet-whatsapp-icon i {
        font-size: 26px;
    }

    .joinet-contact-panel {
        width: calc(100vw - 30px);
        right: -10px;
        bottom: 75px;
    }

    .joinet-contact-item {
        padding: 10px;
    }

    .joinet-contact-icon {
        width: 40px;
        height: 40px;
        margin-right: 12px;
    }

    .joinet-contact-icon i {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .joinet-contact-panel {
        width: calc(100vw - 20px);
        right: -5px;
    }

    .joinet-panel-header {
        padding: 15px;
    }

    .joinet-panel-header h3 {
        font-size: 16px;
    }

    .joinet-panel-header p {
        font-size: 13px;
    }
}

/* =====================================================
   BADGE Y BURBUJA PARA BOTÓN KOMMO
   ===================================================== */

/* BADGE DE NOTIFICACIÓN EN KOMMO */
.joinet-kommo-badge {
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    width: 22px !important;
    height: 22px !important;
    background: linear-gradient(135deg, #ff4757 0%, #c0392b 100%) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.5) !important;
    z-index: 2147483648 !important;
    animation: joinet-pulse-badge 2s ease-in-out infinite !important;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s ease, transform 0.3s ease !important;
    pointer-events: none !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.joinet-kommo-badge.visible {
    opacity: 1 !important;
    transform: scale(1) !important;
}

@keyframes joinet-pulse-badge {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(255, 71, 87, 0.5);
    }
    50% {
        box-shadow: 0 2px 15px rgba(255, 71, 87, 0.8);
    }
}

/* BURBUJA DE MENSAJE PARA KOMMO */
.joinet-kommo-bubble {
    position: fixed !important;
    bottom: 25px !important;
    right: 85px !important;
    background: white !important;
    padding: 14px 18px !important;
    padding-right: 30px !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    max-width: 240px !important;
    opacity: 0;
    visibility: hidden;
    transform: translateX(10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 2147483646 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.joinet-kommo-bubble.visible {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) scale(1) !important;
}

/* Flecha apuntando al botón Kommo */
.joinet-kommo-bubble::after {
    content: "" !important;
    position: absolute !important;
    right: -8px !important;
    bottom: 22px !important;
    width: 0 !important;
    height: 0 !important;
    border-top: 8px solid transparent !important;
    border-bottom: 8px solid transparent !important;
    border-left: 8px solid white !important;
}

.joinet-kommo-bubble-header {
    display: flex !important;
    align-items: center !important;
    margin-bottom: 8px !important;
}

.joinet-kommo-bubble-avatar {
    width: 32px !important;
    height: 32px !important;
    background: linear-gradient(135deg, #000000 0%, #333333 100%) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-right: 10px !important;
    flex-shrink: 0 !important;
}

.joinet-kommo-bubble-avatar svg {
    width: 18px !important;
    height: 14px !important;
}

.joinet-kommo-bubble-name {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #2c3e50 !important;
    line-height: 1.2 !important;
}

.joinet-kommo-bubble-status {
    font-size: 11px !important;
    color: #27ae60 !important;
    font-weight: 500 !important;
}

.joinet-kommo-bubble-text {
    font-size: 14px !important;
    color: #34495e !important;
    line-height: 1.4 !important;
    margin: 0 !important;
}

.joinet-kommo-bubble-close {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 20px !important;
    height: 20px !important;
    background: #ecf0f1 !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 10px !important;
    color: #7f8c8d !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    line-height: 1 !important;
}

.joinet-kommo-bubble-close:hover {
    background: #bdc3c7 !important;
    color: #2c3e50 !important;
}

/* Responsive para burbuja Kommo */
@media (max-width: 768px) {
    .joinet-kommo-bubble {
        right: 80px !important;
        bottom: 20px !important;
        max-width: 210px !important;
        padding: 12px 15px !important;
        padding-right: 28px !important;
    }

    .joinet-kommo-bubble-avatar {
        width: 28px !important;
        height: 28px !important;
    }

    .joinet-kommo-bubble-text {
        font-size: 13px !important;
    }
}

@media (max-width: 480px) {
    .joinet-kommo-bubble {
        right: 75px !important;
        bottom: 18px !important;
        max-width: 190px !important;
        padding: 10px 12px !important;
        padding-right: 26px !important;
    }

    .joinet-kommo-badge {
        width: 20px !important;
        height: 20px !important;
        font-size: 11px !important;
    }
}
