﻿/* Mogge Chatbot Widget */

.chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 90;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating button */
.chat-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.5);
}

.chat-toggle .chat-icon {
    font-size: 28px;
    transition: transform 0.3s;
}

.chat-toggle.open .chat-icon {
    transform: rotate(90deg) scale(0);
    position: absolute;
}

.chat-toggle .close-icon {
    font-size: 24px;
    position: absolute;
    transform: rotate(-90deg) scale(0);
    transition: transform 0.3s;
}

.chat-toggle.open .close-icon {
    transform: rotate(0deg) scale(1);
}

/* Pulse animation on load */
.chat-toggle::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #6366f1;
    animation: chat-pulse 2s ease-out infinite;
}

.chat-toggle.open::after {
    display: none;
}

@keyframes chat-pulse {
    0% { transform: scale(1); opacity: 0.6; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* Greeting bubble */
.chat-greeting {
    position: absolute;
    bottom: 76px;
    right: 0;
    background: white;
    border-radius: 16px 16px 4px 16px;
    padding: 12px 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    font-size: 14px;
    color: #1f2937;
    white-space: nowrap;
    animation: greet-in 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.chat-greeting::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    box-shadow: 2px 2px 4px rgba(0,0,0,0.05);
}

@keyframes greet-in {
    0% { opacity: 0; transform: scale(0.8) translateY(8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-greeting.hidden {
    display: none;
}

/* Chat window */
.chat-window {
    position: absolute;
    bottom: 76px;
    right: 0;
    width: 380px;
    height: 520px;
    max-height: calc(100vh - 160px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.8) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.chat-window.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
    z-index: 10000;
}

/* Chat header */
.chat-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.chat-header-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.chat-header-info p {
    font-size: 12px;
    opacity: 0.85;
    margin: 2px 0 0;
}

.chat-clear-btn {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chat-clear-btn:hover {
    background: rgba(255,255,255,0.3);
}

.chat-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    margin-right: 4px;
    animation: status-blink 2s infinite;
}

@keyframes status-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fb;
}

.chat-messages::-webkit-scrollbar {
    width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

/* Message bubbles */
.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: msg-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes msg-in {
    0% { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.chat-msg.bot {
    background: white;
    color: #1f2937;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-msg.user {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-typing {
    display: none;
    align-self: flex-start;
    background: white;
    padding: 12px 18px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.chat-typing.visible {
    display: flex;
    gap: 4px;
    align-items: center;
}

.chat-typing span {
    width: 7px;
    height: 7px;
    background: #a5b4fc;
    border-radius: 50%;
    animation: typing-bounce 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Quick actions */
.chat-quick-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 0 12px 6px;
    background: #f8f9fb;
}

.chat-quick-btn {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 3px 10px;
    font-size: 11px;
    color: #6366f1;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-quick-btn:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
}

/* Action button (navigate to products) */
.chat-action-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.chat-action-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Input area */
.chat-input-area {
    display: flex;
    padding: 12px 16px;
    gap: 8px;
    border-top: 1px solid #f0f0f0;
    background: white;
}

.chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.chat-input:focus {
    border-color: #6366f1;
}

.chat-input::placeholder {
    color: #9ca3af;
}

.chat-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.chat-send:hover {
    transform: scale(1.1);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Responsive */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        max-height: calc(100vh - 160px);
        bottom: 72px;
        right: -8px;
        border-radius: 16px;
    }

    .chat-greeting {
        display: none;
    }
}
