/* AI Chat Widget Styles - Fashion Theme */
:root {
    --ai-chat-primary: #18181b;
    --ai-chat-accent: #fdf2f8;
    --ai-chat-user-bg: #18181b;
    --ai-chat-ai-bg: #ffffff;
    --ai-chat-text: #27272a;
    --ai-chat-text-light: #71717a;
    --ai-chat-border: #e4e4e7;
    --ai-chat-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1);
    --ai-chat-radius: 20px;
}

.ai-chat-container {
    position: fixed;
    bottom: 30px;
    right: 30px; /* Always on the right as requested */
    z-index: 9999;
}

/* Override RTL for this specific element if needed */
[dir="rtl"] .ai-chat-container {
    right: 30px;
    left: auto;
}

/* Launcher Button */
.ai-chat-launcher {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: #000;
    border: 3px solid #fff; /* Added white border for better contrast */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    padding: 0;
}

.ai-chat-launcher-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    transform: scale(1.1); /* Zoom in slightly for better focus */
}

.ai-chat-launcher:hover {
    transform: scale(1.08) translateY(-10px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* Chat Panel */
.ai-chat-panel {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 420px;
    max-width: calc(100vw - 40px);
    height: 650px;
    max-height: calc(100vh - 160px);
    background: #ffffff;
    border-radius: 28px;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: slideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 10000;
}

/* Force Right Position */
[dir="rtl"] .ai-chat-panel {
    right: 30px;
    left: auto;
}

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

/* Header Enhancement */
.ai-chat-header {
    background: #ffffff;
    color: #000;
    padding: 24px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
}

.ai-chat-header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-chat-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #f8f9fa;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f0f0f0;
}

.ai-chat-avatar-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-chat-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    color: #000;
    letter-spacing: -0.5px;
}

.ai-chat-status {
    font-size: 13px;
    color: #10b981;
    font-weight: 600;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-chat-status::before {
    content: "";
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

.ai-chat-close-btn {
    background: #f8f9fa;
    border: none;
    color: #000;
    cursor: pointer;
    padding: 10px;
    border-radius: 14px;
    transition: all 0.2s;
}

.ai-chat-close-btn:hover {
    background: #000;
    color: #fff;
}

/* Messages Container Enhancement */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: #ffffff;
}

/* Message Styles Enhancement */
.ai-chat-message {
    display: flex;
    gap: 14px;
    max-width: 88%;
}

.ai-chat-message-text {
    padding: 16px 20px;
    font-size: 15px;
    line-height: 1.6;
    border-radius: 22px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.ai-message .ai-chat-message-text {
    background: #f8f9fa;
    border: 1px solid #f0f0f0;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

.user-message .ai-chat-message-text {
    background: #000000;
    color: #ffffff;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

/* Copy Button Styling */
.ai-chat-message-text {
    position: relative;
}

.ai-chat-copy-btn {
    position: absolute;
    top: 8px;
    background: white;
    border: 1px solid #f0f0f0;
    padding: 6px;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    z-index: 10;
}

[dir="ltr"] .ai-chat-copy-btn { right: 8px; }
[dir="rtl"] .ai-chat-copy-btn { left: 8px; }

.ai-chat-message-text:hover .ai-chat-copy-btn {
    opacity: 1;
}

.ai-chat-copy-btn:hover {
    transform: scale(1.1);
    background: #000;
    color: #fff;
    border-color: #000;
}

.user-message .ai-chat-copy-btn {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.1);
    color: #fff;
}

.user-message .ai-chat-copy-btn:hover {
    background: #fff;
    color: #000;
}

/* Input Area Enhancement */
.ai-chat-input-container {
    padding: 24px 28px;
    background: #ffffff;
    border-top: 1px solid #f0f0f0;
}

.ai-chat-form {
    display: flex;
    gap: 14px;
    background: #f8f9fa;
    padding: 8px 8px 8px 20px;
    border-radius: 30px;
    border: 1px solid #f0f0f0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-form:focus-within {
    background: #ffffff;
    border-color: #000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.ai-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 15px;
    outline: none;
    color: #000;
}

.ai-chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #000;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

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

/* RTL Support for Chat Bubbles */
[dir="rtl"] .ai-message .ai-chat-message-text {
    border-bottom-left-radius: 22px;
    border-bottom-right-radius: 4px;
}

[dir="rtl"] .user-message .ai-chat-message-text {
    border-bottom-right-radius: 22px;
    border-bottom-left-radius: 4px;
}

/* Product Recommendations */
.ai-product-recommendations {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-product-card {
    display: flex;
    background: white;
    border: 1px solid var(--ai-chat-border);
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s;
}

.ai-product-card:hover {
    transform: translateY(-2px);
    border-color: #000;
}

.ai-product-image {
    width: 100px;
    height: 120px;
    object-fit: cover;
}

.ai-product-info {
    padding: 12px;
    flex: 1;
}

.ai-product-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 5px;
}

.ai-product-price {
    font-size: 14px;
    font-weight: 700;
}

/* Typing Indicator */
.ai-chat-typing {
    padding: 0 24px 20px;
    display: flex;
    gap: 4px;
}

.ai-chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #000;
    opacity: 0.3;
    animation: typing 1s infinite alternate;
}

@keyframes typing {
    from { opacity: 0.3; transform: scale(1); }
    to { opacity: 1; transform: scale(1.2); }
}

/* Input Area */
.ai-chat-input-container {
    padding: 20px 24px;
    background: white;
    border-top: 1px solid var(--ai-chat-border);
}

.ai-chat-form {
    display: flex;
    gap: 10px;
    background: #f4f4f5;
    padding: 5px 5px 5px 15px;
    border-radius: 25px;
}

.ai-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px 0;
    font-size: 14px;
    outline: none;
}

.ai-chat-send-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #000;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Mobile */
@media (max-width: 480px) {
    .ai-chat-panel {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
    }
}
