/* Floating Chat Button */
.ai-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-chat-btn:hover {
    transform: scale(1.1);
}

/* Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transform-origin: bottom right;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-chat-window.hidden {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

/* Chat Header */
.chat-header {
    background: var(--bg-gradient);
    padding: 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    opacity: 0.8;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f9fafb;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95em;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.ai {
    align-self: flex-start;
    background: white;
    color: #374151;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    align-self: center;
    font-size: 0.8em;
}

/* Typing Indicator */
.typing-indicator {
    align-self: flex-start;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    display: none;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.dot {
    width: 6px;
    height: 6px;
    background: #ccc;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Chat Input */
.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input:focus {
    border-color: var(--primary-color);
}

.send-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

@media (max-width: 480px) {
    .ai-chat-window {
        width: 100%;
        height: 100%;
        /* Full screen on mobile */
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}