/**
 * WhatsApp Widget Emergency Fix
 * Ensure widget is visible on all devices
 */

/* Base container - always visible */
#vtcwa-widget-container {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 999999 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Float button base styles */
#vtcwa-float-button,
#vtcwa-widget-container .vtcwa-float-button {
    position: relative !important;
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 2147483647 !important;
    background: #25D366 !important;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%) !important;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4) !important;
    overflow: visible !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
}

/* Rounded style (default) - Desktop */
@media (min-width: 769px) {
    #vtcwa-widget-container .vtcwa-style-rounded {
        width: 65px !important;
        height: 65px !important;
        border-radius: 15px !important;
        padding: 16px !important;
        gap: 0 !important;
    }
    
    /* Square style - Desktop */
    #vtcwa-widget-container .vtcwa-style-square {
        width: 65px !important;
        height: 65px !important;
        border-radius: 15px !important;
        padding: 16px !important;
        gap: 0 !important;
    }
    
    /* Text style - Desktop */
    #vtcwa-widget-container .vtcwa-style-text {
        width: auto !important;
        min-width: 150px !important;
        height: 55px !important;
        border-radius: 15px !important;
        padding: 12px 20px !important;
        gap: 10px !important;
    }
}

/* Mobile - only icon */
@media (max-width: 768px) {
    #vtcwa-float-button,
    #vtcwa-widget-container .vtcwa-float-button {
        width: 60px !important;
        height: 60px !important;
        border-radius: 50% !important;
        padding: 0 !important;
    }
}

/* Button icon */
#vtcwa-widget-container .vtcwa-button-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
}

#vtcwa-widget-container .vtcwa-button-icon svg {
    width: 100% !important;
    height: 100% !important;
    fill: white !important;
}

/* Override general img styles for WhatsApp avatar */
#vtcwa-widget-container .vtcwa-agent-avatar {
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
    max-width: 45px !important;
    max-height: 45px !important;
    flex-shrink: 0 !important;
}

#vtcwa-widget-container .vtcwa-agent-avatar img {
    width: 45px !important;
    height: 45px !important;
    min-width: 45px !important;
    min-height: 45px !important;
    max-width: 45px !important;
    max-height: 45px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

/* Button text styling - Desktop only */
@media (min-width: 769px) {
    #vtcwa-widget-container .vtcwa-button-text {
        font-size: 16px !important;
        font-weight: 500 !important;
        color: white !important;
        white-space: nowrap !important;
        display: none !important; /* Hide by default */
    }
    
    /* Show text only for text style */
    #vtcwa-widget-container .vtcwa-style-text .vtcwa-button-text {
        display: inline-block !important;
        margin-left: 4px !important;
    }
    
    /* Hide text for rounded and square styles */
    #vtcwa-widget-container .vtcwa-style-rounded .vtcwa-button-text,
    #vtcwa-widget-container .vtcwa-style-square .vtcwa-button-text {
        display: none !important;
    }
}

/* Hide button text on mobile */
@media (max-width: 768px) {
    #vtcwa-widget-container .vtcwa-button-text {
        display: none !important;
    }
}

/* Fix for mobile chat open state */
body.vtcwa-chat-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* Chat window - hidden by default */
#vtcwa-widget-container .vtcwa-chat-window {
    position: absolute !important;
    bottom: 80px !important;
    right: 20px !important;
    width: 370px !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(20px) scale(0.95) !important;
    transition: all 0.3s ease !important;
    overflow: hidden !important;
}

/* Chat window - active state */
#vtcwa-widget-container .vtcwa-chat-window.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) scale(1) !important;
}

/* Mobile specific styles */
@media (max-width: 768px) {
    #vtcwa-widget-container {
        bottom: 15px !important;
        right: 15px !important;
        z-index: 2147483647 !important;
    }
    
    #vtcwa-widget-container .vtcwa-float-button,
    #vtcwa-float-button {
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
    }
    
    #vtcwa-widget-container .vtcwa-button-icon {
        width: 28px !important;
        height: 28px !important;
    }
    
    /* Override general img styles for mobile */
    #vtcwa-widget-container .vtcwa-agent-avatar {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
    
    #vtcwa-widget-container .vtcwa-agent-avatar img {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
        object-fit: cover !important;
        border-radius: 50% !important;
    }
    
    #vtcwa-widget-container .vtcwa-chat-window,
    #vtcwa-chat-window {
        position: fixed !important;
        width: 90% !important;
        max-width: 350px !important;
        height: 70vh !important;
        max-height: 500px !important;
        bottom: 80px !important;
        left: 50% !important;
        transform: translateX(-50%) translateY(20px) scale(0.95) !important;
        right: auto !important;
        z-index: 2147483646 !important;
        display: none !important;
    }
    
    #vtcwa-widget-container .vtcwa-chat-window.active,
    #vtcwa-chat-window.active {
        transform: translateX(-50%) translateY(0) scale(1) !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Extra small devices */
@media (max-width: 375px) {
    #vtcwa-widget-container .vtcwa-chat-window {
        width: 95% !important;
        height: 75vh !important;
    }
}