/* --- ويدجت الشات (بنفس شكل Wix: مربع، بنفسجي #645dc0) --- */
.chat-minimized-wrapper {
    display: flex;
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: auto;
    z-index: 999;
}

.chat-widget-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgb(255, 255, 255);
    background-color: rgb(100, 93, 192);
    border: none;
    border-radius: 0;
    font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    cursor: pointer;
    transition: opacity 0.2s, background-color 0.2s;
}
.chat-widget-trigger:hover {
    background-color: rgb(88, 81, 172);
    opacity: 0.95;
}

.chat-trigger-icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    fill: rgb(255, 255, 255);
}

.chat-trigger-text {
    margin: 0;
    font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 1rem;
    white-space: nowrap;
    color: #ffffff;
}

.chat-widget-panel {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: auto;
    z-index: 1000;
    width: 300px;
    max-width: calc(100vw - 24px);
    height: 420px;
    max-height: 85vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}
.chat-widget-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.chat-widget-panel.is-open[hidden] {
    display: flex !important;
}
.chat-panel-inner {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.chat-drag-handle {
    flex-shrink: 0;
    padding: 6px 0;
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}
.chat-drag-handle:active { cursor: grabbing; }
.chat-drag-handle:hover { background: #f0f0f0; }
.chat-drag-bar {
    width: 36px;
    height: 4px;
    background: #ccc;
    border-radius: 2px;
    transition: background 0.2s;
}
.chat-drag-handle:hover .chat-drag-bar { background: #999; }

.chat-panel-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #fff;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}
.chat-panel-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}
.chat-panel-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #14BF8A 0%, #0ea872 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}
.chat-panel-title { font-size: 0.9rem; color: #1a1a1a; margin: 0; }
.chat-panel-status {
    margin: 1px 0 0 0;
    font-size: 0.7rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-panel-email-line {
    margin: 1px 0 0 0;
    font-size: 0.65rem;
    color: #888;
}
.chat-panel-logo-cf { background: #5b9bd5 !important; }
.chat-status-dot {
    width: 6px;
    height: 6px;
    background: #14BF8A;
    border-radius: 50%;
    flex-shrink: 0;
}
.chat-panel-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}
.chat-panel-close:hover {
    background: #f0f0f0;
    color: #333;
}

.chat-messages-list {
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-msg-user {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
}
.chat-msg-user .chat-msg-bubble-user {
    background: rgb(100, 93, 192);
    color: rgb(255,255,255);
    padding: 10px 14px;
    border-radius: 0;
    max-width: 85%;
    font-size: 0.85rem;
    line-height: 1.45;
}
.chat-msg-reply {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.chat-msg-reply .chat-msg-bubble-reply {
    background: rgb(255,255,255);
    color: rgb(24,24,24);
    padding: 10px 14px;
    border-radius: 0;
    max-width: 85%;
    font-size: 0.85rem;
    line-height: 1.45;
    border: 1px solid rgb(243,243,243);
}
.chat-widget-wrap[dir="rtl"] .chat-msg-user { justify-content: flex-start; }
.chat-widget-wrap[dir="rtl"] .chat-msg-reply { flex-direction: row-reverse; }

.chat-welcome {
    padding: 8px 12px;
    flex-shrink: 0;
}
.chat-msg {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}
.chat-msg-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.chat-msg-author-name {
    font-size: 0.7rem;
    color: #888;
    max-width: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chat-msg-avatar {
    width: 28px;
    height: 28px;
    background: #5b9bd5;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
}
.chat-msg-avatar-cf { background: #5b9bd5; }
.chat-msg-avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}
.chat-bubble-wrapper { margin: 0; }
.chat-msg-bubble {
    background: #f0f0f0;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 85%;
}
.chat-msg-bubble-cf {
    background: rgb(255,255,255) !important;
    color: rgb(24,24,24) !important;
    border-radius: 0 !important;
    min-width: 50px;
    max-width: 240px;
    padding: 12px 14px;
}
.chat-bubble-content {
    font-size: 0.8rem;
    line-height: 1.45;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    white-space: pre-line;
}
.chat-msg-bubble p { margin: 0 0 4px 0; font-size: 0.8rem; }
.chat-msg-bubble p:last-child { margin-bottom: 0; }

.chat-form-bubble-wrap { padding: 0 12px 10px; }
.chat-form-bubble { padding: 10px; }
.chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-form-row { width: 100%; }
.chat-form-row._8nBAF label {
    display: block;
    font-size: 0.7rem;
    color: rgb(24,24,24);
    margin-bottom: 2px;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
}
.chat-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 0;
    font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}
.chat-input-cf {
    background: rgb(255,255,255) !important;
    color: rgb(24,24,24) !important;
    box-shadow: none !important;
    border-radius: 0;
}
.chat-input:focus {
    outline: none;
    border-color: #999;
}
.chat-input-message { resize: vertical; min-height: 36px; }
.chat-submit-btn {
    width: 100%;
    padding: 8px;
    border: none;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.2s;
}
.chat-submit-cf {
    background-color: rgb(24,24,24) !important;
    color: rgb(255,255,255) !important;
    border-radius: 0 !important;
}
.chat-submit-btn:hover { opacity: 0.9; }

.chat-quick-input {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 10px;
    border-top: 1px solid #eee;
    background: #fafafa;
    flex-shrink: 0;
}
.chat-quick-input-sticky { flex-shrink: 0; }
.chat-quick-field {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-family: "Open Sans", Helvetica, Arial, sans-serif;
    font-size: 0.8rem;
    min-width: 0;
}
.chat-quick-attach,
.chat-quick-send {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 0.95rem;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.chat-quick-attach:hover,
.chat-quick-send:hover { color: #14BF8A; }
.chat-quick-send { text-decoration: none; color: #666; }

.chat-wa-link { color: #25D366; font-weight: 600; text-decoration: none; }
.chat-wa-link:hover { text-decoration: underline; }

.chat-file-input { position: absolute; width: 0; height: 0; opacity: 0; overflow: hidden; }
.chat-attachment-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f0f8ff;
    border-radius: 8px;
    font-size: 0.85rem;
}
.chat-attachment-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attachment-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: #ddd;
    color: #333;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}
.chat-attachment-remove:hover { background: #ccc; }

/* RTL — محتوى الرسائل حسب لغة الواجهة؛ أزرار العائم ثابتة اليسار */
.chat-widget-wrap[dir="rtl"] .chat-msg { flex-direction: row-reverse; }
.chat-widget-wrap[dir="rtl"] .chat-msg-bubble,
.chat-widget-wrap[dir="rtl"] .chat-msg-bubble-cf,
.chat-widget-wrap[dir="rtl"] .chat-bubble-content { text-align: right; }