/* ==========================================
   Zunjar AI Chat Widget
   Embedded AI assistant - no tab switching
   ========================================== */

/* === Floating AI Button === */
.ai-chat-widget {
    position: fixed;
    bottom: 150px;
    right: 24px;
    z-index: 9998;
}

.ai-chat-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    animation: pulse-ai 3s infinite;
}

.ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.ai-chat-button i {
    font-size: 26px;
}

@keyframes pulse-ai {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(102, 126, 234, 0.6), 0 0 30px rgba(118, 75, 162, 0.3);
    }
}

/* AI Label Tooltip */
.ai-chat-button::before {
    content: 'Chat with AI';
    position: absolute;
    right: 70px;
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.ai-chat-button::after {
    content: '';
    position: absolute;
    right: 62px;
    border: 8px solid transparent;
    border-left-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ai-chat-button:hover::before,
.ai-chat-button:hover::after {
    opacity: 1;
    visibility: visible;
}

/* === Chat Window === */
.ai-chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 150px);
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-widget.open .ai-chat-window {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* === Chat Header === */
.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ai-chat-header .avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ai-chat-header .info {
    flex: 1;
}

.ai-chat-header .info h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.ai-chat-header .info .status {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-header .info .status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.ai-chat-header .close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.ai-chat-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* === Quick Actions === */
.ai-quick-actions {
    padding: 12px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-quick-actions button {
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-quick-actions button:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* === Messages Area === */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}

/* Custom Scrollbar */
.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* === Message Bubbles === */
.ai-message {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.ai-message.bot {
    align-self: flex-start;
}

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

.ai-message.user .bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.ai-message.bot .bubble {
    background: #fff;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 6px;
}

.ai-message .time {
    font-size: 10px;
    color: #9ca3af;
    margin-left: 4px;
}

.ai-message.user .time {
    text-align: right;
    margin-right: 4px;
}

/* Typing Indicator */
.ai-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    width: fit-content;
}

.ai-typing span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* === Input Area === */
.ai-chat-input {
    padding: 14px;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ai-chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 22px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s ease;
}

.ai-chat-input textarea:focus {
    border-color: #667eea;
}

.ai-chat-input textarea::placeholder {
    color: #9ca3af;
}

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

.ai-chat-input .send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-chat-input .send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* === Welcome Message === */
.ai-welcome {
    text-align: center;
    padding: 20px;
}

.ai-welcome .icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.ai-welcome h3 {
    font-size: 18px;
    color: #374151;
    margin: 0 0 8px 0;
}

.ai-welcome p {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* === Service Suggestions (for AI response) === */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ai-suggestion-btn {
    padding: 8px 14px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-suggestion-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

/* === Mobile Responsive === */
@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 80px;
        right: 15px;
    }
    
    .ai-chat-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 180px);
        max-height: unset;
        bottom: 65px;
        right: -8px;
        border-radius: 16px;
    }
    
    .ai-chat-button {
        width: 52px;
        height: 52px;
    }
    
    .ai-chat-button i {
        font-size: 22px;
    }
}

/* === Dark Mode Support (optional) === */
@media (prefers-color-scheme: dark) {
    .ai-chat-window {
        background: #1f2937;
    }
    
    .ai-chat-header {
        background: linear-gradient(135deg, #4c51bf 0%, #553c9a 100%);
    }
    
    .ai-chat-messages {
        background: #111827;
    }
    
    .ai-message.bot .bubble {
        background: #374151;
        color: #f3f4f6;
        border-color: #4b5563;
    }
    
    .ai-chat-input {
        background: #1f2937;
        border-top-color: #374151;
    }
    
    .ai-chat-input textarea {
        background: #374151;
        border-color: #4b5563;
        color: #f3f4f6;
    }
}