/* ==========================================================================
   Wisvox Live Support Chat Widget (Modern Luxury Edition 2026)
   نظام الدردشة والدعم المباشر الفاخر — تصميم زجاجي عصري واحترافي
   ========================================================================== */

:root {
    --ls-primary: #6366f1;
    --ls-primary-hover: #4f46e5;
    --ls-primary-glow: rgba(99, 102, 241, 0.4);
    --ls-bg-card: rgba(15, 17, 32, 0.96);
    --ls-bubble-user: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --ls-bubble-admin: rgba(26, 29, 48, 0.94);
    --ls-text: #f8fafc;
    --ls-text-muted: #94a3b8;
    --ls-border: rgba(255, 255, 255, 0.10);
    --ls-border-focus: rgba(99, 102, 241, 0.5);
    --ls-online: #10b981;
}

/* ==================== الحاوية الرئيسية للويدجت ==================== */
#live-support-container {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: visible !important;
    z-index: 9999 !important;
    pointer-events: none !important;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#live-support-container.ls-ready {
    visibility: visible !important;
    opacity: 1 !important;
}

#live-support-container.ls-ready #live-support-toggle {
    pointer-events: auto !important;
}

/* ==================== زر الفتح العائم ==================== */
#live-support-toggle {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 9999;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #4f46e5 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    cursor: pointer !important;
    pointer-events: auto !important;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.45), 0 0 20px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

#live-support-toggle:hover {
    transform: translateY(-4px) scale(1.06);
    box-shadow: 0 14px 36px rgba(99, 102, 241, 0.6), 0 0 28px rgba(139, 92, 246, 0.4);
}

#live-support-toggle:active {
    transform: translateY(-1px) scale(0.98);
}

#live-support-toggle svg {
    width: 28px;
    height: 28px;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#live-support-toggle .toggle-icon-close {
    display: none;
}

#live-support-toggle.active,
#live-support-container.ls-ready #live-support-toggle.active,
#live-support-container.ls-chat-open #live-support-toggle {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#live-support-toggle.active .toggle-icon-chat {
    display: none;
}

#live-support-toggle.active .toggle-icon-close {
    display: block;
    transform: rotate(90deg);
}

/* شارة عدد الرسائل غير المقروءة */
.ls-unread-badge {
    position: absolute;
    top: -3px;
    left: -3px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    padding: 0 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f1120;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6);
    animation: ls-pulse 2s infinite;
}

@keyframes ls-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); }
}

/* ==================== نافذة الدردشة الرئيسية ==================== */
#live-support-window {
    position: fixed;
    bottom: 98px;
    left: 24px;
    z-index: 9998;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 590px;
    max-height: calc(100vh - 115px);
    background: var(--ls-bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 24px;
    box-shadow: 0 24px 64px -12px rgba(0, 0, 0, 0.8), 0 0 45px rgba(99, 102, 241, 0.14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
    font-family: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    direction: rtl;
    box-sizing: border-box;
}

#live-support-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ls-ltr #live-support-window {
    direction: ltr;
    left: auto;
    right: 24px;
}

.ls-ltr #live-support-toggle {
    left: auto;
    right: 24px;
}

/* ==================== رأس نافذة الدردشة ==================== */
.ls-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22) 0%, rgba(30, 27, 75, 0.35) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    user-select: none;
}

.ls-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ls-avatar-wrap {
    position: relative;
    width: 44px;
    height: 44px;
}

.ls-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(99, 102, 241, 0.35);
    background: #1e1b4b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.ls-status-dot {
    position: absolute;
    bottom: 1px;
    left: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--ls-online);
    border: 2px solid #0f1120;
    box-shadow: 0 0 8px var(--ls-online);
}

.ls-status-dot::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    border: 1.5px solid var(--ls-online);
    animation: ls-radar 2s infinite ease-out;
}

@keyframes ls-radar {
    0% { transform: scale(1); opacity: 0.9; }
    100% { transform: scale(2.2); opacity: 0; }
}

.ls-header-title {
    font-size: 15.5px;
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 3px 0;
    letter-spacing: -0.01em;
}

.ls-header-subtitle {
    font-size: 12px;
    color: #a5b4fc;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.ls-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    display: inline-block;
    flex-shrink: 0;
}

.ls-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ls-btn-action {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ls-btn-action:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
    transform: rotate(90deg);
}

/* ==================== قائمة وجسم الرسائل ==================== */
.ls-messages {
    flex: 1;
    min-height: 0;
    padding: 18px 18px 36px 18px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
}

.ls-messages::-webkit-scrollbar {
    width: 5px;
}

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

.ls-messages::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.35);
    border-radius: 10px;
}

.ls-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(99, 102, 241, 0.7);
}

/* ==================== بطاقة الترحيب المبدئية ==================== */
.ls-welcome-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(30, 27, 75, 0.28) 100%);
    border: 1px solid rgba(99, 102, 241, 0.22);
    border-radius: 18px;
    padding: 16px 18px;
    text-align: center;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 4px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
    animation: ls-fade-down 0.4s ease-out;
}

