/* AI Chat Widget CSS */

/* Brand colors — overridden at runtime by chat-widget.js when the customer
   has personalized values from their portal config. The defaults below
   match the original purple/cyan gradient so an unconnected install still
   renders identically to pre-personalization behaviour. */
:root {
    --lemma-brand-primary:    #6366f1;
    --lemma-brand-primary-2:  #a855f7;
    --lemma-brand-accent:     #4ade80;
    --lemma-brand-on-primary: #ffffff;
}

/* Floating Action Button (FAB)
   Anchored to bottom-RIGHT in both LTR and RTL modes (product decision —
   the chat widget should sit on the same side regardless of text direction
   so customers always know where to find it). */
.lemma-chat-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--lemma-brand-primary) 0%, var(--lemma-brand-primary-2) 100%);
    box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lemma-chat-fab:hover {
    transform: scale(1.1);
}

.lemma-chat-fab svg {
    width: 30px;
    height: 30px;
    color: white;
}

/* Chat Popup Bubble — anchored bottom-right (matches FAB position) */
.lemma-chat-popup {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 300px;
    background: white;
    padding: 15px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.lemma-chat-popup.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    animation: float-popup 3s ease-in-out infinite;
    cursor: pointer;
}

@keyframes float-popup {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-5px) scale(1);
    }
}

/* Tail of the popup bubble — points down at the FAB on the right */
.lemma-chat-popup::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 16px;
    height: 16px;
    background: white;
    transform: rotate(45deg);
    border-right: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* Chat Popup Content Structure */
.lemma-chat-popup-content {
    display: flex;
    align-items: center;
    /* Align contents cleanly */
    gap: 12px;
}

/* Avatar Container for Image & Status Dot */
.lemma-chat-popup-avatar-container {
    position: relative;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.lemma-chat-popup-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.lemma-chat-popup-status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: var(--lemma-brand-accent);
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.15);
}

/* Text Container Structure */
.lemma-chat-popup-text-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.lemma-chat-popup-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 2px;
}

