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

.whatsapp-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    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;
    animation: pulse 2s infinite;
}

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

.whatsapp-widget.chat-open .whatsapp-button {
    background: #dc3545;
    animation: none;
}

.whatsapp-widget.chat-open .whatsapp-button svg {
    display: none;
}

.whatsapp-widget.chat-open .whatsapp-button::after {
    content: '×';
    color: white;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
}

@keyframes pulse {
    0% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    }

    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.8), 0 0 0 10px rgba(37, 211, 102, 0.1);
    }

    100% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    }
}

.whatsapp-chat-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    max-width: calc(100vw - 40px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.9);
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 999999 !important;
    pointer-events: none;
}

.whatsapp-chat-popup.active {
    pointer-events: auto;
}

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

.chat-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    position: relative;
    width: 50px;
    height: 50px;
}

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

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #4CAF50;
    border: 2px solid white;
    border-radius: 50%;
}

.info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.info .status {
    font-size: 13px;
    opacity: 0.9;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-body {
    padding: 20px;
    min-height: 120px;
    background: #f0f2f5;
}

.message {
    margin-bottom: 15px;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

.message-content::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-bottom: none;
}

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

.message-content p+p {
    margin-top: 4px;
}

.message-time {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    display: block;
}

.chat-footer {
    padding: 15px 20px 20px;
    background: white;
}

.input-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-container input:focus {
    border-color: #25D366;
}

.send-button {
    width: 40px;
    height: 40px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.send-button:hover {
    background: #128C7E;
}

.quick-messages {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-msg {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 8px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.quick-msg:hover {
    background: #25D366;
    color: white;
    border-color: #25D366;
}

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

    .whatsapp-chat-popup {
        width: 320px;
        max-width: calc(100vw - 30px);
    }

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

    .whatsapp-button svg {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 480px) {
    .whatsapp-chat-popup {
        width: 300px;
        bottom: 70px;
        right: -10px;
    }

    .chat-header {
        padding: 15px;
    }

    .avatar {
        width: 40px;
        height: 40px;
    }

    .info h4 {
        font-size: 14px;
    }

    .info .status {
        font-size: 12px;
    }
}

/* RTL Support */
html[dir="rtl"] .whatsapp-widget {
    left: 20px;
    right: auto;
}

html[dir="rtl"] .whatsapp-chat-popup {
    left: 0;
    right: auto;
}

html[dir="rtl"] .message-content {
    border-radius: 18px 18px 4px 18px;
}

html[dir="rtl"] .message-content::before {
    left: auto;
    right: -8px;
    border-left-color: white;
    border-right: none;
}/* User an
d System Message Styles */
.user-message {
    background: #dcf8c6 !important;
    border-radius: 18px 18px 4px 18px !important;
    margin-left: 20px;
}

.user-message::before {
    display: none;
}

.system-message {
    background: #e3f2fd !important;
    border-radius: 18px !important;
    text-align: center;
    font-style: italic;
    color: #1976d2 !important;
}

.system-message::before {
    display: none;
}

.message.user {
    text-align: right;
}

.message.system {
    text-align: center;
    margin: 10px 0;
}

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