/* AI Chat Widget Styles - Isolated from theme styles */

.ai-chat-widget {
    position: fixed !important;
    z-index: 999999 !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    /* Reset any inherited styles */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    color: inherit !important;
    text-align: left !important;
    direction: ltr !important;
}

/* Ensure all child elements use border-box */
.ai-chat-widget *,
.ai-chat-widget *::before,
.ai-chat-widget *::after {
    box-sizing: border-box !important;
}

/* Position variants */
.ai-chat-widget.bottom-right {
    bottom: 20px;
    right: 20px;
    left: auto;
}

.ai-chat-widget.bottom-left {
    bottom: 20px;
    left: 20px;
    right: auto;
}

/* Chat window positioning */
.ai-chat-widget.bottom-right .ai-chat-window {
    right: 0;
    left: auto;
}

.ai-chat-widget.bottom-left .ai-chat-window {
    left: 0;
    right: auto;
}

/* Chat Button */
.ai-chat-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    color: white;
}

.ai-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

.ai-chat-button:active {
    transform: translateY(0);
}

.ai-chat-button svg {
    transition: transform 0.3s ease;
}

.ai-chat-button:hover svg {
    transform: scale(1.1);
}

/* Notification Badge */
.ai-chat-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid white;
}

.ai-chat-notification.show {
    display: flex;
    animation: bounce 0.6s ease;
}

/* Chat Window */
.ai-chat-window {
    position: absolute;
    bottom: 80px;
    width: 400px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chat-widget.bottom-left .ai-chat-window {
    left: 0;
    right: auto;
}

.ai-chat-window.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

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

.ai-chat-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    color: #fff;
}

.ai-chat-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.ai-chat-controls {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-shrink: 0 !important;
}

.ai-chat-control-btn {
    width: 28px !important;
    height: 28px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    border-radius: 6px !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background-color 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
    font-size: 14px !important;
    line-height: 1 !important;
    position: relative !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.ai-chat-control-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    text-decoration: none !important;
}

.ai-chat-control-btn:focus {
    background: rgba(255, 255, 255, 0.3) !important;
    outline: none !important;
    box-shadow: none !important;
}

.ai-chat-control-btn:active {
    background: rgba(255, 255, 255, 0.4) !important;
    transform: scale(0.95) !important;
}

.ai-chat-control-btn svg {
    width: 16px !important;
    height: 16px !important;
    fill: #ffffff !important;
    display: block !important;
    flex-shrink: 0 !important;
    pointer-events: none !important;
}

/* Ensure icons are visible */
.ai-chat-control-btn .dashicons,
.ai-chat-control-btn .dashicons-before:before {
    color: white !important;
    font-size: 16px !important;
    width: 16px !important;
    height: 16px !important;
    line-height: 16px !important;
}

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

.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

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

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

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

/* Message */
.ai-chat-message {
    display: flex;
    max-width: 90%;
    gap: 10px;
    align-items: flex-end;
    animation: messageSlideIn 0.3s ease;
}

.ai-chat-message-bubble-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Default Message Layout (LTR) - For Non-RTL Languages */
/* User Message (Left) */
.ai-chat-message.user-message {
    margin-right: auto;
    margin-left: 0;
    flex-direction: row;
}
.ai-chat-message.user-message .ai-chat-message-bubble-wrapper {
    align-items: flex-start;
}

/* AI Message (Right) */
.ai-chat-message.ai-message {
    margin-left: auto;
    margin-right: 0;
    flex-direction: row-reverse;
}
.ai-chat-message.ai-message .ai-chat-message-bubble-wrapper {
    align-items: flex-end;
}

.ai-chat-message-avatar {
    display: none !important;
}

.ai-message .ai-chat-message-avatar {
    background: #e9ecef;
    color: #6c757d;
}

.user-message .ai-chat-message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-chat-message-content {
    padding: 10px 15px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    /* Default text alignment */
    text-align: left;
    direction: ltr;
}

/* Bold text between ** markers - Display on separate line */
.ai-chat-message-content strong,
.ai-chat-message-content b {
    display: block !important;
    font-weight: 700 !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    color: inherit !important;
}

/* First bold element - no top margin */
.ai-chat-message-content strong:first-child,
.ai-chat-message-content b:first-child {
    margin-top: 0 !important;
}

/* Last bold element - no bottom margin */
.ai-chat-message-content strong:last-child,
.ai-chat-message-content b:last-child {
    margin-bottom: 0 !important;
}

/* Link styling in messages */
.ai-chat-message-content a {
    color: #007cba !important;
    text-decoration: underline !important;
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    display: inline !important;
    max-width: 100% !important;
    line-height: 1.4 !important;
    hyphens: auto !important;
    -webkit-hyphens: auto !important;
    -ms-hyphens: auto !important;
}

.ai-chat-message-content a:hover {
    color: #005a87 !important;
    text-decoration: underline !important;
}

/* Special styling for truncated links */
.ai-chat-message-content a.truncated-link {
    position: relative !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 200px !important;
    display: inline-block !important;
}

.ai-chat-message-content a.truncated-link:hover {
    max-width: none !important;
    white-space: normal !important;
    word-break: break-all !important;
    overflow: visible !important;
    text-overflow: unset !important;
    background: rgba(0, 124, 186, 0.1) !important;
    padding: 2px 4px !important;
    border-radius: 4px !important;
    z-index: 10 !important;
}

/* Phone number links */
.ai-chat-message-content a[href^="tel:"] {
    color: #28a745 !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    background: rgba(40, 167, 69, 0.1) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(40, 167, 69, 0.2) !important;
}

.ai-chat-message-content a[href^="tel:"]:hover {
    color: #1e7e34 !important;
    background: rgba(40, 167, 69, 0.2) !important;
    border-color: rgba(40, 167, 69, 0.4) !important;
}

.user-message .ai-chat-message-content {
    background: #f1f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.ai-message .ai-chat-message-content {
    background: #f1f0f0;
    color: #333;
    border-bottom-right-radius: 4px;
}

