/* ========================================
   MATHEMEDIA - CHATBOT STYLES
   ======================================== */

/* Chatbot Button */
.chatbot-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: var(--color-accent);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(77, 163, 255, 0.4);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: slideInUp 0.5s ease-out;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(77, 163, 255, 0.5);
}

.chatbot-button.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0);
}

.chatbot-button svg {
    width: 28px;
    height: 28px;
    fill: white;
}

.chatbot-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #FF4757;
    border-radius: 50%;
    color: white;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.chatbot-button.auto-open-hint {
    animation: bounce 1s ease-in-out 3;
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    height: 525px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0);
    opacity: 0;
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.open {
    transform: scale(1);
    opacity: 1;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #4ADE80;
    border-radius: 50%;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.chatbot-minimize:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-minimize svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Chatbot Messages */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--color-background-alt);
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 3px;
}

.chat-message {
    display: flex;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.chat-message.bot .chat-bubble {
    background: white;
    color: var(--color-text);
    border-bottom-left-radius: 4px;
}

.chat-message.user .chat-bubble {
    background: var(--color-accent);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-timestamp {
    font-size: 11px;
    color: var(--color-text-light);
    margin-top: 4px;
    text-align: right;
}

.chat-message.bot .chat-timestamp {
    text-align: left;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--color-text-light);
    border-radius: 50%;
    animation: typing 1.4s ease-in-out 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); }
    30% { transform: translateY(-8px); }
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-action-btn {
    background: white;
    border: 1px solid var(--color-border);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--color-text);
}

.quick-action-btn:hover {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* Welcome Message */
.welcome-message {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.welcome-message h3 {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--color-primary);
    margin-bottom: 8px;
}

.welcome-message p {
    font-size: 14px;
    color: var(--color-text);
    line-height: 1.5;
}

/* Chatbot Input */
.chatbot-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--color-border);
}

.chatbot-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chatbot-input {
    flex: 1;
    border: 1px solid var(--color-border);
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: var(--font-primary);
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--color-accent);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: var(--color-accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn:hover {
    background: #3A8EE6;
    transform: scale(1.05);
}

.chatbot-send-btn:disabled {
    background: var(--color-border);
    cursor: not-allowed;
    transform: scale(1);
}

.chatbot-send-btn svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 32px);
        height: calc(100vh - 120px);
        right: 16px;
        bottom: 90px;
    }
}
