/* AI Chat Widget */
:root {
    --ai-chat-primary: #2c3e50;
    --ai-chat-secondary: #3498db;
    --ai-chat-bg: #ffffff;
    --ai-chat-text: #333333;
    --ai-chat-light-bg: #f5f7fa;
    --ai-chat-border: #e1e8ed;
}

/* Chat Launcher Button */
/* Chat Launcher Button */
.ai-chat-launcher {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 60px;
    height: 60px;
    background-color: var(--ai-chat-secondary);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: ai-pulse 2s infinite;
}

.ai-chat-launcher:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    animation: none;
    /* Stop pulsing on hover */
}

@keyframes ai-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(52, 152, 219, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

.ai-chat-launcher i {
    color: white;
    font-size: 24px;
}

.ai-chat-launcher .notification-dot {
    position: absolute;
    top: 0;
    right: 0;
    width: 14px;
    height: 14px;
    background-color: #e74c3c;
    border-radius: 50%;
    border: 2px solid white;
}

/* Callout (Speech Bubble) */
.ai-chat-callout {
    position: fixed;
    bottom: 3.5rem;
    /* Adjust based on launcher position */
    right: 5rem;
    /* Left of the launcher */
    background-color: white;
    color: var(--ai-chat-text);
    padding: 10px 15px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    z-index: 9998;
    opacity: 0;
    /* Start hidden, animate in */
    animation: slide-in-bottom 0.5s 1s forwards;
    /* Delay appearing */
    cursor: pointer;
}

.ai-chat-callout::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    border-width: 8px 0 8px 8px;
    border-style: solid;
    border-color: transparent transparent transparent white;
}

@keyframes slide-in-bottom {
    from {
        opacity: 0;
        transform: translateY(10px) translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

/* Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 6rem;
    right: 2rem;
    width: 350px;
    height: 500px;
    background-color: var(--ai-chat-bg);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.ai-chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Chat Header */
.ai-chat-header {
    background-color: var(--ai-chat-primary);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-header-info i {
    font-size: 1.2rem;
}

.ai-chat-title {
    font-weight: bold;
    font-size: 1rem;
    margin: 0;
}

.ai-chat-subtitle {
    font-size: 0.8rem;
    margin: 0;
    opacity: 0.8;
}

.ai-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
}

/* Chat Messages Area */
.ai-chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background-color: var(--ai-chat-light-bg);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.ai-message.bot {
    align-self: flex-start;
    background-color: white;
    border: 1px solid var(--ai-chat-border);
    border-top-left-radius: 2px;
    color: var(--ai-chat-text);
}

.ai-message.user {
    align-self: flex-end;
    background-color: var(--ai-chat-secondary);
    color: white;
    border-top-right-radius: 2px;
}

.ai-message-time {
    display: block;
    font-size: 0.7rem;
    margin-top: 5px;
    opacity: 0.7;
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    background-color: white;
    padding: 10px 14px;
    border-radius: 14px;
    border: 1px solid var(--ai-chat-border);
    margin-bottom: 10px;
}

.typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #aaa;
    border-radius: 50%;
    margin: 0 2px;
    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);
    }
}

/* Input Area */
.ai-chat-input-area {
    padding: 1rem;
    background-color: white;
    border-top: 1px solid var(--ai-chat-border);
    display: flex;
    gap: 10px;
}

.ai-chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--ai-chat-border);
    border-radius: 20px;
    outline: none;
    resize: none;
    height: 40px;
    /* Initial height */
    max-height: 100px;
    font-family: inherit;
    font-size: 0.9rem;
}

.ai-chat-input:focus {
    border-color: var(--ai-chat-secondary);
}

.ai-chat-send {
    background-color: var(--ai-chat-secondary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s;
}

.ai-chat-send:hover {
    background-color: #2980b9;
}

.ai-chat-send:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .ai-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .ai-chat-header {
        border-radius: 0;
    }
}