.ai-chat-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 5px;
    padding: 0 8px;
}

/* Typing Indicator */
.ai-chat-typing {
    display: none; /* Hidden by default, shown by JS */
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    max-width: 85%;
    margin-right: auto;
    margin-left: 0;
    animation: messageSlideIn 0.3s ease;
    position: relative;
    z-index: 1;
}

.ai-chat-typing.show {
    display: flex !important;
    animation: messageSlideIn 0.3s ease;
}

.ai-chat-typing-avatar {
    display: none !important;
}

.ai-chat-typing-dots {
    background: #f1f0f0;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 4px;
    align-items: center;
    border: none;
}

.ai-chat-typing-dots span {
    width: 6px;
    height: 6px;
    background: #6c757d;
    border-radius: 50%;
    animation: typingDots 1.4s infinite ease-in-out;
}

.ai-chat-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

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

/* New AI Typing Indicator - For Non-RTL Languages (AI on Right) */
.chat-ai-typing-indicator {
    display: none;
    max-width: 85%;
    margin-left: auto;
    margin-right: 0;
    margin-bottom: 16px;
    animation: fadeInUp 0.3s ease;
}

.chat-ai-typing-indicator.active {
    display: block !important;
}

.typing-bubble {
    background: #f1f0f0;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    display: inline-block;
    position: relative;
}

.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-dots .dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

.typing-dots .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dots .dot:nth-child(2) {
    animation-delay: -0.16s;
}

.typing-dots .dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes typingAnimation {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

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

/* Dark mode support for new typing indicator */
@media (prefers-color-scheme: dark) {
    .typing-bubble {
        background: #3a3a3a !important;
        border: 1px solid #555 !important;
    }
    
    .typing-dots .dot {
        background: #ffffff !important;
    }
}

.ai-chat-widget.dark-mode .typing-bubble,
.dark-mode .ai-chat-widget .typing-bubble,
body.dark-mode .ai-chat-widget .typing-bubble,
html.dark-mode .ai-chat-widget .typing-bubble {
    background: #3a3a3a !important;
    border: 1px solid #555 !important;
}

.ai-chat-widget.dark-mode .typing-dots .dot,
.dark-mode .ai-chat-widget .typing-dots .dot,
body.dark-mode .ai-chat-widget .typing-dots .dot,
html.dark-mode .ai-chat-widget .typing-dots .dot {
    background: #ffffff !important;
}

/* RTL support for new typing indicator */
.rtl .chat-ai-typing-indicator {
    margin-right: 0;
    margin-left: auto;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .typing-dots .dot {
        animation: none;
        opacity: 0.7;
    }
    
    .chat-ai-typing-indicator {
        animation: none;
    }
}

/* Input Container */
.ai-chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.ai-chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 8px 8px 16px;
    border: 1px solid #e9ecef;
    transition: border-color 0.2s ease;
    /* Default LTR: Input left, Button right */
    flex-direction: row;
    position: relative;
}

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

.ai-chat-input {
    flex: 1 !important;
    border: none !important;
    background: transparent !important;
    resize: none !important;
    outline: none !important;
    font-family: inherit !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    max-height: 100px !important;
    min-height: 20px !important;
    height: 20px !important;
    padding: 6px 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    color: #333 !important;
    /* Override any theme styles */
    width: auto !important;
    display: block !important;
    vertical-align: baseline !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-indent: 0 !important;
    text-shadow: none !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    transition: none !important;
    overflow-y: hidden !important;
}

/* When textarea is scrollable, fix height and show scrollbar */
.ai-chat-input.scrollable {
    height: 42px !important; /* 2 lines height */
    max-height: 42px !important;
    overflow-y: auto !important;
}

/* Textarea scroll buttons */
.ai-chat-scroll-buttons {
    position: absolute;
    right: 50px; /* Position between input and send button */
    top: 50%;
    transform: translateY(-50%);
    display: none; /* Hidden by default */
    flex-direction: column;
    gap: 2px;
    z-index: 10;
}

.ai-chat-scroll-buttons.show {
    display: flex !important;
}

.ai-chat-scroll-btn {
    width: 20px !important;
    height: 16px !important;
    background: rgba(102, 126, 234, 0.1) !important;
    border: 1px solid rgba(102, 126, 234, 0.3) !important;
    border-radius: 4px !important;
    color: #667eea !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    text-decoration: none !important;
    font-size: 10px !important;
    line-height: 1 !important;
    position: relative !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
}

.ai-chat-scroll-btn:hover {
    background: rgba(102, 126, 234, 0.2) !important;
    border-color: rgba(102, 126, 234, 0.5) !important;
    color: #667eea !important;
    text-decoration: none !important;
}

.ai-chat-scroll-btn:active {
    background: rgba(102, 126, 234, 0.3) !important;
    transform: scale(0.95) !important;
}

.ai-chat-scroll-btn svg {
    width: 12px !important;
    height: 12px !important;
    fill: currentColor !important;
    display: block !important;
    flex-shrink: 0 !important;
    pointer-events: none !important;
}

.ai-chat-input::placeholder {
    color: #6c757d !important;
    opacity: 1 !important;
    font-style: normal !important;
    font-weight: normal !important;
}

.ai-chat-input:focus {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    color: #333 !important;
}

.ai-chat-input:disabled {
    background: #f5f5f5 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.ai-chat-input:disabled::placeholder {
    color: #999 !important;
    opacity: 1 !important;
}

/* Remove text selection highlight when disabled */
.ai-chat-input:disabled::selection {
    background: transparent !important;
    color: inherit !important;
}

.ai-chat-input:disabled::-moz-selection {
    background: transparent !important;
    color: inherit !important;
}

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

