/* AI Manager - Global Styles */

/* Floating Trigger Button (ChatGPT Style) */
#ai-widget-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    /* Default position */
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 9999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

#ai-widget-trigger:active {
    cursor: grabbing;
    transform: scale(0.95);
}

#ai-widget-trigger:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

#ai-widget-trigger svg {
    width: 32px;
    height: 32px;
    color: #333;
}

/* Chat Window */
#ai-chat-window {
    position: fixed;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    /* Hidden by default */
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    /* Just below the trigger if overlapping, or same layer */
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Initial position will be set by JS relative to trigger */
}

#ai-chat-window.visible {
    display: flex;
    animation: fadeIn 0.3s ease forwards;
}

/* Header */
.ai-header {
    padding: 16px;
    background: linear-gradient(135deg, #fce4ec 0%, #f3e5f5 100%);
    /* Soft pastel gradient */
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    /* Draggable header */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-header:active {
    cursor: grabbing;
}

.ai-title {
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-close-btn {
    border: none;
    background: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
}

.ai-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

/* Messages Area */
.ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
}

/* Message Bubbles */
.msg-row {
    display: flex;
    width: 100%;
}

.msg-row.user {
    justify-content: flex-end;
}

.msg-row.ai {
    justify-content: flex-start;
}

.msg-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
}

.msg-bubble.user {
    background: #000;
    /* Black like ChatGPT user */
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-bubble.ai {
    background: #fff;
    border: 1px solid #e5e5e5;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

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

#ai-input {
    flex: 1;
    border: 1px solid #e5e5e5;
    border-radius: 20px;
    padding: 10px 16px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

#ai-input:focus {
    border-color: #999;
}

#ai-send-btn {
    width: 40px;
    height: 40px;
    background: #000;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s;
}

#ai-send-btn:hover {
    transform: scale(1.05);
}

#ai-send-btn:active {
    transform: scale(0.95);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}