/* public/css/mai-public.css - Full Updated Version */

/* Widget Container */
.mai-widget-container {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

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

.mai-widget-top-right {
    top: 20px;
    right: 20px;
}

.mai-widget-top-left {
    top: 20px;
    left: 20px;
}

/* Chat Button */
.mai-widget-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #0073aa;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.mai-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.mai-widget-button svg {
    width: 30px;
    height: 30px;
    fill: #fff;
}

/* Chat Window - FIXED HEIGHT */
.mai-widget-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    height: 550px;
    max-height: 70vh;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.mai-widget-window.open {
    display: flex;
}

/* Chat Header - Fixed */
.mai-widget-header {
    background: #0073aa;
    color: #fff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: 60px;
}

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

.mai-widget-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mai-widget-avatar svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}

.mai-widget-title {
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.mai-widget-status {
    font-size: 12px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2ecc71;
    animation: maiPulse 2s infinite;
}

.mai-widget-close {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    flex-shrink: 0;
}

.mai-widget-close:hover {
    transform: rotate(90deg);
}

/* Language Selector - Fixed */
.mai-language-selector {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.mai-language-btn {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s ease;
}

.mai-language-btn.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Chat Messages - Scrollable Area */
.mai-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    min-height: 0;
}

.mai-message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.mai-message-agent {
    align-items: flex-start;
}

.mai-message-user {
    align-items: flex-end;
}

.mai-message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.mai-message-agent .mai-message-bubble {
    background: #fff;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mai-message-user .mai-message-bubble {
    background: #0073aa;
    color: #fff;
    border-bottom-right-radius: 5px;
}

.mai-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    padding: 0 5px;
}

/* Feedback Buttons */
.mai-feedback-buttons {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    padding: 0 5px;
    align-items: center;
}

.mai-feedback-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.mai-feedback-btn:hover {
    background: #f0f0f1;
    transform: scale(1.1);
}

/* Typing Indicator */
.mai-typing-indicator {
    padding: 10px;
    color: #999;
    font-style: italic;
}

/* Chat Input - ALWAYS VISIBLE */
.mai-widget-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    min-height: 60px;
}

.mai-widget-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
    min-width: 0;
}

.mai-widget-input:focus {
    border-color: #0073aa;
}

.mai-widget-send {
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.mai-widget-send:hover {
    background: #005a87;
    transform: scale(1.1);
}

.mai-widget-send svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

/* RTL Support */
.mai-rtl {
    direction: rtl;
}

.mai-rtl .mai-message-agent {
    align-items: flex-end;
}

.mai-rtl .mai-message-user {
    align-items: flex-start;
}

/* Animations */
@keyframes maiPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(46, 204, 113, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .mai-widget-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        max-height: calc(100vh - 140px);
        bottom: 70px;
        right: -10px;
    }
}