/**
 * Maple Bot Styles
 * Styling for the friendly AI assistant chat widget
 */

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    z-index: 999;
    transform: translateY(400px) scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    pointer-events: none;
}

.chat-widget.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid white;
    font-weight: bold;
}

.chat-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.chat-status {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
}

.chat-status::before {
    content: '● ';
    color: #4ade80;
    font-weight: bold;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.chat-close:hover {
    transform: rotate(90deg);
}

/* Chat Body */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Chat Messages */
.chat-message {
    display: flex;
    margin-bottom: 0.5rem;
    animation: slideInUp 0.3s ease;
}

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

.chat-message p {
    margin: 0;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
}

/* User Message */
.user-message {
    justify-content: flex-end;
}

.user-message p {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 18px 4px 18px 18px;
}

/* Bot Message */
.bot-message {
    justify-content: flex-start;
}

.bot-message p {
    background: white;
    color: #1a202c;
    border: 1px solid #e2e8f0;
    border-radius: 4px 18px 18px 18px;
    font-weight: 500;
}

/* Security Warning Messages */
.security-warning p {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
    border-left: 3px solid #f59e0b;
}

/* Typing Indicator */
.typing-indicator {
    display: flex !important;
    align-items: center;
    gap: 6px;
    padding: 0.75rem 1rem;
    background: white;
    width: fit-content;
    border-radius: 4px 18px 18px 18px;
    border: 1px solid #e2e8f0;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #667eea;
    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% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Chat Actions */
.chat-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.chat-action-btn {
    padding: 0.6rem 1rem;
    border: 1px solid #e2e8f0;
    background: white;
    color: #1a202c;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    text-align: left;
}

.chat-action-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateX(4px);
}

.chat-action-btn.whatsapp-btn {
    border-color: #25d366;
}

.chat-action-btn.whatsapp-btn:hover {
    background: #25d366;
    border-color: #25d366;
}

.chat-action-btn.email-btn {
    border-color: #ea4335;
}

.chat-action-btn.email-btn:hover {
    background: #ea4335;
    border-color: #ea4335;
}

.chat-action-btn.contact-btn {
    border-color: #667eea;
}

.chat-action-btn.contact-btn:hover {
    background: #667eea;
    border-color: #667eea;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.quick-reply-btn {
    padding: 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.quick-reply-btn:hover {
    transform: translateX(4px) translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Chat Footer */
.chat-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    background: white;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 16px 16px;
}

#chatInput {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

#chatInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#chatSend {
    padding: 0.6rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

#chatSend:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#chatSend:active {
    transform: translateY(0);
}

/* Chat Bubble */
.chat-bubble {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    z-index: 998;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.chat-bubble:active {
    transform: scale(0.95);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6);
    }
}

/* Welcome Notification */
.maple-welcome-notification {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 997;
    max-width: 280px;
    animation: slideInRight 0.3s ease;
    cursor: pointer;
    border-left: 4px solid #667eea;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification-emoji {
    font-size: 1.5rem;
}

.maple-welcome-notification p {
    margin: 0;
    font-size: 0.9rem;
    color: #1a202c;
    font-weight: 500;
}

.maple-welcome-notification.fade-out {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Form Success Message */
.form-success-message {
    padding: 1rem;
    background: #dcfce7;
    color: #166534;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #22c55e;
    animation: slideInUp 0.3s ease;
}

.form-success-message.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-widget {
        width: calc(100vw - 20px);
        height: 70vh;
        max-height: 500px;
        right: 10px;
        bottom: 80px;
    }
    
    .chat-bubble {
        right: 10px;
        bottom: 10px;
    }
    
    .maple-welcome-notification {
        right: 10px;
        bottom: 70px;
        max-width: calc(100vw - 40px);
    }
}

@media (max-width: 320px) {
    .chat-widget {
        border-radius: 8px;
    }
    
    .chat-message p {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}
