/* AI Chat Engine Widget Styles */

.aichat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.aichat-widget-bottom-right {
    bottom: 20px;
    right: 20px;
}

.aichat-widget-bottom-left {
    bottom: 20px;
    left: 20px;
}

.aichat-widget-toggle {
    width: 60px;
    height: 60px;
    background: var(--widget-color, #0073aa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
}

.aichat-widget-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.aichat-widget-container {
    position: absolute;
    bottom: 80px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

.aichat-widget-container.show {
    display: flex;
}

.aichat-widget-bottom-right .aichat-widget-container { right: 0; }
.aichat-widget-bottom-left .aichat-widget-container { left: 0; }

.aichat-widget-header {
    background: var(--widget-color, #0073aa);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aichat-widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aichat-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.aichat-widget-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.aichat-widget-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.aichat-message {
    max-width: 80%;
    word-wrap: break-word;
}

.aichat-message-user {
    align-self: flex-end;
}

.aichat-message-assistant {
    align-self: flex-start;
}

.aichat-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.aichat-message-user .aichat-message-content {
    background: var(--widget-color, #0073aa);
    color: white;
    border-bottom-right-radius: 4px;
}

.aichat-message-assistant .aichat-message-content {
    background: #f1f3f4;
    color: #333;
    border-bottom-left-radius: 4px;
}

.aichat-widget-input {
    padding: 16px 20px;
    border-top: 1px solid #e1e5e9;
    background: white;
}

.aichat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 12px;
    border: 1px solid #e1e5e9;
}

.aichat-input-container:focus-within {
    border-color: var(--widget-color, #0073aa);
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

#aichat-message-input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    resize: none;
    font-size: 14px;
    line-height: 1.4;
    max-height: 100px;
    min-height: 20px;
    padding: 4px 0;
    font-family: inherit;
}

#aichat-send-button {
    background: var(--widget-color, #0073aa);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#aichat-send-button:hover:not(:disabled) {
    background: #005a87;
    transform: scale(1.05);
}

#aichat-send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.aichat-widget-typing {
    padding: 0 20px 16px;
}

.aichat-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: #f1f3f4;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 80px;
}

.aichat-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.aichat-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.aichat-typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .aichat-widget-container {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
        left: auto;
        right: 20px;
    }
    
    .aichat-widget-bottom-left .aichat-widget-container {
        left: 20px;
        right: 20px;
    }
}

/* Scrollbar Styling */
.aichat-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.aichat-widget-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.aichat-widget-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.aichat-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