.lemma-chat-popup-subtitle {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

/* Close Button Alignment */
.lemma-chat-popup-close {
    align-self: flex-start;
    margin-top: -5px;
    margin-right: -5px;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s;
    border-radius: 50%;
}

.lemma-chat-popup-close:hover {
    color: #4b5563;
    background: rgba(0, 0, 0, 0.05);
}

/* RTL Support for Popup — content direction only.
   Position is already bottom-right (the FAB anchor) for both LTR and RTL,
   so we no longer flip `left/right` here. The rules below only adjust
   typography, text direction, and border colour for the RTL theme. */
.rtl .lemma-chat-popup,
[dir="rtl"] .lemma-chat-popup,
.lemma-chat-popup.lemma-chat-rtl {
    text-align: right;
    direction: rtl;
    border: 2px solid #091E42;
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
}

/* Tail border colour shifts to match the RTL popup's navy border */
.lemma-chat-popup.lemma-chat-rtl::after {
    border: none;
    border-right: 2px solid #091E42;
    border-bottom: 2px solid #091E42;
}

/* RTL Support logic extended */
.lemma-chat-popup.lemma-chat-rtl .lemma-chat-popup-title,
.lemma-chat-popup.lemma-chat-rtl .lemma-chat-popup-subtitle {
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
}

.lemma-chat-popup.lemma-chat-rtl .lemma-chat-popup-title {
    color: #091E42;
}

.lemma-chat-popup.lemma-chat-rtl .lemma-chat-popup-status-dot {
    left: 2px;
    right: auto;
    border-color: #f8fafc;
}

.lemma-chat-popup.lemma-chat-rtl .lemma-chat-popup-close {
    margin-right: 0;
    margin-left: -5px;
}

.lemma-chat-popup.lemma-chat-rtl .lemma-chat-popup-close:hover {
    color: #091E42;
}

/* Chat Window — anchored bottom-right in both LTR and RTL */
.lemma-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 575px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

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

/* Header */
.lemma-chat-header {
    background: linear-gradient(135deg, var(--lemma-brand-primary) 0%, var(--lemma-brand-primary-2) 100%);
    padding: 20px;
    color: var(--lemma-brand-on-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lemma-chat-title {
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.lemma-status-dot {
    width: 8px;
    height: 8px;
    background: var(--lemma-brand-accent);
    border-radius: 50%;
    box-shadow: 0 0 5px var(--lemma-brand-accent);
}

/* =============================================================================
   Post-start header — richer presentation that makes the agent feel real.
   Triggered exclusively by data-state="chatting" so the pre-form header
   stays untouched. Composes with whatever brand colors the customer has
   via the --lemma-brand-* CSS custom properties.
   ============================================================================= */
.lemma-chat-title[data-state="chatting"] {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 12px;
    align-items: center;
    font-weight: 400;     /* override the bold default — children set their own */
    font-size: 14px;
    line-height: 1.25;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.30) 0%,
            rgba(255, 255, 255, 0.10) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.22),
        0 1px 2px rgba(0, 0, 0, 0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lemma-brand-on-primary);
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0;
    line-height: 1;
    flex-shrink: 0;
    /* overflow stays visible so the presence dot can sit on top of the
       avatar's edge instead of being clipped by the circle. The <img>
       child clips itself via border-radius + object-fit (see below). */
    overflow: visible;
    animation: lemma-agent-fade 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-avatar .agent-presence {
    position: absolute;
    /* Sit ON TOP of the avatar's edge — the avatar wrapper has
       overflow:visible so the dot is no longer clipped by the
       circle. Slight positive offsets keep it nicely overlapping. */
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--lemma-brand-accent);
    box-shadow:
        0 0 0 2px var(--lemma-brand-primary-2),
        0 0 6px rgba(0, 0, 0, 0.15);
    animation: lemma-presence-pulse 2.6s ease-in-out infinite;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    animation: lemma-agent-fade 360ms cubic-bezier(0.16, 1, 0.3, 1) 60ms both;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.005em;
    line-height: 1.2;
    color: var(--lemma-brand-on-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--lemma-brand-on-primary);
    opacity: 0.82;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-meta .agent-role {
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-meta .meta-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.55;
    flex-shrink: 0;
}

.lemma-chat-title[data-state="chatting"] .lemma-agent-meta .agent-status {
    flex-shrink: 0;
}

/* RTL — mirror the avatar's presence dot to the inside corner. */
.lemma-chat-rtl .lemma-chat-title[data-state="chatting"] .lemma-agent-avatar .agent-presence,
[dir="rtl"] .lemma-chat-title[data-state="chatting"] .lemma-agent-avatar .agent-presence,
body.rtl-mode .lemma-chat-title[data-state="chatting"] .lemma-agent-avatar .agent-presence {
    right: auto;
    left: 0;
}

@keyframes lemma-agent-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

@keyframes lemma-presence-pulse {
    0%, 100% { transform: scale(1);    opacity: 1;    }
    50%      { transform: scale(1.18); opacity: 0.78; }
}

.lemma-chat-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 5px;
}

.lemma-chat-close:hover {
    color: white;
}

/* Messages Area */
.lemma-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f9fafb;
    position: relative;
}

.lemma-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    word-wrap: break-word;
}

