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

/* Main 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 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.whatsapp-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(37, 211, 102, 0.6);
}

.whatsapp-button i {
    font-size: 2rem;
    color: white;
    z-index: 2;
    position: relative;
}

/* Pulse Animation */
.whatsapp-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(37, 211, 102, 0.3);
    animation: whatsappPulse 2s infinite;
}

@keyframes whatsappPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

/* Chat Window */
.whatsapp-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-height: 650px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transform: scale(0) translateY(20px);
    opacity: 0;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.whatsapp-chat.show {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Chat Header */
.whatsapp-chat-header {
    background: #075E54;
    padding: 15px;
    color: white;
}

.whatsapp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Chat Body */
.whatsapp-chat-body {
    height: 300px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #e5ddd5 0%, #d2dbdc 100%);
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="whatsapp-bg" patternUnits="userSpaceOnUse" width="100" height="100"><circle cx="50" cy="50" r="1" fill="rgba(0,0,0,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23whatsapp-bg)"/></svg>');
}

.whatsapp-messages {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Messages */
.whatsapp-message {
    max-width: 80%;
    animation: messageSlideIn 0.3s ease-out;
}

.whatsapp-message.received {
    align-self: flex-start;
}

.whatsapp-message.sent {
    align-self: flex-end;
}

.message-content {
    background: white;
    padding: 10px 15px;
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.whatsapp-message.received .message-content {
    background: white;
    border-bottom-left-radius: 5px;
}

.whatsapp-message.sent .message-content {
    background: #DCF8C6;
    border-bottom-right-radius: 5px;
}

.message-content p {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

.message-content p:last-of-type {
    margin-bottom: 0;
}

.message-time {
    font-size: 11px;
    color: #999;
    float: right;
    margin-top: 5px;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Quick Options */
.quick-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0;
}

.quick-option {
    background: #f0f2f5;
    border: 1px solid #e4e6ea;
    border-radius: 20px;
    padding: 8px 15px;
    font-size: 13px;
    color: #1c1e21;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.quick-option:hover {
    background: #e4e6ea;
    transform: translateY(-1px);
}

/* Chat Footer */
.whatsapp-chat-footer {
    background: white;
    padding: 15px;
    border-top: 1px solid #e9ecef;
}

.whatsapp-input {
    border-radius: 25px;
    border: 1px solid #e9ecef;
    padding: 10px 15px;
    font-size: 14px;
}

.whatsapp-input:focus {
    border-color: #25D366;
    box-shadow: 0 0 0 0.2rem rgba(37, 211, 102, 0.25);
}

.whatsapp-contact-options {
    margin-top: 15px;
}

/* Notification Dot */
.whatsapp-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #dc3545;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: white;
    animation: notificationBounce 1s infinite;
}

@keyframes notificationBounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-5px);
    }

    60% {
        transform: translateY(-3px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .whatsapp-chat {
        width: 320px;
        bottom: 80px;
        right: -10px;
    }

    .whatsapp-button {
        width: 55px;
        height: 55px;
    }

    .whatsapp-button i {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .whatsapp-chat {
        width: 300px;
        max-height: 450px;
        bottom: 80px;
        right: -20px;
    }

    .whatsapp-chat-body {
        height: 250px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .whatsapp-chat {
        background: #1e1e1e;
    }

    .whatsapp-chat-body {
        background: #2d2d2d;
    }

    .whatsapp-message.received .message-content {
        background: #3d3d3d;
        color: white;
    }

    .quick-option {
        background: #404040;
        border-color: #555;
        color: white;
    }

    .quick-option:hover {
        background: #505050;
    }
}

/* Animation for new messages */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 5px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-10px);
    }
}