/* WhatsApp Widget Improved Styles */
.whatsapp-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Chat Button - Modern Design */
.whatsapp-chat-button {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 28px;
    padding: 14px 24px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    font-weight: 600;
    font-size: 14px;
    border: none;
    position: relative;
    overflow: hidden;
    min-width: 160px;
    justify-content: center;
}

.whatsapp-chat-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.whatsapp-chat-button:hover::before {
    left: 100%;
}

.whatsapp-chat-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(37, 211, 102, 0.6);
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
}

.whatsapp-chat-button:active {
    transform: translateY(-1px);
}

.whatsapp-chat-button svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.whatsapp-chat-button:hover svg {
    transform: scale(1.1);
}

/* Chat Popup - Enhanced Design */
.whatsapp-chat-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 340px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
    overflow: hidden;
    animation: slideUpScale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom right;
}

@keyframes slideUpScale {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

.whatsapp-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.whatsapp-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
    border: 2px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-placeholder svg {
    width: 24px;
    height: 24px;
}

.whatsapp-info {
    flex: 1;
}

.whatsapp-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

.whatsapp-info .status {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.whatsapp-info .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.close-btn:hover {
    background: rgba(255,255,255,0.15);
    opacity: 1;
    transform: rotate(90deg);
}

/* Body - Chat Interface */
.whatsapp-body {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 140px;
    position: relative;
}

.whatsapp-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 25% 25%, rgba(37, 211, 102, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(18, 140, 126, 0.03) 0%, transparent 50%);
    pointer-events: none;
}

.message-bubble {
    background: white;
    padding: 16px 18px;
    border-radius: 18px;
    margin-bottom: 12px;
    max-width: 85%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    position: relative;
    border-bottom-left-radius: 6px;
    animation: fadeInUp 0.4s ease;
}

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

.message-bubble::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: white;
    border-bottom-color: white;
    border-left: none;
    border-top: none;
}

.message-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3e50;
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    text-align: right;
    margin-top: 8px;
    opacity: 0.7;
}

/* Footer - Action Button */
.whatsapp-footer {
    padding: 20px;
    background: white;
    border-top: 1px solid #f1f3f4;
}

.whatsapp-btn {
    width: 100%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

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

.whatsapp-btn:hover {
    background: linear-gradient(135deg, #128C7E 0%, #25D366 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
}

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

.whatsapp-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.whatsapp-btn:hover svg {
    transform: scale(1.1);
}

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

    .whatsapp-chat-popup {
        width: 320px;
        bottom: 70px;
        right: -40px;
    }

    .whatsapp-chat-button span {
        display: none;
    }

    .whatsapp-chat-button {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        padding: 16px;
        justify-content: center;
        min-width: auto;
    }
}

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

/* Additional Enhancements */
.whatsapp-widget * {
    box-sizing: border-box;
}

.whatsapp-chat-button,
.whatsapp-btn,
.close-btn {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