@keyframes ls-fade-down {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ls-welcome-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.25);
}

.ls-welcome-card strong {
    color: #ffffff;
    display: block;
    font-size: 14.5px;
    font-weight: 800;
    margin-bottom: 5px;
}

.ls-welcome-card p {
    margin: 0;
}

/* ==================== صفوف الرسائل والفقاعات ==================== */
.ls-message-row {
    display: flex;
    flex-direction: column;
    max-width: 84%;
    width: fit-content;
    animation: ls-msg-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ls-msg-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* محاذاة الرسائل في الشات العربي (RTL):
   رسائل الدعم على اليمين (align-self: flex-start)
   رسائل المستخدم "أنت" على اليسار (align-self: flex-end)
*/
.ls-message-row.admin,
.ls-message-row.ls-row-admin {
    align-self: flex-start;
}

.ls-message-row.user,
.ls-message-row.ls-row-user {
    align-self: flex-end;
}

/* في العرض الإنجليزي (LTR) */
.ls-ltr .ls-message-row.admin,
.ls-ltr .ls-message-row.ls-row-admin {
    align-self: flex-start;
}

.ls-ltr .ls-message-row.user,
.ls-ltr .ls-message-row.ls-row-user {
    align-self: flex-end;
}

.ls-msg-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.ls-message-row.admin .ls-msg-wrapper,
.ls-message-row.ls-row-admin .ls-msg-wrapper {
    align-items: flex-start;
}

.ls-message-row.user .ls-msg-wrapper,
.ls-message-row.ls-row-user .ls-msg-wrapper {
    align-items: flex-end;
}

/* بيانات المرسل والوقت */
.ls-msg-meta,
.ls-sender-name {
    font-size: 11.5px;
    font-weight: 700;
    margin-bottom: 5px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.ls-message-row.admin .ls-msg-meta,
.ls-message-row.ls-row-admin .ls-msg-meta {
    color: #94a3b8;
}

.ls-message-row.user .ls-msg-meta,
.ls-message-row.ls-row-user .ls-msg-meta {
    color: #a5b4fc;
}

.ls-meta-icon {
    flex-shrink: 0;
}

.ls-sender-badge {
    letter-spacing: -0.01em;
}

.ls-msg-time-dot {
    opacity: 0.45;
}

.ls-msg-time-text {
    font-size: 10.5px;
    font-weight: 500;
    opacity: 0.75;
}

/* ==================== تصميم فقاعات الرسائل ==================== */
.ls-msg-bubble,
.ls-bubble {
    padding: 12px 16px;
    font-size: 13.5px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
    max-width: 100%;
    box-sizing: border-box;
}

/* فقاعة رسائل المستخدم ("أنت") */
.ls-message-row.user .ls-msg-bubble,
.ls-message-row.user .ls-bubble,
.ls-message-row.ls-row-user .ls-msg-bubble,
.ls-message-row.ls-row-user .ls-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    border-radius: 18px 18px 4px 18px; /* زاوية مميزة في الأسفل لجهة المستخدم */
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

/* فقاعة رسائل فريق الدعم الفني */
.ls-message-row.admin .ls-msg-bubble,
.ls-message-row.admin .ls-bubble,
.ls-message-row.ls-row-admin .ls-msg-bubble,
.ls-message-row.ls-row-admin .ls-bubble {
    background: var(--ls-bubble-admin);
    color: #f8fafc;
    border-radius: 18px 18px 18px 4px; /* زاوية مميزة في الأسفل لجهة الدعم */
    border: 1px solid rgba(255, 255, 255, 0.11);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* تعديل الزوايا في LTR */
.ls-ltr .ls-message-row.user .ls-msg-bubble,
.ls-ltr .ls-message-row.user .ls-bubble,
.ls-ltr .ls-message-row.ls-row-user .ls-msg-bubble,
.ls-ltr .ls-message-row.ls-row-user .ls-bubble {
    border-radius: 18px 18px 18px 4px;
}

.ls-ltr .ls-message-row.admin .ls-msg-bubble,
.ls-ltr .ls-message-row.admin .ls-bubble,
.ls-ltr .ls-message-row.ls-row-admin .ls-msg-bubble,
.ls-ltr .ls-message-row.ls-row-admin .ls-bubble {
    border-radius: 18px 18px 4px 18px;
}

/* الصور المرفقة داخل الرسائل */
.ls-msg-image,
.ls-message-img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 14px;
    margin-top: 6px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
    display: block;
}

.ls-msg-image:hover,
.ls-message-img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* شارات المرسل الشفافة والمميزة */
.ls-badge-user {
    color: #a5b4fc;
    font-weight: 700;
}

.ls-badge-ai {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(99, 102, 241, 0.18) 100%);
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.35);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

.ls-badge-admin {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(5, 150, 105, 0.2) 100%);
    color: #34d399 !important;
    border: 1px solid rgba(16, 185, 129, 0.35);
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.15);
}

/* ==================== مؤشر الكتابة (Typing Indicator) ==================== */
.ls-typing-indicator {
    display: none;
    margin: 8px 0;
    animation: ls-msg-in 0.25s ease-out;
}

