/* WhatsApp Chat Widget Styles */
.whatsapp-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* WhatsApp Button */
.whatsapp-button {
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    position: relative;
}

.whatsapp-button:hover {
    background: #20ba5a;
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.6);
}

.whatsapp-button i {
    font-size: 32px;
    color: white;
}

.whatsapp-button.active {
    transform: scale(0.9);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff0000;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-5px);
    }
}

/* Pulse Animation */
.whatsapp-button.pulse {
    animation: pulse 1s ease;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* Chat Box */
.whatsapp-chat-box {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 360px;
    max-height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.whatsapp-chat-box.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

/* Chat Header */
.chat-header {
    background: #ffffff;
    color: rgb(0, 0, 0);
    padding: 16px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chat-avatar {
    width: 45px;
    height: 45px;
    background: white;
    color: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.chat-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-info p {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #E5DDD5;
    background-image: url('https://www.appetenza.com/161125/images/appetenzachat.png');
    max-height: 350px;
}

/* Message Bubble */
.message {
    margin-bottom: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    background: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    display: inline-block;
    max-width: 80%;
}

.message.received .message-content {
    background: white;
    border-radius: 0 8px 8px 8px;
}

.message.sent .message-content {
    background: #DCF8C6;
    border-radius: 8px 0 8px 8px;
    margin-left: auto;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #303030;
    white-space: pre-line;
}

.message-time {
    display: block;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    text-align: right;
}

/* Quick Replies */
.quick-replies {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #e0e0e0;
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: #303030;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.quick-reply-btn:hover {
    background: #f0f0f0;
    border-color: #25D366;
    transform: translateX(4px);
}

.quick-reply-btn i {
    color: #25D366;
    font-size: 16px;
}

/* Chat Input */
.chat-input {
    display: flex;
    padding: 12px;
    background: #f0f0f0;
    border-radius: 0 0 16px 16px;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    background: white;
}

.send-button {
    width: 45px;
    height: 45px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 22px;
}

.send-button:hover {
    background: #20ba5a;
    transform: scale(1.1);
}

.send-button:active {
    transform: scale(0.95);
}

/* Chat Footer */
.chat-footer {
    padding: 8px;
    text-align: center;
    background: #f0f0f0;
    border-radius: 0 0 16px 16px;
    margin-top: -8px;
}

.chat-footer small {
    font-size: 10px;
    color: #999;
}

/* Scrollbar Styles */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .whatsapp-chat-widget {
        right: 10px;
        bottom: 10px;
    }

    .whatsapp-chat-box {
        width: calc(100vw - 20px);
        right: -10px;
        bottom: 70px;
        max-height: 500px;
    }

    .whatsapp-button {
        width: 55px;
        height: 55px;
    }

    .whatsapp-button i {
        font-size: 28px;
    }

    .quick-reply-btn {
        font-size: 12px;
        padding: 10px 14px;
    }
}

/* Hide on very small screens if needed */
@media (max-width: 320px) {
    .quick-replies {
        display: none;
    }
}