.ai-chat-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.ai-chat-send-btn:disabled {
    background: #e9ecef;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Ensure send button SVG is always visible and sized correctly */
.ai-chat-widget .ai-chat-send-btn svg {
    width: 20px !important;
    height: 20px !important;
    fill: currentColor !important;
    display: block !important;
    flex-shrink: 0 !important;
    pointer-events: none !important;
}

/* Flip send button icon for RTL languages */
.ai-chat-widget.rtl .ai-chat-send-btn svg {
    transform: scaleX(-1);
}

/* Animations */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

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

@keyframes typingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsive - Full Screen */
@media (max-width: 768px) {
    .ai-chat-widget {
        bottom: 10px;
    }
    
    .ai-chat-widget.bottom-right {
        right: 10px;
        left: auto;
    }
    
    .ai-chat-widget.bottom-left {
        left: 10px;
        right: auto;
    }
    
    .ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        min-width: auto;
        border-radius: 0;
        transform: none;
        margin: 0;
    }
    
    .ai-chat-widget.bottom-right .ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
    }
    
    .ai-chat-widget.bottom-left .ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
    }
    
    .ai-chat-window.show {
        transform: none;
        opacity: 1;
    }
    
    .ai-chat-button {
        width: 56px;
        height: 56px;
    }
    
    /* Mobile responsive links */
    .ai-chat-message-content a.truncated-link {
        max-width: 150px !important;
    }
    
    .ai-chat-message-content {
        word-break: break-word !important;
        overflow-wrap: anywhere !important;
    }
}

@media (max-width: 480px) {
    .ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        transform: none;
    }
    
    .ai-chat-widget.bottom-right .ai-chat-window,
    .ai-chat-widget.bottom-left .ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
    }
    
    .ai-chat-window.show {
        transform: none;
        opacity: 1;
    }
    
    .ai-chat-messages {
        padding: 16px;
    }
    
    .ai-chat-input-container {
        padding: 12px 16px;
    }
    
    /* Smaller mobile responsive links */
    .ai-chat-message-content a.truncated-link {
        max-width: 120px !important;
    }
    
    .ai-chat-message-content a {
        font-size: 13px !important;
        line-height: 1.3 !important;
    }
}

@media (max-width: 360px) {
    .ai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }
    
    .ai-chat-messages {
        padding: 12px;
    }
    
    .ai-chat-input-container {
        padding: 10px 12px;
    }
    
    .ai-chat-header {
        padding: 12px 16px;
    }
    
    .ai-chat-title {
        font-size: 14px;
    }
    
    .ai-chat-button {
        width: 52px;
        height: 52px;
    }
}

/* LTR Support (Default) */
.ltr .ai-chat-widget {
    direction: ltr;
    text-align: left;
}

.ltr .ai-chat-title {
    flex-direction: row;
}

.ltr .ai-chat-avatar {
    margin-right: 12px;
    margin-left: 0;
}

/* LTR Message Layout: User Left, AI Right */
.ltr .ai-chat-message.user-message {
    margin-right: auto;
    margin-left: 0;
    flex-direction: row;
}

.ltr .ai-chat-message.ai-message {
    margin-left: auto;
    margin-right: 0;
    flex-direction: row-reverse;
}

.ltr .ai-chat-message.user-message .ai-chat-message-bubble-wrapper {
    align-items: flex-start;
}

.ltr .ai-chat-message.ai-message .ai-chat-message-bubble-wrapper {
    align-items: flex-end;
}

.ltr .user-message .ai-chat-message-content {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
}

