/* AI Chat Widget Styles - Premium Upgrade */
:root {
    /* Premium Gradient Blue/Purple */
    --chat-primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --chat-bg-color: #ffffff;
    --chat-text-color: #333333;
    --chat-light-gray: #f7f7f9;
    --chat-border-radius: 16px;
    --chat-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    --chat-accent-color: #764ba2;
}

/* Floating Action Button */
.ai-chat-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: var(--chat-primary-gradient);
    border-radius: 50%;
    box-shadow: var(--chat-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-chat-fab:hover {
    transform: scale(1.1) rotate(5deg);
}

.ai-chat-fab svg {
    width: 32px;
    height: 32px;
    fill: white;
}

/* Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background-color: var(--chat-bg-color);
    border-radius: var(--chat-border-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.ai-chat-window.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Chat Header */
.ai-chat-header {
    background: var(--chat-primary-gradient);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-header h3 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.ai-chat-header-actions {
    display: flex;
    gap: 10px;
}

.ai-chat-icon-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.ai-chat-icon-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.ai-chat-icon-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-color: #fafafa;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message.bot {
    background-color: white;
    color: var(--chat-text-color);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    border: 1px solid #eee;
}

.message.user {
    background: var(--chat-primary-gradient);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* Markdown Styles in Messages */
.message a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.message.bot a {
    color: var(--chat-accent-color);
}

.message strong {
    font-weight: 700;
}

.message ul {
    margin: 5px 0;
    padding-left: 20px;
}

/* Input Area */
.ai-chat-input-area {
    padding: 15px 20px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 12px;
    background-color: white;
}

.ai-chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #eef0f5;
    border-radius: 24px;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
    background-color: #f7f7f9;
}

.ai-chat-input-area input:focus {
    border-color: #b0c4de;
    background-color: white;
}

.ai-chat-send-btn {
    background: var(--chat-primary-gradient);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(118, 75, 162, 0.3);
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 15px rgba(118, 75, 162, 0.4);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 5px;
    padding: 15px 18px;
    background-color: white;
    border: 1px solid #eee;
    border-radius: 18px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    margin-left: 2px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #bbb;
    border-radius: 50%;
    animation: typing 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 typing {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .ai-chat-window {
        width: 100%;
        height: 100%;
        max-height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .ai-chat-fab {
        bottom: 20px;
        right: 20px;
    }
}