/* AI Chat Widget Styles */
.ai-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    font-family: Arial, sans-serif;
}

.ai-chat-widget.minimized {
    display: none;
}

.ai-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 1000;
    display: none; /* Initially hidden, since widget is not minimized by default */
    justify-content: center;
    align-items: center;
    font-size: 30px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.ai-fab:hover {
    transform: scale(1.1);
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.chat-header h3 {
    margin: 0;
    font-size: 16px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-selector {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    outline: none;
}

.lang-selector option {
    background: #667eea;
    color: white;
}

.chat-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f9f9f9;
    display: none;
}

.ai-chat-widget:not(.minimized) .chat-messages {
    display: block;
}

.message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.user {
    background: #007bff;
    color: white;
    margin-left: auto;
    text-align: right;
}

.message.ai {
    background: #e9ecef;
    color: #333;
    margin-right: auto;
}

.chat-input-container {
    padding: 10px;
    border-top: 1px solid #eee;
    display: none;
    flex-direction: column;
    background: white;
    border-radius: 0 0 10px 10px;
}

.ai-chat-widget:not(.minimized) .chat-input-container {
    display: flex;
}

.input-row {
    display: flex;
    width: 100%;
    margin-bottom: 8px;
    align-items: flex-end;
}

.action-row {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    gap: 12px;
}

.chat-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    width: 100%;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    overflow-y: auto;
    font-family: Arial, sans-serif;
    line-height: 1.4;
    box-sizing: border-box;
}

.action-btn {
    background: #007bff;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.action-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.action-btn:active {
    transform: scale(0.95);
}

.chat-send {
    width: auto;
    padding: 0 20px;
    border-radius: 20px;
    font-weight: bold;
}

/* Image preview container */
#imagePreviewContainer {
    position: relative;
    margin-bottom: 10px;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#imagePreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#removeImageBtn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    padding: 0;
}

#removeImageBtn:hover {
    background: rgba(255,0,0,0.8);
}

/* Modal styles for chat images */
.chat-image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    justify-content: center;
    align-items: center;
}

.chat-image-modal.show {
    display: flex;
}

.chat-image-modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.chat-image-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    text-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.chat-image-modal-close:hover {
    color: #ccc;
}

.message img {
    cursor: pointer;
    transition: opacity 0.3s;
}

.message img:hover {
    opacity: 0.9;
}

.chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.typing-indicator {
    display: none;
    color: #666;
    font-style: italic;
    padding: 10px;
}

.typing-indicator.show {
    display: block;
}

/* Responsive design */
@media (max-width: 768px) {
    .ai-chat-widget {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 10px;
        height: 400px;
    }

    .ai-fab {
        bottom: 10px;
        right: 10px;
    }
}