.ltr .ai-message .ai-chat-message-content {
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

.ltr .chat-ai-typing-indicator {
    margin-left: auto;
    margin-right: 0;
}

.ltr .typing-bubble {
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

.ltr .ai-chat-input {
    text-align: left !important;
    direction: ltr !important;
}

.ltr .ai-chat-input-wrapper {
    /* LTR: Input left, Button right */
    flex-direction: row !important;
}

/* LTR Message Content Text Alignment */
.ltr .ai-chat-message-content {
    text-align: left !important;
    direction: ltr !important;
}

/* RTL Support - Persian/Arabic Layout */
.rtl .ai-chat-widget {
    direction: rtl;
    text-align: right;
}

.rtl .ai-chat-header {
    flex-direction: row-reverse;
}

.rtl .ai-chat-widget.bottom-right {
    right: 20px;
    left: auto;
}

.rtl .ai-chat-widget.bottom-left {
    left: 20px;
    right: auto;
}

.rtl .ai-chat-title {
    flex-direction: row-reverse;
}

.rtl .ai-chat-avatar {
    margin-right: 0;
    margin-left: 12px;
}

/* RTL Message Layout: User Right, AI Left */
.rtl .ai-chat-message.ai-message {
    margin-right: auto;
    margin-left: 0;
    flex-direction: row;
}

.rtl .ai-chat-message.user-message {
    margin-left: auto;
    margin-right: 0;
    flex-direction: row-reverse;
}

.rtl .ai-chat-message.ai-message .ai-chat-message-bubble-wrapper {
    align-items: flex-start;
}

.rtl .ai-chat-message.user-message .ai-chat-message-bubble-wrapper {
    align-items: flex-end;
}

.rtl .ai-message .ai-chat-message-content {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
}

.rtl .user-message .ai-chat-message-content {
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

.rtl .chat-ai-typing-indicator {
    margin-right: auto;
    margin-left: 0;
}

.rtl .typing-bubble {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
}

.rtl .ai-chat-input {
    text-align: right !important;
    direction: rtl !important;
}

.rtl .ai-chat-input-wrapper {
    padding: 8px 16px 8px 8px;
    /* RTL: Button left, Input right */
    flex-direction: row-reverse !important;
}

/* RTL Support for scroll buttons */
.rtl .ai-chat-scroll-buttons {
    right: auto;
    left: 50px; /* Position between send button and input in RTL */
}

/* RTL Message Content Text Alignment */
.rtl .ai-chat-message-content {
    text-align: right !important;
    direction: rtl !important;
}

/* Dark Mode Support - Enhanced */
@media (prefers-color-scheme: dark) {
    .ai-chat-window {
        background: #1a1a1a !important;
        color: #ffffff !important;
        border: 1px solid #404040 !important;
    }
    
    .ai-chat-messages {
        background: #2d2d2d !important;
    }
    
    .ai-message .ai-chat-message-content {
        background: #3a3a3a !important;
        color: #ffffff !important;
        border: 1px solid #555 !important;
    }
    
    .user-message .ai-chat-message-content {
        background: #3a3a3a !important;
        color: #ffffff !important;
        border: 1px solid #555 !important;
    }
    
    .ai-chat-input-container {
        background: #1a1a1a !important;
        border-top-color: #404040 !important;
    }
    
    .ai-chat-input-wrapper {
        background: #2d2d2d !important;
        border-color: #404040 !important;
    }
    
    .ai-chat-input {
        color: #ffffff !important;
    }
    
    .ai-chat-input::placeholder {
        color: #888 !important;
    }
    
    .ai-chat-input:focus {
        color: #ffffff !important;
    }
    
    .ai-chat-input:disabled {
        background: #2d2d2d !important;
        color: #888 !important;
    }
    
    .ai-chat-input:disabled::placeholder {
        color: #666 !important;
    }
    
    /* Remove text selection highlight in dark mode when disabled */
    .ai-chat-input:disabled::selection {
        background: transparent !important;
        color: inherit !important;
    }
    
    .ai-chat-input:disabled::-moz-selection {
        background: transparent !important;
        color: inherit !important;
    }
    
    .ai-chat-typing-dots {
        background: #3a3a3a !important;
        color: #ffffff !important;
        border: 1px solid #555 !important;
    }
    
    .ai-chat-send-btn:disabled {
        background: #404040 !important;
    }
    
    .ai-chat-message-time {
        color: #aaa !important;
    }
    
    .ai-chat-scroll-btn {
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.3) !important;
        color: #ffffff !important;
    }
    
    .ai-chat-scroll-btn:hover {
        background: rgba(255, 255, 255, 0.2) !important;
        border-color: rgba(255, 255, 255, 0.5) !important;
        color: #ffffff !important;
    }
}

/* Manual Dark Mode Class Support */
.ai-chat-widget.dark-mode .ai-chat-window,
.dark-mode .ai-chat-widget .ai-chat-window,
body.dark-mode .ai-chat-widget .ai-chat-window,
html.dark-mode .ai-chat-widget .ai-chat-window {
    background: #1a1a1a !important;
    color: #ffffff !important;
    border: 1px solid #404040 !important;
}

.ai-chat-widget.dark-mode .ai-chat-messages,
.dark-mode .ai-chat-widget .ai-chat-messages,
body.dark-mode .ai-chat-widget .ai-chat-messages,
html.dark-mode .ai-chat-widget .ai-chat-messages {
    background: #2d2d2d !important;
}

.ai-chat-widget.dark-mode .ai-message .ai-chat-message-content,
.dark-mode .ai-chat-widget .ai-message .ai-chat-message-content,
body.dark-mode .ai-chat-widget .ai-message .ai-chat-message-content,
html.dark-mode .ai-chat-widget .ai-message .ai-chat-message-content {
    background: #3a3a3a !important;
    color: #ffffff !important;
    border: 1px solid #555 !important;
}

.ai-chat-widget.dark-mode .ai-chat-input-container,
.dark-mode .ai-chat-widget .ai-chat-input-container,
body.dark-mode .ai-chat-widget .ai-chat-input-container,
html.dark-mode .ai-chat-widget .ai-chat-input-container {
    background: #1a1a1a !important;
    border-top-color: #404040 !important;
}

.ai-chat-widget.dark-mode .ai-chat-input-wrapper,
.dark-mode .ai-chat-widget .ai-chat-input-wrapper,
body.dark-mode .ai-chat-widget .ai-chat-input-wrapper,
html.dark-mode .ai-chat-widget .ai-chat-input-wrapper {
    background: #2d2d2d !important;
    border-color: #404040 !important;
}

.ai-chat-widget.dark-mode .ai-chat-input,
.dark-mode .ai-chat-widget .ai-chat-input,
body.dark-mode .ai-chat-widget .ai-chat-input,
html.dark-mode .ai-chat-widget .ai-chat-input {
    color: #ffffff !important;
}

.ai-chat-widget.dark-mode .ai-chat-input::placeholder,
.dark-mode .ai-chat-widget .ai-chat-input::placeholder,
body.dark-mode .ai-chat-widget .ai-chat-input::placeholder,
html.dark-mode .ai-chat-widget .ai-chat-input::placeholder {
    color: #888 !important;
}

.ai-chat-widget.dark-mode .ai-chat-input:focus,
.dark-mode .ai-chat-widget .ai-chat-input:focus,
body.dark-mode .ai-chat-widget .ai-chat-input:focus,
html.dark-mode .ai-chat-widget .ai-chat-input:focus {
    color: #ffffff !important;
}

.ai-chat-widget.dark-mode .ai-chat-input:disabled,
.dark-mode .ai-chat-widget .ai-chat-input:disabled,
body.dark-mode .ai-chat-widget .ai-chat-input:disabled,
html.dark-mode .ai-chat-widget .ai-chat-input:disabled {
    background: #2d2d2d !important;
    color: #888 !important;
}

.ai-chat-widget.dark-mode .ai-chat-input:disabled::placeholder,
.dark-mode .ai-chat-widget .ai-chat-input:disabled::placeholder,
body.dark-mode .ai-chat-widget .ai-chat-input:disabled::placeholder,
html.dark-mode .ai-chat-widget .ai-chat-input:disabled::placeholder {
    color: #666 !important;
}

/* Remove text selection highlight in dark mode when disabled */
.ai-chat-widget.dark-mode .ai-chat-input:disabled::selection,
.dark-mode .ai-chat-widget .ai-chat-input:disabled::selection,
body.dark-mode .ai-chat-widget .ai-chat-input:disabled::selection,
html.dark-mode .ai-chat-widget .ai-chat-input:disabled::selection {
    background: transparent !important;
    color: inherit !important;
}

.ai-chat-widget.dark-mode .ai-chat-input:disabled::-moz-selection,
.dark-mode .ai-chat-widget .ai-chat-input:disabled::-moz-selection,
body.dark-mode .ai-chat-widget .ai-chat-input:disabled::-moz-selection,
html.dark-mode .ai-chat-widget .ai-chat-input:disabled::-moz-selection {
    background: transparent !important;
    color: inherit !important;
}

.ai-chat-widget.dark-mode .ai-chat-typing-dots,
.dark-mode .ai-chat-widget .ai-chat-typing-dots,
body.dark-mode .ai-chat-widget .ai-chat-typing-dots,
html.dark-mode .ai-chat-widget .ai-chat-typing-dots {
    background: #3a3a3a !important;
    color: #ffffff !important;
    border: 1px solid #555 !important;
}

.ai-chat-widget.dark-mode .ai-chat-message-time,
.dark-mode .ai-chat-widget .ai-chat-message-time,
body.dark-mode .ai-chat-widget .ai-chat-message-time,
html.dark-mode .ai-chat-widget .ai-chat-message-time {
    color: #aaa !important;
}

.ai-chat-widget.dark-mode .ai-chat-scroll-btn,
.dark-mode .ai-chat-widget .ai-chat-scroll-btn,
body.dark-mode .ai-chat-widget .ai-chat-scroll-btn,
html.dark-mode .ai-chat-widget .ai-chat-scroll-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #ffffff !important;
}

.ai-chat-widget.dark-mode .ai-chat-scroll-btn:hover,
.dark-mode .ai-chat-widget .ai-chat-scroll-btn:hover,
body.dark-mode .ai-chat-widget .ai-chat-scroll-btn:hover,
html.dark-mode .ai-chat-widget .ai-chat-scroll-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: #ffffff !important;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ai-chat-button {
        border: 2px solid #000;
    }
    
    .ai-chat-window {
        border: 2px solid #000;
    }
    
    .ai-chat-message-content {
        border: 1px solid #ccc;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ai-chat-button,
    .ai-chat-window,
    .ai-chat-control-btn,
    .ai-chat-send-btn {
        transition: none;
    }
    
    .ai-chat-message {
        animation: none;
    }
    
    .ai-chat-typing-dots span {
        animation: none;
        opacity: 0.7;
    }
    
    .ai-chat-notification {
        animation: none;
    }
}

