/* Premium Glassmorphism Chat Widget */
.ai-chat-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    font-family: 'Inter', 'Prompt', sans-serif;
}

.ai-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 10px 25px rgba(118, 75, 162, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.ai-chat-button:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 15px 35px rgba(118, 75, 162, 0.6);
}

.ai-chat-button i, .ai-chat-button svg {
    color: white;
    font-size: 28px;
    width: 32px;
    height: 32px;
    fill: white;
}

.ai-chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.5) inset;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.95) translateY(20px);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: bottom right;
}

.ai-chat-window.active {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: all;
}

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

.ai-chat-title {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-close {
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.ai-chat-close:hover { opacity: 1; }

.ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
}

/* Scrollbar */
.ai-chat-messages::-webkit-scrollbar { width: 6px; }
.ai-chat-messages::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 10px; }

.ai-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
    word-wrap: break-word;
}

.ai-message.user {
    align-self: flex-end;
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.ai-message.ai {
    align-self: flex-start;
    background: white;
    color: #1f2937;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.ai-message img {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 5px;
}

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

.ai-chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-image-upload {
    cursor: pointer;
    color: #6b7280;
    transition: color 0.2s;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}
.ai-chat-image-upload:hover { background: #f3f4f6; color: #667eea; }

.ai-chat-input-container input[type="file"] { display: none; }

.ai-chat-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    border-radius: 20px;
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.ai-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.ai-chat-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}
.ai-chat-send:active { transform: scale(0.95); }

.ai-image-preview {
    display: none;
    padding: 10px 15px;
    background: #f3f4f6;
    border-top: 1px solid #e5e7eb;
    position: relative;
    border-radius: 0 0 24px 24px;
}
.ai-image-preview img {
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.ai-image-preview-close {
    position: absolute;
    top: 5px;
    left: 70px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
}
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

@media (max-width: 480px) {
    .ai-chat-window {
        width: calc(100vw - 40px);
        bottom: 80px;
        right: 20px;
    }
}
