/* AI Chat Widget Styles */

#aichat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#aichat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--aichat-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

#aichat-button:hover {
    transform: scale(1.05);
}

#aichat-button svg {
    width: 30px;
    height: 30px;
}

#aichat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background-color: var(--aichat-bg);
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* State Classes */
.aichat-closed #aichat-window {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.aichat-open #aichat-button {
    display: none;
    /* Hide button when open */
}

.aichat-open #aichat-window {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* Header */
#aichat-header {
    background-color: var(--aichat-primary);
    color: #fff;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.aichat-title {
    font-weight: 600;
    font-size: 16px;
}

#aichat-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Messages Area */
#aichat-messages {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aichat-message {
    display: flex;
    max-width: 85%;
}

.bot-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.aichat-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bot-message .aichat-bubble {
    background-color: #f1f1f1;
    color: var(--aichat-text);
    border-bottom-left-radius: 4px;
}

.user-message .aichat-bubble {
    background-color: var(--aichat-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Input Area */
#aichat-input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    background: #fff;
}

#aichat-input {
    flex-grow: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 14px;
    outline: none;
    color: var(--aichat-text);
}

#aichat-input:focus {
    border-color: var(--aichat-primary);
}

#aichat-send-btn {
    background: var(--aichat-primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#aichat-send-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: #ffffff;
}

/* Typing Indicator Animation */
.typing-indicator .aichat-bubble {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #aichat-window {
        position: fixed;
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        /* Modern browser dynamic viewport height */
        max-height: none;
        border-radius: 0;
        /* Full screen look */
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
        transform-origin: bottom center;
    }

    /* Fixed header to top of widget container */
    #aichat-header {
        border-radius: 0;
        border-top-left-radius: 12px;
        border-top-right-radius: 12px;
        flex-shrink: 0;
    }

    #aichat-input-area {
        flex-shrink: 0;
    }
}