/* ===================================================
   AI Store Assistant - Floating Chat Widget Styles
   =================================================== */

/* Floating Button */
.ai-chat-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 1050;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6e6e, #0a5555);
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(13, 110, 110, 0.4);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.ai-chat-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(13, 110, 110, 0.55);
}

.ai-chat-fab:active {
    transform: scale(0.95);
}

/* Pulse animation for attention */
.ai-chat-fab-pulse {
    animation: aiFabPulse 2s infinite;
}

@keyframes aiFabPulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(13, 110, 110, 0.4); }
    50%      { box-shadow: 0 4px 32px rgba(13, 110, 110, 0.65); }
}

/* Chat Window */
.ai-chat-window {
    position: fixed;
    bottom: 100px;
    left: 24px;
    z-index: 1050;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    max-height: calc(100vh - 140px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                opacity 0.25s ease;
}

.ai-chat-window.closing {
    transform: scale(0.9);
    opacity: 0;
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, #0d6e6e, #0a5555);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
}

.ai-chat-header-title i {
    font-size: 22px;
}

.ai-chat-header-actions {
    display: flex;
    gap: 6px;
}

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

.ai-chat-header-actions button:hover {
    background: rgba(255,255,255,0.35);
}

/* Chat Body */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Bubbles */
.ai-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
    white-space: pre-wrap;
    animation: aiMsgIn 0.3s ease;
}

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

.ai-chat-msg.user {
    align-self: flex-end;
    background: #0d6e6e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ai-chat-msg.assistant {
    align-self: flex-start;
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.ai-chat-msg.system {
    align-self: center;
    background: #f1f5f9;
    color: #64748b;
    font-size: 13px;
    max-width: 90%;
    text-align: center;
}

/* Typing indicator */
.ai-typing-indicator {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    padding: 10px 16px;
    display: flex;
    gap: 5px;
    align-items: center;
}

.ai-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    animation: aiTypingBounce 1.4s infinite ease-in-out both;
}

.ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.ai-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes aiTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40%           { transform: scale(1); opacity: 1; }
}

/* Suggested Questions (shown at start) */
.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}

.ai-suggestion-chip {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    color: #0d6e6e;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion-chip:hover {
    background: #0d6e6e;
    color: #fff;
    border-color: #0d6e6e;
}

/* Chat Footer / Input */
.ai-chat-footer {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
    flex-shrink: 0;
}

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

.ai-chat-input:focus {
    border-color: #0d6e6e;
    box-shadow: 0 0 0 3px rgba(13, 110, 110, 0.1);
}

.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0d6e6e, #0a5555);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s, opacity 0.2s;
}

.ai-chat-send-btn:hover {
    transform: scale(1.05);
}

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

/* Error state */
.ai-chat-error {
    align-self: center;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 12px;
    padding: 8px 14px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-chat-window {
        left: 0;
        right: 0;
        bottom: 0;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        height: 80vh;
        max-height: 80vh;
    }
    .ai-chat-fab {
        bottom: 16px;
        left: 16px;
        width: 52px;
        height: 52px;
        font-size: 24px;
    }
}

/* RTL support */
.ai-chat-msg.user {
    text-align: right;
}

.ai-chat-msg.assistant {
    text-align: right;
}
