/* Chatbot Variables */
:root {
    --chat-bg: rgba(10, 10, 10, 0.8);
    --chat-border: rgba(74, 222, 128, 0.2);
    --chat-neon: #4ade80;
    --chat-text: #e2e8f0;
    --chat-user-bg: rgba(74, 222, 128, 0.2);
    --chat-ai-bg: rgba(255, 255, 255, 0.05);
}

/* Floating Action Button */
#marsel-chat-trigger {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(5, 5, 5, 0.9);
    border: 1px solid var(--chat-neon);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
}

#marsel-chat-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.5);
}

#marsel-chat-trigger svg {
    width: 30px;
    height: 30px;
    color: var(--chat-neon);
    transition: transform 0.3s ease;
}

#marsel-chat-trigger.active svg.chat-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
    position: absolute;
}

#marsel-chat-trigger.active svg.close-icon {
    opacity: 1;
    transform: rotate(0) scale(1);
    position: absolute;
}

#marsel-chat-trigger svg.close-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
    position: absolute;
}

/* Main Chat Window */
#marsel-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: var(--chat-bg);
    border: 1px solid var(--chat-border);
    border-radius: 24px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Outfit', sans-serif;
}

#marsel-chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.chat-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar-container {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(74, 222, 128, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--chat-border);
}

.chat-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--chat-neon);
    border-radius: 50%;
    border: 2px solid #000;
    box-shadow: 0 0 8px var(--chat-neon);
}

.chat-title h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    margin: 0;
    line-height: 1.2;
}

.chat-title span {
    font-size: 0.75rem;
    color: var(--chat-neon);
    letter-spacing: 0.5px;
}

/* Messages Area */
#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Message Bubbles */
.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
    animation: messageIn 0.3s ease forwards;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: var(--chat-user-bg);
    color: white;
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.message.ai {
    align-self: flex-start;
    background: var(--chat-ai-bg);
    color: var(--chat-text);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message.ai b {
    color: var(--chat-neon);
    font-weight: 600;
}

/* Input Area */
.chat-input-area {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}

#chat-input:focus {
    border-color: var(--chat-neon);
    background: rgba(74, 222, 128, 0.05);
}

#chat-send {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--chat-neon);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #000;
}

#chat-send:hover {
    transform: scale(1.05);
    background: #22c55e;
}

#chat-send:active {
    transform: scale(0.95);
}

#chat-send svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    display: none; /* Hidden by default */
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--chat-neon);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #marsel-chat-window {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    #marsel-chat-trigger {
        bottom: 20px;
        right: 20px;
    }
}