/* Product Cards Styles */
.ai-products-container {
    margin: 15px 0;
    padding: 0;
    clear: both;
    width: 100%;
}

.ai-products-grid {
    display: grid;
    gap: 12px;
    margin: 10px 0;
    max-width: 100%;
    clear: both;
}

/* Responsive grid classes based on display count */
.ai-products-grid.grid-1 {
    grid-template-columns: 1fr;
    max-width: 200px;
    margin: 0 auto;
}

.ai-products-grid.grid-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 400px;
}

.ai-products-grid.grid-3 {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
}

.ai-products-grid.grid-4 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 100%;
}

/* Mobile responsive adjustments */
@media (max-width: 480px) {
    .ai-products-grid.grid-2,
    .ai-products-grid.grid-3,
    .ai-products-grid.grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 350px) {
    .ai-products-grid.grid-2,
    .ai-products-grid.grid-3,
    .ai-products-grid.grid-4 {
        grid-template-columns: 1fr;
    }
}

.ai-products-grid.single-product {
    grid-template-columns: 1fr;
    max-width: 200px;
}

.ai-product-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-size: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ai-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.ai-product-image {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #f8f8f8;
    flex-shrink: 0;
}

.ai-product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
    padding: 4px;
    box-sizing: border-box;
}

.ai-product-image:hover img {
    transform: scale(1.05);
}

.ai-product-info {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
}

.ai-product-title {
    margin: 0 0 6px 0;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    height: 28px;
    overflow: hidden;
    flex-shrink: 0;
}

.ai-product-title a {
    color: #333;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.ai-product-title a:hover {
    color: #667eea;
}

.ai-product-price {
    font-size: 12px;
    font-weight: bold;
    color: #667eea;
    margin: 6px 0;
    flex-shrink: 0;
}

.ai-product-stock {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    display: inline-block;
    margin: 4px 0;
    font-weight: 500;
    flex-shrink: 0;
    width: fit-content;
}

.ai-product-stock.in-stock {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ai-product-stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ai-product-description {
    font-size: 10px;
    color: #666;
    margin: 4px 0;
    line-height: 1.4;
    flex-grow: 1;
}

.ai-chat-message-content .ai-product-button {
    display: block !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 6px 10px !important;
    border-radius: 18px !important;
    text-decoration: none !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    margin-top: 8px !important;
    transition: all 0.3s ease !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border: none !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
    flex-shrink: 0 !important;
}

.ai-chat-message-content .ai-product-button:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%) !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}

.ai-chat-message-content .ai-product-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3) !important;
}

/* Category Links Container */
.ai-category-links {
    margin: 15px 0 10px 0 !important;
    padding: 0 !important;
    display: block !important;
    clear: both !important;
    width: 100% !important;
}

/* Category link styling */
.ai-chat-message-content .ai-category-link,
.ai-chat-message-content a[href*="product-category"] {
    display: inline-block !important;
    background: #e9ecef !important;
    color: #495057 !important;
    padding: 4px 12px !important;
    border-radius: 16px !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    margin: 8px 4px 8px 0 !important;
    border: 1px solid #dee2e6 !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}

.ai-chat-message-content .ai-category-link:before,
.ai-chat-message-content a[href*="product-category"]:before {
    content: "🏷️" !important;
    margin-right: 6px !important;
    font-size: 12px !important;
}

.ai-chat-message-content .ai-category-link:hover,
.ai-chat-message-content a[href*="product-category"]:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3) !important;
}

.ai-chat-message-content .ai-category-link:active,
.ai-chat-message-content a[href*="product-category"]:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2) !important;
}

/* Category Tags Container */
.ai-category-tags {
    margin: 15px 0 10px 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    clear: both !important;
    width: 100% !important;
}