.ls-typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(26, 29, 48, 0.92);
    border: 1px solid rgba(56, 189, 248, 0.25);
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), 0 0 12px rgba(56, 189, 248, 0.12);
    font-size: 12px;
    color: #cbd5e1;
}

.ls-typing-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #38bdf8;
    animation: ls-pulse 1.8s infinite ease-in-out;
}

.ls-typing-text {
    font-weight: 600;
    font-size: 11.5px;
    color: #94a3b8;
}

.ls-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 2px;
}

.ls-typing-dots span {
    width: 4.5px;
    height: 4.5px;
    border-radius: 50%;
    background: #38bdf8;
    animation: ls-bounce 1.4s infinite ease-in-out both;
}

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

@keyframes ls-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==================== شريط الإدخال السفلي ==================== */
.ls-footer {
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(12, 14, 26, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
    flex-shrink: 0;
}

/* معاينة الصورة المرفقة قبل الإرسال */
.ls-preview-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    padding: 6px 10px;
    animation: ls-msg-in 0.2s ease-out;
}

.ls-preview-bar.active {
    display: flex;
}

.ls-preview-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ls-btn-remove-thumb {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    transition: all 0.2s;
}

.ls-btn-remove-thumb:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

/* الصندوق الموحد للإدخال والأزرار */
.ls-input-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 5px 8px 5px 6px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2) inset;
}

.ls-input-box:focus-within {
    border-color: #6366f1;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.ls-textarea {
    flex: 1;
    background: transparent;
    border: none;
    padding: 8px 10px;
    color: #ffffff;
    font-family: inherit;
    font-size: 13.5px;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 90px;
    box-sizing: border-box;
    line-height: 1.45;
    overflow-y: hidden;
}

.ls-textarea::placeholder {
    color: #64748b;
    font-size: 13px;
}

.ls-input-tools {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ls-btn-tool {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ls-btn-tool:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: scale(1.08);
}

.ls-btn-tool:active {
    transform: scale(0.95);
}

.ls-btn-send {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
    margin-right: 4px;
}

.ls-ltr .ls-btn-send {
    margin-right: 0;
    margin-left: 4px;
}

.ls-btn-send:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.65);
}

.ls-btn-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==================== لوحة الإيموجي ==================== */
.ls-emoji-panel {
    display: none;
    position: absolute;
    bottom: 68px;
    right: 14px;
    left: 14px;
    background: rgba(18, 21, 38, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 16px;
    padding: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
    z-index: 20;
    animation: ls-msg-in 0.2s ease-out;
}

.ls-emoji-panel.active {
    display: grid;
}

.ls-emoji-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px;
    padding: 4px;
    transition: all 0.15s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.ls-emoji-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: scale(1.2);
}

/* ==================== روابط داخل فقاعات الرسائل ==================== */
.ls-msg-bubble a {
    color: #c4b5fd;
    text-decoration: underline;
    text-underline-offset: 3px;
    word-break: break-all;
    transition: color 0.2s;
}

.ls-msg-bubble a:hover {
    color: #ffffff;
}

.ls-message-row.user .ls-msg-bubble a {
    color: #e0e7ff;
}

/* ==================== نافذة تكبير الصورة (Lightbox) ==================== */
.ls-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: zoom-out;
}

.ls-modal-overlay.active {
    display: flex;
    animation: ls-fade-down 0.25s ease-out;
}

.ls-modal-overlay img {
    max-width: 90vw;
    max-height: 88vh;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
    cursor: default;
}

.ls-modal-close-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #ffffff;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10002;
    outline: none;
}

.ls-modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.5);
    border-color: #ef4444;
    transform: scale(1.1);
}

/* زر كتم / تفعيل الصوت */
.ls-btn-sound {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ls-btn-sound:hover {
    background: rgba(99, 102, 241, 0.25);
    color: #ffffff;
    border-color: rgba(99, 102, 241, 0.45);
}

.ls-btn-sound.muted {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.12);
}

/* ==================== التوافق التام مع الهواتف والشاشات الصغيرة ==================== */
@media (max-width: 640px) {
    #live-support-window {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        transform: translateY(100%);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, visibility 0.25s ease;
    }

    #live-support-window.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    /* إخفاء الزر الدائري أثناء فتح الشات في الجوال لعدم تغطية الإدخال */
    #live-support-container.ls-ready #live-support-toggle.active,
    #live-support-container.ls-chat-open #live-support-toggle,
    #live-support-toggle.active {
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    #live-support-toggle {
        bottom: 18px;
        left: 18px;
        width: 56px;
        height: 56px;
    }

    .ls-ltr #live-support-toggle {
        left: auto;
        right: 18px;
    }

    .ls-header {
        padding: 14px 16px;
    }

    .ls-messages {
        padding: 14px 14px 24px;
        gap: 12px;
    }

    .ls-message-row {
        max-width: 90%;
    }

    .ls-footer {
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    }

    .ls-modal-close-btn {
        top: 16px;
        right: 16px;
    }
}