.lemma-message.agent {
    align-self: flex-start;
    background: white;
    color: #1f2937;
    border-top-left-radius: 2px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.lemma-message.user {
    align-self: flex-end;
    background: #6366f1;
    color: white;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

/* Typing Indicator */
.lemma-typing {
    align-self: flex-start;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    border-top-left-radius: 2px;
    display: none;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.lemma-typing.active {
    display: flex;
}

.lemma-dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Input Area - hidden by default, shown when chat is active */
.lemma-chat-input-area {
    padding: 15px !important;
    background: white !important;
    border-top: 1px solid #e5e7eb !important;
    display: none;
    gap: 10px !important;
    align-items: center !important;
}

.lemma-chat-window .lemma-chat-input {
    flex: 1 !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 25px !important;
    padding: 10px 15px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: border-color 0.2s, max-height 0.2s !important;
    background: white !important;
    color: #1f2937 !important;
    font-family: inherit !important;
    line-height: 1.5 !important;
    min-height: 40px !important;
    max-height: 120px !important;
    width: auto !important;
    resize: none !important;
    overflow-y: auto !important;
}

.lemma-chat-window .lemma-chat-input:focus {
    border-color: var(--lemma-brand-primary) !important;
    box-shadow: none !important;
}

.lemma-chat-window .lemma-chat-input:disabled {
    background: #f3f4f6 !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
}

.lemma-chat-window .lemma-chat-send {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 50% !important;
    background: var(--lemma-brand-primary) !important;
    border: none !important;
    color: var(--lemma-brand-on-primary) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background 0.2s, filter 0.2s !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

.lemma-chat-window .lemma-chat-send svg {
    width: 20px !important;
    height: 20px !important;
    color: white !important;
    stroke: currentColor !important;
    fill: none !important;
}

.lemma-chat-window .lemma-chat-send:hover {
    background: var(--lemma-brand-primary) !important;
    filter: brightness(0.9) !important;
}

.lemma-chat-window .lemma-chat-send:disabled {
    background: #d1d5db !important;
    cursor: not-allowed !important;
}

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

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

.lemma-chat-messages::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 20px;
}

/* =============================================================================
   RTL Mode Styling (Rastava Theme - Navy/Mint)
   ============================================================================= */

/* RTL FAB — same bottom-right anchor as LTR (already set by the base rule),
   but with a navy background and mint icon to match the RTL design. */
.lemma-chat-fab.lemma-chat-rtl,
.rtl-mode .lemma-chat-fab,
[dir="rtl"] .lemma-chat-fab {
    background: #091E42;
    box-shadow: 0 4px 14px 0 rgba(9, 30, 66, 0.4);
}

.lemma-chat-fab.lemma-chat-rtl:hover,
.rtl-mode .lemma-chat-fab:hover,
[dir="rtl"] .lemma-chat-fab:hover {
    box-shadow: 0 8px 25px rgba(93, 255, 165, 0.35);
}

.lemma-chat-fab.lemma-chat-rtl svg,
.rtl-mode .lemma-chat-fab svg,
[dir="rtl"] .lemma-chat-fab svg {
    color: #5DFFA5;
}

/* RTL Chat Window — same bottom-right anchor as LTR; only direction,
   typography, and border colour change for the RTL theme. */
.lemma-chat-window.lemma-chat-rtl,
.rtl-mode .lemma-chat-window,
[dir="rtl"] .lemma-chat-window {
    direction: rtl;
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
    border: 2px solid #091E42;
}

/* RTL Header - Navy with mint text (keep default left-to-right order) */
.lemma-chat-window.lemma-chat-rtl .lemma-chat-header,
.rtl-mode .lemma-chat-header {
    background: #091E42;
    /* No flex-direction change - keep close button left, title right */
}

.lemma-chat-window.lemma-chat-rtl .lemma-chat-title,
.rtl-mode .lemma-chat-title {
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
    /* Keep default order: dot then text */
}

.lemma-chat-window.lemma-chat-rtl .lemma-status-dot,
.rtl-mode .lemma-status-dot {
    background: #5DFFA5;
    box-shadow: 0 0 8px #5DFFA5;
}

/* RTL Messages */
.lemma-chat-window.lemma-chat-rtl .lemma-chat-messages,
.rtl-mode .lemma-chat-messages {
    background: #f8fafc;
}

.lemma-chat-window.lemma-chat-rtl .lemma-message,
.rtl-mode .lemma-message {
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
    text-align: right;
}

/* Agent messages on the LEFT in RTL */
.lemma-chat-window.lemma-chat-rtl .lemma-message.agent,
.rtl-mode .lemma-message.agent {
    align-self: flex-start;
    border-top-left-radius: 2px;
    border-top-right-radius: 12px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

/* User messages on the RIGHT in RTL */
.lemma-chat-window.lemma-chat-rtl .lemma-message.user,
.rtl-mode .lemma-message.user {
    align-self: flex-end;
    background: #091E42;
    color: #5DFFA5;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 10px rgba(9, 30, 66, 0.3);
}

/* RTL Typing Indicator - on the LEFT with agent messages */
.lemma-chat-window.lemma-chat-rtl .lemma-typing,
.rtl-mode .lemma-typing {
    align-self: flex-start;
    border-top-left-radius: 2px;
    border-top-right-radius: 12px;
}

.lemma-chat-window.lemma-chat-rtl .lemma-dot,
.rtl-mode .lemma-dot {
    background: #5DFFA5;
}

/* RTL Input - text direction and font */
.lemma-chat-window.lemma-chat-rtl .lemma-chat-input,
.rtl-mode .lemma-chat-input {
    text-align: right !important;
    direction: rtl !important;
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif !important;
}

.lemma-chat-window.lemma-chat-rtl .lemma-chat-input:focus,
.rtl-mode .lemma-chat-input:focus {
    border-color: #5DFFA5 !important;
}

.lemma-chat-window.lemma-chat-rtl .lemma-chat-input::placeholder,
.rtl-mode .lemma-chat-input::placeholder {
    text-align: right !important;
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif !important;
}

/* RTL Send Button - Mint background, Navy icon */
.lemma-chat-window.lemma-chat-rtl .lemma-chat-send,
.rtl-mode .lemma-chat-send {
    background: #5DFFA5 !important;
}

.lemma-chat-window.lemma-chat-rtl .lemma-chat-send svg,
.rtl-mode .lemma-chat-send svg {
    color: #091E42 !important;
    transform: scaleX(-1) !important;
    /* Flip arrow for RTL */
}

.lemma-chat-window.lemma-chat-rtl .lemma-chat-send:hover,
.rtl-mode .lemma-chat-send:hover {
    background: #091E42 !important;
}

.lemma-chat-window.lemma-chat-rtl .lemma-chat-send:hover svg,
.rtl-mode .lemma-chat-send:hover svg {
    color: #5DFFA5 !important;
}

/* RTL Close Button */
.lemma-chat-window.lemma-chat-rtl .lemma-chat-close,
.rtl-mode .lemma-chat-close {
    color: #5DFFA5 !important;
}

.lemma-chat-window.lemma-chat-rtl .lemma-chat-close:hover,
.rtl-mode .lemma-chat-close:hover {
    color: #ffffff !important;
}

/* =============================================================================
   Lead Capture Form Styling
   ============================================================================= */

/* Chat Body Container */
.lemma-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Lead Form Container */
.lemma-lead-form {
    display: flex;
    flex-direction: column;
    padding: 25px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    flex: 1;
    justify-content: center;
}

.lemma-lead-header {
    text-align: center;
    margin-bottom: 25px;
}

.lemma-lead-header h3 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.lemma-lead-header p {
    margin: 0;
    font-size: 14px;
    color: #6b7280;
}

.lemma-lead-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lemma-lead-input {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #ffffff;
    color: #1f2937;
    font-family: inherit;
}

.lemma-lead-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.lemma-lead-input::placeholder {
    color: #9ca3af;
}

.lemma-lead-error {
    color: #dc2626;
    font-size: 13px;
    text-align: center;
    display: none;
    padding: 8px;
    background: #fef2f2;
    border-radius: 6px;
}

.lemma-lead-submit {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 5px;
}

.lemma-lead-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.lemma-lead-submit:active {
    transform: translateY(0);
}

/* Connecting Animation */
.lemma-connecting {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

/* Professional Connecting Overlay */
.lemma-connecting-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(3px);
    z-index: 10;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lemma-connecting-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
}

/* Animated Spinner */
.lemma-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(99, 102, 241, 0.15);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.lemma-connecting-text {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: #4b5563;
    text-align: center;
}

/* =============================================================================
   RTL Lead Form Styling (Rastava Theme)
   ============================================================================= */

.lemma-chat-window.lemma-chat-rtl .lemma-lead-form,
.rtl-mode .lemma-lead-form {
    direction: rtl;
}

.lemma-chat-window.lemma-chat-rtl .lemma-lead-header h3,
.rtl-mode .lemma-lead-header h3 {
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
}

.lemma-chat-window.lemma-chat-rtl .lemma-lead-header p,
.rtl-mode .lemma-lead-header p {
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
}

.lemma-chat-window.lemma-chat-rtl .lemma-lead-input,
.rtl-mode .lemma-lead-input {
    text-align: right;
    direction: rtl;
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
}

.lemma-chat-window.lemma-chat-rtl .lemma-lead-input:focus,
.rtl-mode .lemma-lead-input:focus {
    border-color: #5DFFA5;
    box-shadow: 0 0 0 3px rgba(93, 255, 165, 0.15);
}

.lemma-chat-window.lemma-chat-rtl .lemma-lead-submit,
.rtl-mode .lemma-lead-submit {
    background: #091E42;
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
}

.lemma-chat-window.lemma-chat-rtl .lemma-lead-submit:hover,
.rtl-mode .lemma-lead-submit:hover {
    box-shadow: 0 4px 12px rgba(9, 30, 66, 0.4);
}

/* RTL Connecting Overlay */
.lemma-chat-window.lemma-chat-rtl .lemma-connecting-overlay,
.rtl-mode .lemma-connecting-overlay {
    direction: rtl;
}

.lemma-chat-window.lemma-chat-rtl .lemma-spinner,
.rtl-mode .lemma-spinner {
    border-color: rgba(9, 30, 66, 0.15);
    border-top-color: #091E42;
}

.lemma-chat-window.lemma-chat-rtl .lemma-connecting-text,
.rtl-mode .lemma-connecting-text {
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
    color: #091E42;
}

.lemma-chat-window.lemma-chat-rtl .lemma-lead-error,
.rtl-mode .lemma-lead-error {
    font-family: 'Dana', 'DanaFaNum', 'Vazirmatn', 'Tahoma', sans-serif;
}