/* Category tag styling (smaller tags) */
.ai-chat-message-content .ai-category-tag {
    display: inline-block !important;
    background: linear-gradient(135deg, #f1f3f4 0%, #e8eaed 100%) !important;
    color: #5f6368 !important;
    padding: 6px 12px !important;
    border-radius: 16px !important;
    text-decoration: none !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    margin: 0 !important;
    border: 1px solid #dadce0 !important;
    transition: all 0.2s ease !important;
    text-align: center !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    position: relative !important;
    overflow: hidden !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

.ai-chat-message-content .ai-category-tag:before {
    content: "🏷️" !important;
    margin-left: 4px !important;
    font-size: 10px !important;
}

.ai-chat-message-content .ai-category-tag:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-color: #667eea !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25) !important;
}

.ai-chat-message-content .ai-category-tag:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.2) !important;
}

/* Products footer styling */
.ai-products-footer {
    margin-top: 15px !important;
    padding-top: 12px !important;
    border-top: 1px solid #e0e0e0 !important;
    display: block !important;
    clear: both !important;
    text-align: center !important;
}

.ai-products-footer .additional-products-text {
    display: block !important;
    margin-bottom: 10px !important;
    font-size: 12px !important;
    color: #666 !important;
    line-height: 1.4 !important;
    text-align: center !important;
}

.ai-chat-message-content .ai-category-view-all-btn {
    display: inline-block !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 10px 20px !important;
    border-radius: 25px !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    border: none !important;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3) !important;
    text-align: center !important;
    margin: 0 auto !important;
    position: relative !important;
    overflow: hidden !important;
}

.ai-chat-message-content .ai-category-view-all-btn:before {
    content: "🛍️" !important;
    margin-left: 8px !important;
    font-size: 14px !important;
}

.ai-chat-message-content .ai-category-view-all-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%) !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

.ai-chat-message-content .ai-category-view-all-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3) !important;
}

/* Additional products text and button styling */
.ai-chat-message-content .additional-products-info {
    margin-top: 15px !important;
    padding-top: 10px !important;
    border-top: 1px solid #e0e0e0 !important;
    display: block !important;
    clear: both !important;
}

.ai-chat-message-content .additional-products-text {
    display: block !important;
    margin-bottom: 8px !important;
    font-size: 12px !important;
    color: #666 !important;
    line-height: 1.4 !important;
}

.ai-chat-message-content .view-all-products-btn {
    display: block !important;
    width: fit-content;
    margin: 5px auto 0 !important;
    background: #667eea !important;
    color: white !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    text-decoration: none !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    margin-top: 5px !important;
    transition: all 0.2s ease !important;
    border: none !important;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2) !important;
    clear: both !important;
}

.ai-chat-message-content .view-all-products-btn:hover {
    background: #5a67d8 !important;
    color: white !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3) !important;
}

/* Ensure proper spacing between products grid and additional info */
.ai-products-grid + .additional-products-info {
    margin-top: 15px !important;
}

/* Fix for any floating elements */
.ai-chat-message-content::after {
    content: "" !important;
    display: table !important;
    clear: both !important;
}

/* Responsive adjustments for product cards */
@media (max-width: 480px) {
    .ai-products-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 6px;
    }
    
    .ai-product-image {
        height: 80px;
    }
    
    .ai-product-info {
        padding: 6px;
    }
    
    .ai-product-title {
        font-size: 10px;
        height: 20px;
    }
    
    .ai-product-price {
        font-size: 11px;
    }
    
    .ai-product-button {
        font-size: 9px;
        padding: 3px 6px;
    }
}

@media (max-width: 350px) {
    .ai-products-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 4px;
    }
    
    .ai-product-image {
        height: 70px;
    }
    
    .ai-product-info {
        padding: 4px;
    }
    
    .ai-product-title {
        font-size: 9px;
        height: 18px;
    }
    
    .ai-product-price {
        font-size: 10px;
    }
    
    .ai-product-button {
        font-size: 8px;
        padding: 2px 4px;
    }
}

/* Dark mode support for product cards */
@media (prefers-color-scheme: dark) {
    .ai-product-card {
        background: #3a3a3a;
        border-color: #555;
    }
    
    .ai-product-title a {
        color: #fff;
    }
    
    .ai-product-title a:hover {
        color: #4a9eff;
    }
    
    .ai-product-price {
        color: #4a9eff;
    }
    
    .ai-product-description {
        color: #ccc;
    }
    
    .ai-chat-message-content a[href*="product-category"] {
        background: #555;
        color: #fff !important;
        border-color: #666;
    }
    
    .ai-chat-message-content a[href*="product-category"]:hover {
        background: #4a9eff;
        border-color: #4a9eff;
    }
    
    /* Dark mode for additional products info */
    .ai-chat-message-content .additional-products-info {
        border-top-color: #555 !important;
    }
    
    .ai-chat-message-content .additional-products-text {
        color: #ccc !important;
    }
    
    .ai-chat-message-content .view-all-products-btn {
        background: #4a9eff !important;
        box-shadow: 0 2px 4px rgba(74, 158, 255, 0.2) !important;
    }
    
    .ai-chat-message-content .view-all-products-btn:hover {
        background: #3182ce !important;
        box-shadow: 0 4px 8px rgba(74, 158, 255, 0.3) !important;
    }
}

/* Sale Products Styles */
.ai-products-grid.sale-products .ai-product-card.sale-card {
    position: relative;
    border: 2px solid #ff6b6b;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.ai-product-discount {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ai-product-price-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-product-price.sale-price {
    color: #ff6b6b;
    font-weight: bold;
    font-size: 16px;
}

.ai-product-regular-price {
    color: #999;
    font-size: 14px;
    text-decoration: line-through;
}

.ai-product-button.sale-button {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    border: none;
}

