/* Modern WhatsApp Chatbot Styles */
.whatsapp-chat {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    font-family: 'Inter', sans-serif;
}

/* Chat Toggle Button */
.chat-toggle {
    width: 70px;
    height: 70px;
    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);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.chat-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 40px rgba(37, 211, 102, 0.6);
}

.chat-toggle:hover::before {
    opacity: 1;
}

.chat-toggle i {
    color: white;
    font-size: 28px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.chat-toggle.active i.fa-whatsapp {
    transform: rotate(180deg) scale(0);
}

.chat-toggle.active i.fa-times {
    transform: rotate(0deg) scale(1);
}

.chat-toggle i.fa-times {
    position: absolute;
    transform: rotate(-180deg) scale(0);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(135deg, #ff4757 0%, #ff3742 100%);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    animation: pulse 2s infinite;
    border: 2px solid white;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 90px;
    right: 0;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: scale(0) translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.chat-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="40" r="1.5" fill="rgba(255,255,255,0.1)"/><circle cx="40" cy="80" r="1" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.3;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #25D366;
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
}

.chat-info {
    flex: 1;
    position: relative;
    z-index: 2;
}

.chat-info h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.chat-status {
    font-size: 13px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: #4CAF50;
    border-radius: 50%;
    animation: blink 2s infinite;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

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

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: linear-gradient(to bottom, #f0f2f5 0%, #e5ddd5 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.chat-messages::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="whatsapp-bg" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="0.5" fill="rgba(0,0,0,0.05)"/></pattern></defs><rect width="100" height="100" fill="url(%23whatsapp-bg)"/></svg>');
    opacity: 0.3;
    pointer-events: none;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    animation: messageSlide 0.3s ease;
    word-wrap: break-word;
    position: relative;
    z-index: 1;
}

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

.message.bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.message.bot::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.user {
    background: linear-gradient(135deg, #DCF8C6 0%, #D1F2C0 100%);
    color: #333;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.user::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-top: none;
}

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80%;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1;
}

.typing-indicator::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;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

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

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-12px);
        opacity: 1;
    }
}

/* Quick Replies */
.quick-replies {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.quick-reply {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    color: #495057;
    position: relative;
    overflow: hidden;
}

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

.quick-reply:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
    border-color: #25D366;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.2);
}

.quick-reply:hover::before {
    left: 100%;
}

.quick-reply.primary {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border-color: #25D366;
    font-weight: 600;
}

.quick-reply.primary:hover {
    background: linear-gradient(135deg, #128C7E 0%, #0d7377 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

/* Chat Input */
.chat-input {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.chat-input input:focus {
    border-color: #25D366;
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.send-button {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.send-button:hover {
    background: linear-gradient(135deg, #128C7E 0%, #0d7377 100%);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.send-button i {
    font-size: 16px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .whatsapp-chat {
        right: 20px;
        bottom: 20px;
    }
    
    .chat-window {
        width: calc(100vw - 40px);
        height: 70vh;
        bottom: 90px;
        right: 0;
        left: 20px;
        border-radius: 20px;
    }
    
    .chat-toggle {
        width: 60px;
        height: 60px;
    }
    
    .chat-toggle i {
        font-size: 24px;
    }
    
    .chat-header {
        padding: 16px 20px;
    }
    
    .chat-avatar {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .chat-info h4 {
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 20px;
    }
    
    .quick-replies {
        padding: 16px 20px;
    }
    
    .chat-input {
        padding: 16px 20px;
    }
}

/* Custom Scrollbar */
.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);
}

.quick-replies::-webkit-scrollbar {
    width: 4px;
}

.quick-replies::-webkit-scrollbar-track {
    background: transparent;
}

.quick-replies::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Dark Theme Support */
[data-theme="dark"] .chat-window {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .chat-messages {
    background: linear-gradient(to bottom, #1a1a1a 0%, #2a2a2a 100%);
}

[data-theme="dark"] .message.bot {
    background: #404040;
    color: #e8e8e8;
    border-color: #505050;
}

[data-theme="dark"] .message.bot::before {
    border-right-color: #404040;
    border-bottom-color: #404040;
}

[data-theme="dark"] .typing-indicator {
    background: #404040;
    border-color: #505050;
}

[data-theme="dark"] .typing-indicator::before {
    border-right-color: #404040;
    border-bottom-color: #404040;
}

[data-theme="dark"] .quick-replies {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .quick-reply {
    background: linear-gradient(135deg, #404040 0%, #505050 100%);
    border-color: #505050;
    color: #e8e8e8;
}

[data-theme="dark"] .quick-reply:hover {
    background: linear-gradient(135deg, #505050 0%, #606060 100%);
}

[data-theme="dark"] .chat-input {
    background: #2a2a2a;
    border-color: #404040;
}

[data-theme="dark"] .chat-input input {
    background: #404040;
    border-color: #505050;
    color: #e8e8e8;
}

[data-theme="dark"] .chat-input input:focus {
    background: #505050;
}

/* Accessibility Improvements */
.chat-toggle:focus,
.quick-reply:focus,
.send-button:focus,
.chat-input input:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .chat-toggle,
    .chat-window,
    .message,
    .quick-reply,
    .send-button {
        transition: none;
        animation: none;
    }
    
    .notification-badge,
    .status-dot,
    .typing-dot {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .chat-window {
        border: 3px solid #000;
    }
    
    .message.bot {
        border: 2px solid #000;
    }
    
    .quick-reply {
        border: 2px solid #000;
    }
}

