{{-- Floating WhatsApp Support Button --}}
@if(\App\Models\Setting::getValue('whatsapp_support_enabled', '1'))
    @php
        $supportPhone = \App\Models\Setting::getValue('whatsapp_support_number', '919876543210');
        $defaultMsg = \App\Models\Setting::getValue('whatsapp_support_message', 'Hi! I need help with The Mini Port platform.');
        $supportMessage = urlencode($defaultMsg);
    @endphp

    <style>
    .whatsapp-float {
        position: fixed;
        width: 60px;
        height: 60px;
        bottom: 30px;
        right: 30px;
        background-color: #25d366;
        color: #FFF;
        border-radius: 50px;
        text-align: center;
        font-size: 30px;
        box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
        z-index: 1000;
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .whatsapp-float:hover {
        background-color: #128c7e;
        color: #FFF;
        transform: scale(1.1);
        box-shadow: 0 8px 25px rgba(37, 211, 102, 0.5);
    }

    .whatsapp-float i {
        margin-top: 2px;
    }

    .whatsapp-tooltip {
        position: fixed;
        bottom: 100px;
        right: 30px;
        background: white;
        padding: 10px 15px;
        border-radius: 10px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
        font-size: 14px;
        font-weight: 500;
        z-index: 999;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s ease;
        pointer-events: none;
    }

    .whatsapp-float:hover + .whatsapp-tooltip,
    .whatsapp-tooltip:hover {
        opacity: 1;
        transform: translateY(0);
    }

    @media (max-width: 768px) {
        .whatsapp-float {
            width: 50px;
            height: 50px;
            bottom: 20px;
            right: 20px;
            font-size: 24px;
        }
        .whatsapp-tooltip {
            display: none;
        }
    }
    </style>

    <a href="https://wa.me/{{ $supportPhone }}?text={{ $supportMessage }}" 
       class="whatsapp-float" 
       target="_blank"
       title="Chat with us on WhatsApp">
        <i class="bi bi-whatsapp"></i>
    </a>
    <div class="whatsapp-tooltip">
        <i class="bi bi-chat-dots me-1"></i> Need Help? Chat with us!
    </div>
@endif