.ai-product-button.sale-button:hover {
    background: linear-gradient(135deg, #ff5252, #e53935);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

/* RTL Support for Sale Products */
.rtl .ai-product-discount {
    right: auto;
    left: 10px;
}

/* Dark mode support for sale products */
@media (prefers-color-scheme: dark) {
    .ai-products-grid.sale-products .ai-product-card.sale-card {
        border-color: #ff8a80;
        box-shadow: 0 4px 12px rgba(255, 138, 128, 0.3);
    }
    
    .ai-product-discount {
        background: linear-gradient(135deg, #ff8a80, #ff7043);
    }
    
    .ai-product-price.sale-price {
        color: #ff8a80;
    }
    
    .ai-product-button.sale-button {
        background: linear-gradient(135deg, #ff8a80, #ff7043);
    }
    
    .ai-product-button.sale-button:hover {
        background: linear-gradient(135deg, #ff7043, #ff5722);
    }
}

/* Force RTL/LTR Input Direction - High Priority */
.ai-chat-widget.rtl .ai-chat-input,
.ai-chat-widget.rtl textarea.ai-chat-input,
.rtl .ai-chat-widget .ai-chat-input,
.rtl .ai-chat-widget textarea.ai-chat-input {
    direction: rtl !important;
    text-align: right !important;
    unicode-bidi: embed !important;
}

.ai-chat-widget.ltr .ai-chat-input,
.ai-chat-widget.ltr textarea.ai-chat-input,
.ltr .ai-chat-widget .ai-chat-input,
.ltr .ai-chat-widget textarea.ai-chat-input {
    direction: ltr !important;
    text-align: left !important;
    unicode-bidi: embed !important;
}

/* Contact Methods Styles - Inside Chat Widget */
.ai-contact-methods-container {
    position: relative !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 20px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    width: 100% !important;
    height: auto !important;
    z-index: 1 !important;
    margin: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    box-sizing: border-box !important;
}

.ai-contact-methods-icons {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    position: relative !important;
    height: 40px !important;
    margin-right: 8px !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    box-sizing: border-box !important;
}

.ai-contact-method-icon {
    width: 40px !important;
    height: 40px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: 3px solid white !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: white !important;
    position: relative !important;
    overflow: hidden !important;
    z-index: 1 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
    font-size: inherit !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    outline: none !important;
}

/* Partial overlapping effect - each icon overlaps the previous one by 30% */
.ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+2) {
    margin-left: -12px !important;
    z-index: 2;
}

.ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+3) {
    z-index: 3;
}

.ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+4) {
    z-index: 4;
}

.ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+5) {
    z-index: 5;
}

.ai-contact-method-icon:hover {
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    z-index: 10;
}

.ai-contact-method-icon:active {
    transform: translateY(-1px) scale(1.05);
}

.ai-contact-method-icon i {
    font-size: 16px;
    color: white;
}

.ai-contact-method-icon img {
    width: 20px;
    height: 20px;
    object-fit: cover;
    border-radius: 50%;
}

.ai-contact-method-icon .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: white;
}

.ai-contact-methods-toggle {
    width: 48px !important;
    height: 48px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    color: white !important;
    position: relative !important;
    z-index: 5 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-decoration: none !important;
    font-size: inherit !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    outline: none !important;
}

.ai-contact-methods-toggle:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
    color: white !important;
    text-decoration: none !important;
}

.ai-contact-methods-toggle svg {
    width: 20px !important;
    height: 20px !important;
    fill: white !important;
    display: block !important;
    flex-shrink: 0 !important;
    pointer-events: none !important;
}

/* Contact Methods Modal */
.ai-contact-methods-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.ai-contact-methods-modal.show {
    opacity: 1;
}

.ai-contact-methods-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-contact-methods-modal-content.animate-in {
    transform: scale(1) translateY(0);
}

.ai-contact-methods-modal-content.animate-out {
    transform: scale(0.9) translateY(20px);
    opacity: 0;
}

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

.ai-contact-methods-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.ai-contact-methods-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.ai-contact-methods-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-contact-methods-modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.ai-contact-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    justify-items: center;
}

.ai-contact-method-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    text-align: center;
    width: 100%;
    max-width: 180px;
}

.ai-contact-method-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.ai-contact-method-icon-wrapper {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.ai-contact-method-icon-wrapper i {
    font-size: 20px;
    color: white;
}

.ai-contact-method-icon-wrapper img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 50%;
}

.ai-contact-method-icon-wrapper .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    color: white;
}

.ai-contact-method-info {
    flex: 1;
    min-width: 0;
}

.ai-contact-method-info h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ai-contact-method-link {
    color: #667eea !important;
    text-decoration: none !important;
    font-size: 14px;
    word-break: break-all;
    display: block;
    transition: color 0.2s ease;
}

.ai-contact-method-link:hover {
    color: #5a67d8 !important;
    text-decoration: underline !important;
}

.ai-contact-method-link.phone {
    color: #28a745 !important;
    font-weight: 600;
}

.ai-contact-method-link.phone:hover {
    color: #1e7e34 !important;
}

/* RTL Support for Contact Methods */
.rtl .ai-contact-methods-container {
    flex-direction: row-reverse;
}

.rtl .ai-contact-methods-icons {
    margin-right: 0;
    margin-left: 8px;
}

/* RTL partial overlapping - icons overlap from right to left by 30% */
.rtl .ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+2) {
    margin-left: 0 !important;
    margin-right: -12px !important;
    z-index: 2;
}

.rtl .ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+3) {
    z-index: 3;
}

.rtl .ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+4) {
    z-index: 4;
}

.rtl .ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+5) {
    z-index: 5;
}

.rtl .ai-contact-method-item {
    flex-direction: row-reverse;
}

.rtl .ai-contact-methods-modal-header {
    flex-direction: row-reverse;
}

.rtl .ai-contact-method-info {
    text-align: right;
}

