/**
 * Frontend Chat Widget Styles
 */

/* Chat Widget Container */
#aimc-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#aimc-chat-widget.aimc-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#aimc-chat-widget.aimc-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Button */
.aimc-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aimc-primary-color, #00bcd4) 0%, #0097a7 100%);
    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;
}

.aimc-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.aimc-chat-button svg {
    width: 28px;
    height: 28px;
    color: white;
}

.aimc-icon-close {
    display: none;
}

.aimc-chat-button.active .aimc-icon-chat {
    display: none;
}

.aimc-chat-button.active .aimc-icon-close {
    display: block;
}

.aimc-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Chat Window */
.aimc-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.aimc-position-bottom-left .aimc-chat-window {
    left: 0;
    right: auto;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.aimc-chat-header {
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.aimc-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.aimc-header-avatar svg {
    width: 24px;
    height: 24px;
}

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

.aimc-status-online {
    font-size: 12px;
    opacity: 0.9;
}

.aimc-close-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.aimc-close-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.aimc-close-button svg {
    width: 20px;
    height: 20px;
}

/* Messages Container */
.aimc-messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
}

.aimc-messages-container::-webkit-scrollbar {
    width: 6px;
}

.aimc-messages-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Message */
.aimc-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aimc-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--aimc-primary-color, #00bcd4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aimc-message-avatar svg {
    width: 20px;
    height: 20px;
    color: white;
}

.aimc-message-content {
    flex: 1;
}

.aimc-message-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
    line-height: 1.5;
}

.aimc-message-user {
    flex-direction: row-reverse;
}

.aimc-message-user .aimc-message-avatar {
    background: #e0e0e0;
}

.aimc-message-user .aimc-message-avatar svg {
    color: #666;
}

.aimc-message-user .aimc-message-bubble {
    background: var(--aimc-primary-color, #00bcd4);
    color: white;
}

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

/* Typing Indicator */
.aimc-typing-indicator {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    padding: 0 20px;
}

.aimc-typing-dots {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    gap: 4px;
}

.aimc-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

.aimc-typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.aimc-typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Input Container */
.aimc-input-container {
    border-top: 1px solid #e0e0e0;
    background: white;
    padding: 16px;
}

/* Image Preview */
.aimc-image-preview-container {
    padding: 12px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 12px;
}

.aimc-image-preview-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

#aimc-image-preview {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    display: block;
}

.aimc-remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f44336;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.aimc-remove-image:hover {
    transform: scale(1.1);
}

.aimc-remove-image svg {
    width: 16px;
    height: 16px;
}

#aimc-chat-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

/* Input Actions */
.aimc-input-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aimc-action-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #e0e0e0;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.aimc-action-button:hover {
    background: #f5f5f5;
    border-color: var(--aimc-primary-color, #00bcd4);
}

.aimc-action-button svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.aimc-action-button:hover svg {
    color: var(--aimc-primary-color, #00bcd4);
}

/* Voice Button States */
#aimc-voice-button.recording {
    background: #f44336;
    border-color: #f44336;
    animation: pulse 1.5s infinite;
}

#aimc-voice-button.recording svg {
    color: white;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(244, 67, 54, 0);
    }
}

#aimc-message-input {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    font-family: inherit;
}

#aimc-message-input:focus {
    outline: none;
    border-color: var(--aimc-primary-color, #00bcd4);
}

.aimc-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.aimc-send-button:hover {
    transform: scale(1.1);
}

.aimc-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.aimc-send-button svg {
    width: 20px;
    height: 20px;
}

/* Message with Image */
.aimc-message-image {
    margin-top: 8px;
    border-radius: 8px;
    overflow: hidden;
}

.aimc-message-image img {
    max-width: 100%;
    max-height: 200px;
    display: block;
    cursor: pointer;
    transition: transform 0.2s;
}

.aimc-message-image img:hover {
    transform: scale(1.02);
}

.aimc-powered-by {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 8px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .aimc-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }
}

