/* ========================================
   PREMIUM WHATSAPP CHATBOT WIDGET
   Senior Developer Level Implementation
   ======================================== */

/* Main Widget Container */
.whatsapp-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Chat Button */
.whatsapp-chat-btn {
    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 30px rgba(37, 211, 102, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.whatsapp-chat-btn:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 
        0 12px 40px rgba(37, 211, 102, 0.5),
        0 6px 16px rgba(0, 0, 0, 0.25);
}

.whatsapp-chat-btn:active {
    transform: scale(0.95);
}

/* WhatsApp Icon */
.whatsapp-chat-btn svg {
    width: 35px;
    height: 35px;
    fill: #fff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Notification Badge */
.whatsapp-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #FF4444 0%, #CC0000 100%);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    border: 3px solid #fff;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.5);
    animation: bounce 1s ease-in-out infinite;
}

/* Pulse Animation */
@keyframes pulse {
    0%, 100% {
        box-shadow: 
            0 8px 30px rgba(37, 211, 102, 0.4),
            0 4px 12px rgba(0, 0, 0, 0.2),
            0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    50% {
        box-shadow: 
            0 8px 30px rgba(37, 211, 102, 0.4),
            0 4px 12px rgba(0, 0, 0, 0.2),
            0 0 0 15px rgba(37, 211, 102, 0);
    }
}

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

/* Chat Popup Window */
.whatsapp-chat-popup {
    position: absolute;
    bottom: 85px;
    right: 0;
    width: 360px;
    max-height: 550px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.whatsapp-chat-popup.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Popup Header */
.whatsapp-popup-header {
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

.whatsapp-popup-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.whatsapp-popup-info {
    flex: 1;
    color: #fff;
}

.whatsapp-popup-info h4 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    font-weight: 700;
}

.whatsapp-popup-info p {
    margin: 0;
    font-size: 0.85em;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.whatsapp-online-indicator {
    width: 8px;
    height: 8px;
    background: #25D366;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.5s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.whatsapp-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 20px;
}

.whatsapp-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Popup Body */
.whatsapp-popup-body {
    padding: 25px;
    background: linear-gradient(135deg, #ECE5DD 0%, #D9D3CC 100%);
    flex: 1;
    overflow-y: auto;
}

/* Message Bubble */
.whatsapp-message {
    background: #fff;
    padding: 15px 18px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
    position: relative;
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.whatsapp-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 8px 10px 0;
    border-color: transparent #fff transparent transparent;
}

.whatsapp-message p {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 0.95em;
    line-height: 1.5;
}

.whatsapp-message p:last-child {
    margin-bottom: 0;
}

.whatsapp-message-time {
    font-size: 0.75em;
    color: #999;
    text-align: right;
    margin-top: 8px;
}

/* Quick Reply Buttons */
.whatsapp-quick-replies {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.whatsapp-quick-reply-btn {
    background: #fff;
    border: 2px solid #25D366;
    color: #075E54;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.whatsapp-quick-reply-btn:hover {
    background: #25D366;
    color: #fff;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

/* Popup Footer */
.whatsapp-popup-footer {
    padding: 15px 20px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
}

.whatsapp-start-chat-btn {
    width: 100%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #fff;
    border: none;
    padding: 14px 20px;
    border-radius: 30px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

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

.whatsapp-start-chat-btn:active {
    transform: translateY(0);
}

/* Tooltip */
.whatsapp-tooltip {
    position: absolute;
    bottom: 50%;
    right: 80px;
    transform: translateY(50%);
    background: #000;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.whatsapp-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 8px 0 8px 8px;
    border-color: transparent transparent transparent #000;
}

.whatsapp-chat-btn:hover .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
    right: 85px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .whatsapp-widget {
        bottom: 20px;
        right: 20px;
    }

    .whatsapp-chat-btn {
        width: 60px;
        height: 60px;
    }

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

    .whatsapp-chat-popup {
        width: calc(100vw - 40px);
        max-width: 360px;
        bottom: 80px;
        right: -10px;
    }

    .whatsapp-tooltip {
        display: none;
    }
}

@media (max-width: 480px) {
    .whatsapp-chat-popup {
        width: calc(100vw - 20px);
        right: -20px;
        max-height: 500px;
    }

    .whatsapp-popup-header {
        padding: 15px;
    }

    .whatsapp-popup-body {
        padding: 20px 15px;
    }
}

/* Accessibility */
.whatsapp-chat-btn:focus-visible,
.whatsapp-close-btn:focus-visible,
.whatsapp-quick-reply-btn:focus-visible,
.whatsapp-start-chat-btn:focus-visible {
    outline: 3px solid #FFD700;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .whatsapp-widget {
        display: none !important;
    }
}