/* Mobile Responsive for Contact Methods */
@media (max-width: 768px) {
    .ai-contact-methods-modal-content {
        width: 95%;
        height: 70vh;
        max-height: 70vh;
        margin: 20px;
        display: flex;
        flex-direction: column;
    }
    
    .ai-contact-methods-modal-body {
        flex: 1;
        overflow-y: auto;
    }
    
    .ai-contact-methods-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .ai-contact-method-item {
        padding: 12px;
        width: 100%;
        max-width: none;
    }
    
    .ai-contact-method-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .ai-contact-method-icon-wrapper i {
        font-size: 18px;
    }
    
    .ai-contact-method-icon-wrapper img {
        width: 24px;
        height: 24px;
    }
    
    .ai-contact-method-info h4 {
        font-size: 14px;
    }
    
    .ai-contact-method-link {
        font-size: 13px;
    }
    
    .ai-contact-methods-modal-header {
        padding: 16px 20px;
    }
    
    .ai-contact-methods-modal-header h3 {
        font-size: 16px;
    }
    
    .ai-contact-methods-modal-body {
        padding: 20px;
    }
    
    /* Show contact methods container on mobile but with smaller icons */
    .ai-contact-methods-container {
        padding: 8px 16px;
    }
    
    .ai-contact-methods-icons {
        height: 32px;
        margin-right: 6px;
    }
    
    .ai-contact-method-icon {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }
    
    .ai-contact-methods-icons .ai-contact-method-icon:nth-child(n+2) {
        margin-left: -8px !important;
    }
    
    .ai-contact-method-icon i {
        font-size: 14px;
    }
    
    .ai-contact-method-icon img {
        width: 16px;
        height: 16px;
    }
    
    .ai-contact-method-icon .dashicons {
        font-size: 14px;
        width: 14px;
        height: 14px;
    }
    
    .ai-contact-methods-toggle {
        width: 40px;
        height: 40px;
    }
    
    .ai-contact-methods-toggle svg {
        width: 18px;
        height: 18px;
    }
    
    /* RTL support for mobile contact methods */
    .rtl .ai-contact-methods-icons {
        margin-right: 0;
        margin-left: 6px;
    }
    
    .rtl .ai-contact-method-icon:nth-child(n+2) {
        margin-left: 0;
        margin-right: -8px;
    }
}

@media (max-width: 480px) {
    .ai-contact-methods-modal-content {
        width: 95%;
        height: 65vh;
        max-height: 65vh;
        border-radius: 12px;
        position: relative;
        margin: auto;
        display: flex;
        flex-direction: column;
        transform: scale(0.9) translateY(20px);
    }
    
    .ai-contact-methods-modal-content.animate-in {
        transform: scale(1) translateY(0);
    }
    
    .ai-contact-methods-modal-content.animate-out {
        transform: scale(0.9) translateY(20px);
        opacity: 0;
    }
    
    .ai-contact-methods-modal-body {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
        max-height: none;
    }
    
    .ai-contact-method-item {
        padding: 16px 12px;
    }
}

/* Dark Mode Support for Contact Methods */
@media (prefers-color-scheme: dark) {
    .ai-contact-methods-modal-content {
        background: #1a1a1a;
        color: white;
    }
    
    .ai-contact-method-item {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .ai-contact-method-item:hover {
        background: #3a3a3a;
        border-color: #667eea;
    }
    
    .ai-contact-method-info h4 {
        color: white;
    }
    
    .ai-contact-methods-modal-body {
        background: #1a1a1a;
    }
}

.ai-chat-widget.dark-mode .ai-contact-methods-modal-content,
.dark-mode .ai-chat-widget .ai-contact-methods-modal-content,
body.dark-mode .ai-chat-widget .ai-contact-methods-modal-content,
html.dark-mode .ai-chat-widget .ai-contact-methods-modal-content {
    background: #1a1a1a !important;
    color: white !important;
}

.ai-chat-widget.dark-mode .ai-contact-method-item,
.dark-mode .ai-chat-widget .ai-contact-method-item,
body.dark-mode .ai-chat-widget .ai-contact-method-item,
html.dark-mode .ai-chat-widget .ai-contact-method-item {
    background: #2d2d2d !important;
    border-color: #404040 !important;
}

.ai-chat-widget.dark-mode .ai-contact-method-item:hover,
.dark-mode .ai-chat-widget .ai-contact-method-item:hover,
body.dark-mode .ai-chat-widget .ai-contact-method-item:hover,
html.dark-mode .ai-chat-widget .ai-contact-method-item:hover {
    background: #3a3a3a !important;
    border-color: #667eea !important;
}

.ai-chat-widget.dark-mode .ai-contact-method-info h4,
.dark-mode .ai-chat-widget .ai-contact-method-info h4,
body.dark-mode .ai-chat-widget .ai-contact-method-info h4,
html.dark-mode .ai-chat-widget .ai-contact-method-info h4 {
    color: white !important;
}

/* Animation for contact methods icons */
@keyframes contactMethodSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ai-contact-method-icon {
    animation: contactMethodSlideIn 0.3s ease forwards;
}

.ai-contact-method-icon:nth-child(1) {
    animation-delay: 0.1s;
}

.ai-contact-method-icon:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-contact-method-icon:nth-child(3) {
    animation-delay: 0.3s;
}

.ai-contact-method-icon:nth-child(4) {
    animation-delay: 0.4s;
}

.ai-contact-method-icon:nth-child(5) {
    animation-delay: 0.5s;
}

/* Reduced motion support for contact methods */
@media (prefers-reduced-motion: reduce) {
    .ai-contact-method-icon,
    .ai-contact-methods-modal-content,
    .ai-contact-method-item {
        animation: none;
        transition: none;
    }
    
    .ai-contact-methods-icons {
        transition: opacity 0.2s ease;
    }
}

/* High contrast mode for contact methods */
@media (prefers-contrast: high) {
    .ai-contact-method-icon,
    .ai-contact-methods-toggle {
        border: 2px solid #000;
    }
    
    .ai-contact-methods-modal-content {
        border: 2px solid #000;
    }
    
    .ai-contact-method-item {
        border: 2px solid #333;
    }
}

/* Cache buster - Tue Dec 24 10:00:00 +03:30 2024 */