<style>
/* Modern Floating Chat Button */
.floating-chat-btn {
    position: fixed !important;
    bottom: 30px !important;
    right: 30px !important;
    width: 60px !important;
    height: 60px !important;
    background: #25D366 !important;
    border: none !important;
    border-radius: 50% !important;
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.floating-chat-btn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 12px 35px rgba(37, 211, 102, 0.5) !important;
    background: #22c35e !important;
}

.floating-chat-btn:active {
    transform: scale(0.95) !important;
}

.floating-chat-btn svg {
    width: 32px !important;
    height: 32px !important;
    fill: white !important;
}

.chat-badge {
    position: absolute !important;
    top: -5px !important;
    right: -5px !important;
    background: #ef4444 !important;
    color: white !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid white !important;
}

/* Chat Window */
.chat-window {
    position: fixed !important;
    bottom: 100px !important;
    right: 30px !important;
    width: 380px !important;
    height: 500px !important;
    background: white !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15) !important;
    display: none !important;
    flex-direction: column !important;
    z-index: 9998 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    border: 1px solid #e5e7eb !important;
}

.chat-window.active {
    display: flex !important;
}

.chat-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    padding: 16px 20px !important;
    border-radius: 16px 16px 0 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-weight: 600 !important;
    font-size: 16px !important;
}

.chat-close-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
    font-size: 18px !important;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

.chat-messages {
    flex: 1 !important;
    padding: 20px !important;
    overflow-y: auto !important;
    background: #f9fafb !important;
}

.chat-message {
    margin-bottom: 16px !important;
    display: flex !important;
    flex-direction: column !important;
}

.chat-message.sent {
    align-items: flex-end !important;
}

.chat-message.received {
    align-items: flex-start !important;
}

.message-content {
    max-width: 70% !important;
    background: white !important;
    padding: 12px 16px !important;
    border-radius: 16px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
}

.chat-message.sent .message-content {
    background: #10b981 !important;
    color: white !important;
}

.chat-message.received .message-content {
    background: white !important;
    color: #1f2937 !important;
}

.sender-info {
    font-size: 12px !important;
    font-weight: 600 !important;
    margin-bottom: 4px !important;
    opacity: 0.8 !important;
}

.message-time {
    font-size: 11px !important;
    opacity: 0.7 !important;
    margin-top: 4px !important;
}

.chat-input-form {
    padding: 16px 20px !important;
    border-top: 1px solid #e5e7eb !important;
    background: white !important;
    border-radius: 0 0 16px 16px !important;
    display: flex !important;
    gap: 12px !important;
}

.chat-input-form input {
    flex: 1 !important;
    padding: 12px 16px !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 25px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: border-color 0.2s !important;
}

.chat-input-form input:focus {
    border-color: #10b981 !important;
}

.chat-input-form button {
    background: #10b981 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s !important;
    font-weight: 600 !important;
}

.chat-input-form button:hover {
    background: #059669 !important;
}

.chat-typing-indicator {
    padding: 8px 20px !important;
    font-size: 12px !important;
    color: #6b7280 !important;
    font-style: italic !important;
    background: #f9fafb !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .floating-chat-btn {
        bottom: 20px !important;
        right: 20px !important;
        width: 56px !important;
        height: 56px !important;
    }
    
    .chat-window {
        width: calc(100vw - 40px) !important;
        height: calc(100vh - 120px) !important;
        bottom: 80px !important;
        right: 20px !important;
        left: 20px !important;
    }
    
    .floating-chat-btn svg {
        width: 24px !important;
        height: 24px !important;
    }
}
</style>

<?php
require_once __DIR__ . '/settings.php';
$waNumber = get_setting($pdo, 'whatsapp_number', '1234567890');
// Remove non-numeric characters for the link
$waLink = preg_replace('/\D/', '', $waNumber);
?>
<!-- Modern Floating WhatsApp Button -->
<a href="https://wa.me/<?= e($waLink) ?>?text=Hello%20Go%20Legal%2C%20I%20need%20help%20with%20my%20business%20registration" target="_blank" class="floating-chat-btn" aria-label="Chat on WhatsApp">
    <svg viewBox="0 0 24 24">
        <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.414 0 .018 5.393 0 12.029c0 2.125.556 4.197 1.613 6.06L0 24l6.117-1.605a11.813 11.813 0 005.932 1.577h.005c6.632 0 12.028-5.391 12.031-12.027a11.815 11.815 0 00-3.536-8.451"/>
    </svg>
</a>

<!-- Chat widget disabled; using WhatsApp button -->

<script>
// Chat widget logic disabled. Using WhatsApp direct link.
console.log('WhatsApp support button active');
</script>
