/* ═══════════════════════════════════════════════════════════
   Woo Live Chat Widget — Production CSS
   RTL • Font inherit • No badge animation • Low paint cost
   ═══════════════════════════════════════════════════════════ */

/* ───────── Tokens ───────── */
:root {
    --wc-primary: #6366f1;
    --wc-primary-dark: #4f46e5;
    --wc-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --wc-bg: #f1f5f9;
    --wc-white: #ffffff;
    --wc-text: #1e293b;
    --wc-text-soft: #64748b;
    --wc-border: #e2e8f0;
    --wc-success: #059669;
    --wc-danger: #ef4444;
    --wc-visitor-bg: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    --wc-agent-bg: #ffffff;
    --wc-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    --wc-radius: 20px;
    --wc-z-btn: 2147483646;
    --wc-z-win: 2147483647;
}

/* ───────── Scoped reset (فونت از سایت) ───────── */
.woo-chat-btn,
.woo-chat-btn *,
.woo-chat-window,
.woo-chat-window * {
    box-sizing: border-box !important;
    /* ✅ فونت سایت — فقط fallback امن */
    font-family: inherit !important;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

/* اگر theme روی html/body فونت دارد، همین کافی است.
   اگر جایی inherit خراب شد، نزدیک‌ترین والد ویجت را درست کنید. */

/* ═══════════════════════════════════════
   Floating button — fixed + بدون انیمیشن بی‌نهایت
   ═══════════════════════════════════════ */
.woo-chat-btn {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: 60px !important;
    height: 60px !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    background: var(--wc-gradient) !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: var(--wc-z-btn) !important;
    /* فقط transition سبک — بدون float/pulse بی‌نهایت */
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    animation: none !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    contain: layout style;
}

.woo-chat-btn:hover {
    transform: scale(1.06) !important;
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.5) !important;
}

.woo-chat-btn:active {
    transform: scale(0.96) !important;
}

.woo-chat-btn:focus-visible {
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.3),
        0 8px 24px rgba(99, 102, 241, 0.4) !important;
}

/* Badge — بدون animation */
.woo-chat-badge {
    position: absolute !important;
    top: -4px !important;
    left: -4px !important;
    min-width: 20px !important;
    height: 20px !important;
    background: var(--wc-danger) !important;
    color: #fff !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    display: none; /* JS: flex وقتی unread > 0 */
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #fff !important;
    padding: 0 5px !important;
    line-height: 1 !important;
    animation: none !important;
    z-index: 2;
}

/* Icon swap */
.woo-chat-btn .wc-icon-close { display: none; }
.woo-chat-btn.is-open {
    animation: none !important;
    transform: none !important;
}
.woo-chat-btn.is-open .wc-icon-chat { display: none; }
.woo-chat-btn.is-open .wc-icon-close { display: block; }

/* ═══════════════════════════════════════
   Chat window
   ═══════════════════════════════════════ */
.woo-chat-window {
    position: fixed !important;
    bottom: 100px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: 380px !important;
    max-width: calc(100vw - 32px) !important;
    height: 580px !important;
    max-height: calc(100vh - 130px) !important;
    background: var(--wc-white) !important;
    border-radius: var(--wc-radius) !important;
    box-shadow: var(--wc-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: var(--wc-z-win) !important;
    direction: rtl !important;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
    /* paint isolation سبک */
    contain: layout style;
}

.woo-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ═══════════════════════════════════════
   Header
   ═══════════════════════════════════════ */
.woo-chat-header {
    background: var(--wc-gradient) !important;
    padding: 16px 18px !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-shrink: 0 !important;
    gap: 10px;
}

.woo-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.woo-chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    /* backdrop-filter حذف شد → سبک‌تر روی موبایل */
}

.woo-chat-header-text {
    min-width: 0;
}

.woo-chat-header-text h3 {
    font-size: 15px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    color: #fff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.woo-chat-header-text span {
    font-size: 12px !important;
    opacity: 0.92;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

/* نقطه وضعیت — بدون blink بی‌نهایت */
.woo-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.28);
    animation: none !important;
    flex-shrink: 0;
}

.woo-chat-header-actions {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    flex-shrink: 0;
}

.woo-chat-icon-btn,
.woo-chat-close {
    border: 0 !important;
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    transition: background 0.15s ease !important;
    line-height: 1 !important;
    padding: 0 !important;
}

.woo-chat-icon-btn:hover,
.woo-chat-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
}

.woo-chat-close {
    border-radius: 50% !important;
    font-size: 15px !important;
}

/* ═══════════════════════════════════════
   Body shell
   ═══════════════════════════════════════ */
.woo-chat-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--wc-bg) !important;
    min-height: 0;
    color: var(--wc-text);
}

.wc-loading,
.wc-error,
.wc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--wc-text-soft);
    font-size: 14px;
    padding: 28px 16px;
    text-align: center;
}

.wc-loading .wc-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--wc-border);
    border-top-color: var(--wc-primary);
    border-radius: 50%;
    animation: wc-spin 0.7s linear infinite;
}

@keyframes wc-spin {
    to { transform: rotate(360deg); }
}

.wc-error {
    color: var(--wc-danger);
}

/* ═══════════════════════════════════════
   Form
   ═══════════════════════════════════════ */
.woo-chat-form {
    padding: 22px 18px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    overflow-y: auto !important;
    flex: 1;
}

.wc-welcome-box {
    background: var(--wc-white);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
    border: 1px solid var(--wc-border);
}

.wc-welcome-box .wc-wave {
    font-size: 28px;
    margin-bottom: 8px;
}

.wc-welcome-box p {
    font-size: 14px !important;
    color: var(--wc-text) !important;
    line-height: 1.75 !important;
    margin: 0 !important;
}

.wc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wc-field label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--wc-text) !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wc-required { color: var(--wc-danger) !important; }
.wc-optional {
    font-size: 11px !important;
    font-weight: 400 !important;
    color: var(--wc-text-soft) !important;
}

.woo-chat-form input {
    width: 100% !important;
    padding: 12px 14px !important;
    border: 1.5px solid var(--wc-border) !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    outline: none !important;
    background: var(--wc-white) !important;
    color: var(--wc-text) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.woo-chat-form input::placeholder {
    color: #94a3b8 !important;
}

.woo-chat-form input:focus {
    border-color: var(--wc-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12) !important;
}

.woo-chat-form input[type="tel"],
.woo-chat-form input[type="email"] {
    direction: ltr !important;
    text-align: left !important;
}

.wc-btn-primary {
    width: 100% !important;
    padding: 13px 16px !important;
    border: none !important;
    border-radius: 12px !important;
    background: var(--wc-gradient) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    margin-top: 4px !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

.wc-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.38) !important;
}

.wc-btn-primary:active {
    transform: translateY(0);
}

.wc-error-text {
    color: var(--wc-danger) !important;
    font-size: 12px !important;
    text-align: center !important;
    min-height: 16px !important;
    margin-top: -4px;
}

/* ═══════════════════════════════════════════════════════════
   Woo Live Chat Widget — Production CSS
   RTL • Font inherit • No badge animation • Low paint cost
   ═══════════════════════════════════════════════════════════ */

/* ───────── Tokens ───────── */
:root {
    --wc-primary: #6366f1;
    --wc-primary-dark: #4f46e5;
    --wc-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --wc-bg: #f1f5f9;
    --wc-white: #ffffff;
    --wc-text: #1e293b;
    --wc-text-soft: #64748b;
    --wc-border: #e2e8f0;
    --wc-success: #059669;
    --wc-danger: #ef4444;
    --wc-visitor-bg: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    --wc-agent-bg: #ffffff;
    --wc-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
    --wc-radius: 20px;
    --wc-z-btn: 2147483646;
    --wc-z-win: 2147483647;
}

/* ───────── Scoped reset (فونت از سایت) ───────── */
.woo-chat-btn,
.woo-chat-btn *,
.woo-chat-window,
.woo-chat-window * {
    box-sizing: border-box !important;
    /* ✅ فونت سایت — فقط fallback امن */
    font-family: inherit !important;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-tap-highlight-color: transparent;
}

/* اگر theme روی html/body فونت دارد، همین کافی است.
   اگر جایی inherit خراب شد، نزدیک‌ترین والد ویجت را درست کنید. */

/* ═══════════════════════════════════════
   Floating button — fixed + بدون انیمیشن بی‌نهایت
   ═══════════════════════════════════════ */
.woo-chat-btn {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: 60px !important;
    height: 60px !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    background: var(--wc-gradient) !important;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: var(--wc-z-btn) !important;
    /* فقط transition سبک — بدون float/pulse بی‌نهایت */
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    animation: none !important;
    padding: 0 !important;
    margin: 0 !important;
    outline: none !important;
    contain: layout style;
}

.woo-chat-btn:hover {
    transform: scale(1.06) !important;
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.5) !important;
}

.woo-chat-btn:active {
    transform: scale(0.96) !important;
}

.woo-chat-btn:focus-visible {
    box-shadow:
        0 0 0 4px rgba(99, 102, 241, 0.3),
        0 8px 24px rgba(99, 102, 241, 0.4) !important;
}

/* Badge — بدون animation */
.woo-chat-badge {
    position: absolute !important;
    top: -4px !important;
    left: -4px !important;
    min-width: 20px !important;
    height: 20px !important;
    background: var(--wc-danger) !important;
    color: #fff !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    display: none; /* JS: flex وقتی unread > 0 */
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #fff !important;
    padding: 0 5px !important;
    line-height: 1 !important;
    animation: none !important;
    z-index: 2;
}

/* Icon swap */
.woo-chat-btn .wc-icon-close { display: none; }
.woo-chat-btn.is-open {
    animation: none !important;
    transform: none !important;
}
.woo-chat-btn.is-open .wc-icon-chat { display: none; }
.woo-chat-btn.is-open .wc-icon-close { display: block; }

/* ═══════════════════════════════════════
   Chat window
   ═══════════════════════════════════════ */
.woo-chat-window {
    position: fixed !important;
    bottom: 100px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: 380px !important;
    max-width: calc(100vw - 32px) !important;
    height: 580px !important;
    max-height: calc(100vh - 130px) !important;
    background: var(--wc-white) !important;
    border-radius: var(--wc-radius) !important;
    box-shadow: var(--wc-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: var(--wc-z-win) !important;
    direction: rtl !important;
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease !important;
    /* paint isolation سبک */
    contain: layout style;
}

.woo-chat-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ═══════════════════════════════════════
   Header
   ═══════════════════════════════════════ */
.woo-chat-header {
    background: var(--wc-gradient) !important;
    padding: 16px 18px !important;
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-shrink: 0 !important;
    gap: 10px;
}

.woo-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.woo-chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
    /* backdrop-filter حذف شد → سبک‌تر روی موبایل */
}

.woo-chat-header-text {
    min-width: 0;
}

.woo-chat-header-text h3 {
    font-size: 15px !important;
    font-weight: 700 !important;
    margin: 0 !important;
    color: #fff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.woo-chat-header-text span {
    font-size: 12px !important;
    opacity: 0.92;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

/* نقطه وضعیت — بدون blink بی‌نهایت */
.woo-chat-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.28);
    animation: none !important;
    flex-shrink: 0;
}

.woo-chat-header-actions {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    flex-shrink: 0;
}

.woo-chat-icon-btn,
.woo-chat-close {
    border: 0 !important;
    background: rgba(255, 255, 255, 0.16) !important;
    color: #fff !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 16px !important;
    transition: background 0.15s ease !important;
    line-height: 1 !important;
    padding: 0 !important;
}

.woo-chat-icon-btn:hover,
.woo-chat-close:hover {
    background: rgba(255, 255, 255, 0.28) !important;
}

.woo-chat-close {
    border-radius: 50% !important;
    font-size: 15px !important;
}

/* ═══════════════════════════════════════
   Body shell
   ═══════════════════════════════════════ */
.woo-chat-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--wc-bg) !important;
    min-height: 0;
    color: var(--wc-text);
}

.wc-loading,
.wc-error,
.wc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--wc-text-soft);
    font-size: 14px;
    padding: 28px 16px;
    text-align: center;
}

.wc-loading .wc-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--wc-border);
    border-top-color: var(--wc-primary);
    border-radius: 50%;
    animation: wc-spin 0.7s linear infinite;
}

@keyframes wc-spin {
    to { transform: rotate(360deg); }
}

.wc-error {
    color: var(--wc-danger);
}

/* ═══════════════════════════════════════
   Form
   ═══════════════════════════════════════ */
.woo-chat-form {
    padding: 22px 18px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    overflow-y: auto !important;
    flex: 1;
}

.wc-welcome-box {
    background: var(--wc-white);
    border-radius: 14px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
    border: 1px solid var(--wc-border);
}

.wc-welcome-box .wc-wave {
    font-size: 28px;
    margin-bottom: 8px;
}

.wc-welcome-box p {
    font-size: 14px !important;
    color: var(--wc-text) !important;
    line-height: 1.75 !important;
    margin: 0 !important;
}

.wc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wc-field label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--wc-text) !important;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wc-required { color: var(--wc-danger) !important; }
.wc-optional {
    font-size: 11px !important;
    font-weight: 400 !important;
    color: var(--wc-text-soft) !important;
}

.woo-chat-form input {
    width: 100% !important;
    padding: 12px 14px !important;
    border: 1.5px solid var(--wc-border) !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    outline: none !important;
    background: var(--wc-white) !important;
    color: var(--wc-text) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.woo-chat-form input::placeholder {
    color: #94a3b8 !important;
}

.woo-chat-form input:focus {
    border-color: var(--wc-primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12) !important;
}

.woo-chat-form input[type="tel"],
.woo-chat-form input[type="email"] {
    direction: ltr !important;
    text-align: left !important;
}

.wc-btn-primary {
    width: 100% !important;
    padding: 13px 16px !important;
    border: none !important;
    border-radius: 12px !important;
    background: var(--wc-gradient) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    margin-top: 4px !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

.wc-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.38) !important;
}

.wc-btn-primary:active {
    transform: translateY(0);
}

.wc-error-text {
    color: var(--wc-danger) !important;
    font-size: 12px !important;
    text-align: center !important;
    min-height: 16px !important;
    margin-top: -4px;
}

/* ═══════════════════════════════════════
   Departments + History
   ═══════════════════════════════════════ */
.woo-chat-departments,
.woo-chat-history {
    padding: 20px 16px !important;
    overflow-y: auto !important;
    flex: 1;
}

.wc-dept-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--wc-text) !important;
    margin-bottom: 6px !important;
    text-align: center;
}

.wc-dept-sub {
    font-size: 13px !important;
    color: var(--wc-text-soft) !important;
    margin-bottom: 16px !important;
    text-align: center;
    line-height: 1.7;
}

.wc-dept-list,
.wc-history-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.wc-dept-btn,
.wc-history-item {
    width: 100% !important;
    padding: 12px 14px !important;
    background: var(--wc-white) !important;
    border: 1.5px solid var(--wc-border) !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--wc-text) !important;
    cursor: pointer !important;
    text-align: right !important;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.wc-dept-btn:hover,
.wc-history-item:hover {
    border-color: var(--wc-primary) !important;
    background: #f8fafc !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1) !important;
}

.wc-dept-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    color: #fff;
}

.wc-dept-meta,
.wc-history-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    text-align: right;
}

.wc-dept-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--wc-text);
}

.wc-dept-preview,
.wc-history-preview {
    font-size: 11px;
    color: var(--wc-text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

.wc-dept-badge {
    font-size: 10px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
    font-weight: 700;
    flex-shrink: 0;
}

.wc-dept-arrow {
    color: var(--wc-text-soft);
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

.wc-history-title {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--wc-text);
}

.wc-history-title em {
    font-style: normal;
    font-size: 10px;
    color: var(--wc-text-soft);
    font-weight: 600;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 1px 7px;
}

.wc-status-open {
    color: var(--wc-success) !important;
    background: #d1fae5 !important;
}

.wc-status-closed {
    color: #6b7280 !important;
    background: #f3f4f6 !important;
}

.wc-history-time {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
}

.wc-link-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: #2563eb;
    padding: 12px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.wc-link-btn:hover {
    background: rgba(37, 99, 235, 0.06);
}

/* ═══════════════════════════════════════
   Messages — واضح و حرفه‌ای، بدون انیمیشن سنگین روی re-render
   ═══════════════════════════════════════ */
.woo-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    min-height: 0;
    background: var(--wc-bg);
}

.wc-msg {
    max-width: 82% !important;
    padding: 10px 14px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    line-height: 1.65 !important;
    word-wrap: break-word !important;
    overflow-wrap: anywhere !important;
    margin-bottom: 6px !important;
    position: relative !important;
    /* انیمیشن فقط برای پیام تازه (کلاس .wc-msg-new از JS) */
    animation: none !important;
}

.wc-msg.wc-msg-new {
    animation: wc-msg-in 0.22s ease !important;
}

@keyframes wc-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* visitor — RTL start */
.wc-msg-visitor {
    align-self: flex-start !important;
    background: var(--wc-visitor-bg) !important;
    color: #fff !important;
    border-bottom-right-radius: 5px !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.22);
}

/* agent — RTL end */
.wc-msg-agent {
    align-self: flex-end !important;
    background: var(--wc-agent-bg) !important;
    color: var(--wc-text) !important;
    border: 1px solid var(--wc-border) !important;
    border-bottom-left-radius: 5px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.wc-msg-system {
    align-self: center !important;
    background: #e0e7ff !important;
    color: #4338ca !important;
    font-size: 12px !important;
    text-align: center !important;
    max-width: 92% !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    box-shadow: none !important;
}

.wc-sender {
    display: block !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--wc-primary) !important;
    margin-bottom: 3px !important;
}

.wc-msg-text {
    display: block;
    white-space: pre-wrap;
}

.wc-msg-time {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: left;
    direction: ltr;
}

.wc-msg-visitor .wc-msg-time {
    color: rgba(255, 255, 255, 0.88);
    opacity: 0.95;
}

/* anti-dup send states */
.wc-msg-pending {
    opacity: 0.72 !important;
}

.wc-msg-pending::after {
    content: '…';
    margin-right: 4px;
    opacity: 0.8;
    font-size: 12px;
}

.wc-msg-error {
    outline: 1.5px solid var(--wc-danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
    cursor: pointer;
}

.wc-msg-error::before {
    content: '⚠ ارسال نشد — کلیک برای تلاش مجدد';
    display: block;
    font-size: 10px;
    margin-bottom: 4px;
    opacity: 0.95;
}

/* typing — فقط وقتی باز است و JS اضافه می‌کند */
.wc-typing {
    align-self: flex-end !important;
    background: var(--wc-white) !important;
    border: 1px solid var(--wc-border) !important;
    border-radius: 16px !important;
    padding: 12px 16px !important;
    display: flex;
    gap: 4px;
}

.wc-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: wc-typing 1.2s infinite;
}
.wc-typing span:nth-child(2) { animation-delay: 0.2s; }
.wc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wc-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ═══════════════════════════════════════
   Composer
   ═══════════════════════════════════════ */
.woo-chat-input {
    display: flex !important;
    gap: 8px !important;
    padding: 12px !important;
    border-top: 1px solid var(--wc-border) !important;
    background: var(--wc-white) !important;
    flex-shrink: 0 !important;
    align-items: flex-end !important;
}

.woo-chat-switch {
    border: 0 !important;
    background: #f3f4f6 !important;
    color: #475569 !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    flex: 0 0 auto !important;
    font-size: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s ease !important;
}

.woo-chat-switch:hover {
    background: #e2e8f0 !important;
}

.woo-chat-input textarea {
    flex: 1 !important;
    border: 1.5px solid var(--wc-border) !important;
    border-radius: 18px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    resize: none !important;
    outline: none !important;
    max-height: 100px !important;
    min-height: 40px !important;
    line-height: 1.5 !important;
    transition: border-color 0.15s ease, background 0.15s ease !important;
    color: var(--wc-text) !important;
    background: var(--wc-bg) !important;
    overflow-y: auto !important;
}

.woo-chat-input textarea::placeholder {
    color: #94a3b8 !important;
}

.woo-chat-input textarea:focus {
    border-color: var(--wc-primary) !important;
    background: var(--wc-white) !important;
}

.woo-chat-input button#wc-send {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    background: var(--wc-gradient) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    padding: 0 !important;
}

.woo-chat-input button#wc-send:hover {
    transform: scale(1.05);
}

.woo-chat-input button#wc-send:active {
    transform: scale(0.94);
}

.woo-chat-input button#wc-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.woo-chat-input button#wc-send svg {
    transform: scaleX(-1);
}

/* ═══════════════════════════════════════
   Scrollbars
   ═══════════════════════════════════════ */
.woo-chat-messages::-webkit-scrollbar,
.woo-chat-form::-webkit-scrollbar,
.woo-chat-departments::-webkit-scrollbar,
.woo-chat-history::-webkit-scrollbar {
    width: 6px;
}

.woo-chat-messages::-webkit-scrollbar-thumb,
.woo-chat-form::-webkit-scrollbar-thumb,
.woo-chat-departments::-webkit-scrollbar-thumb,
.woo-chat-history::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.woo-chat-messages::-webkit-scrollbar-track,
.woo-chat-form::-webkit-scrollbar-track,
.woo-chat-departments::-webkit-scrollbar-track,
.woo-chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.wc-powered {
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    padding: 6px;
    background: var(--wc-white);
    border-top: 1px solid var(--wc-border);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   Mobile full-screen
   ═══════════════════════════════════════ */
@media (max-width: 480px) {
    .woo-chat-window {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }

    .woo-chat-btn {
        bottom: 18px !important;
        right: 18px !important;
        width: 56px !important;
        height: 56px !important;
    }
}

/* Reduced motion — الزامی */
@media (prefers-reduced-motion: reduce) {
    .woo-chat-btn,
    .woo-chat-window,
    .wc-msg,
    .wc-msg.wc-msg-new,
    .wc-typing span,
    .wc-loading .wc-spinner {
        animation: none !important;
        transition: none !important;
    }
}

/* ═══════════════════════════════════════
   Departments + History
   ═══════════════════════════════════════ */
.woo-chat-departments,
.woo-chat-history {
    padding: 20px 16px !important;
    overflow-y: auto !important;
    flex: 1;
}

.wc-dept-title {
    font-size: 15px !important;
    font-weight: 700 !important;
    color: var(--wc-text) !important;
    margin-bottom: 6px !important;
    text-align: center;
}

.wc-dept-sub {
    font-size: 13px !important;
    color: var(--wc-text-soft) !important;
    margin-bottom: 16px !important;
    text-align: center;
    line-height: 1.7;
}

.wc-dept-list,
.wc-history-list {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.wc-dept-btn,
.wc-history-item {
    width: 100% !important;
    padding: 12px 14px !important;
    background: var(--wc-white) !important;
    border: 1.5px solid var(--wc-border) !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--wc-text) !important;
    cursor: pointer !important;
    text-align: right !important;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03);
}

.wc-dept-btn:hover,
.wc-history-item:hover {
    border-color: var(--wc-primary) !important;
    background: #f8fafc !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1) !important;
}

.wc-dept-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    color: #fff;
}

.wc-dept-meta,
.wc-history-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
    text-align: right;
}

.wc-dept-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--wc-text);
}

.wc-dept-preview,
.wc-history-preview {
    font-size: 11px;
    color: var(--wc-text-soft);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
}

.wc-dept-badge {
    font-size: 10px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 999px;
    padding: 3px 8px;
    white-space: nowrap;
    font-weight: 700;
    flex-shrink: 0;
}

.wc-dept-arrow {
    color: var(--wc-text-soft);
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1;
}

.wc-history-title {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--wc-text);
}

.wc-history-title em {
    font-style: normal;
    font-size: 10px;
    color: var(--wc-text-soft);
    font-weight: 600;
    background: #f1f5f9;
    border-radius: 999px;
    padding: 1px 7px;
}

.wc-status-open {
    color: var(--wc-success) !important;
    background: #d1fae5 !important;
}

.wc-status-closed {
    color: #6b7280 !important;
    background: #f3f4f6 !important;
}

.wc-history-time {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 400;
}

.wc-link-btn {
    width: 100%;
    border: 0;
    background: transparent;
    color: #2563eb;
    padding: 12px 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
    border-radius: 10px;
    transition: background 0.15s ease;
}

.wc-link-btn:hover {
    background: rgba(37, 99, 235, 0.06);
}

/* ═══════════════════════════════════════
   Messages — واضح و حرفه‌ای، بدون انیمیشن سنگین روی re-render
   ═══════════════════════════════════════ */
.woo-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 16px 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    min-height: 0;
    background: var(--wc-bg);
}

.wc-msg {
    max-width: 82% !important;
    padding: 10px 14px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    line-height: 1.65 !important;
    word-wrap: break-word !important;
    overflow-wrap: anywhere !important;
    margin-bottom: 6px !important;
    position: relative !important;
    /* انیمیشن فقط برای پیام تازه (کلاس .wc-msg-new از JS) */
    animation: none !important;
}

.wc-msg.wc-msg-new {
    animation: wc-msg-in 0.22s ease !important;
}

@keyframes wc-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* visitor — RTL start */
.wc-msg-visitor {
    align-self: flex-start !important;
    background: var(--wc-visitor-bg) !important;
    color: #fff !important;
    border-bottom-right-radius: 5px !important;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.22);
}

/* agent — RTL end */
.wc-msg-agent {
    align-self: flex-end !important;
    background: var(--wc-agent-bg) !important;
    color: var(--wc-text) !important;
    border: 1px solid var(--wc-border) !important;
    border-bottom-left-radius: 5px !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.wc-msg-system {
    align-self: center !important;
    background: #e0e7ff !important;
    color: #4338ca !important;
    font-size: 12px !important;
    text-align: center !important;
    max-width: 92% !important;
    border-radius: 10px !important;
    padding: 8px 12px !important;
    box-shadow: none !important;
}

.wc-sender {
    display: block !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--wc-primary) !important;
    margin-bottom: 3px !important;
}

.wc-msg-text {
    display: block;
    white-space: pre-wrap;
}

.wc-msg-time {
    display: block;
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: left;
    direction: ltr;
}

.wc-msg-visitor .wc-msg-time {
    color: rgba(255, 255, 255, 0.88);
    opacity: 0.95;
}

/* anti-dup send states */
.wc-msg-pending {
    opacity: 0.72 !important;
}

.wc-msg-pending::after {
    content: '…';
    margin-right: 4px;
    opacity: 0.8;
    font-size: 12px;
}

.wc-msg-error {
    outline: 1.5px solid var(--wc-danger) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
    cursor: pointer;
}

.wc-msg-error::before {
    content: '⚠ ارسال نشد — کلیک برای تلاش مجدد';
    display: block;
    font-size: 10px;
    margin-bottom: 4px;
    opacity: 0.95;
}

/* typing — فقط وقتی باز است و JS اضافه می‌کند */
.wc-typing {
    align-self: flex-end !important;
    background: var(--wc-white) !important;
    border: 1px solid var(--wc-border) !important;
    border-radius: 16px !important;
    padding: 12px 16px !important;
    display: flex;
    gap: 4px;
}

.wc-typing span {
    width: 7px;
    height: 7px;
    background: #94a3b8;
    border-radius: 50%;
    animation: wc-typing 1.2s infinite;
}
.wc-typing span:nth-child(2) { animation-delay: 0.2s; }
.wc-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wc-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* ═══════════════════════════════════════
   Composer
   ═══════════════════════════════════════ */
.woo-chat-input {
    display: flex !important;
    gap: 8px !important;
    padding: 12px !important;
    border-top: 1px solid var(--wc-border) !important;
    background: var(--wc-white) !important;
    flex-shrink: 0 !important;
    align-items: flex-end !important;
}

.woo-chat-switch {
    border: 0 !important;
    background: #f3f4f6 !important;
    color: #475569 !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    flex: 0 0 auto !important;
    font-size: 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.15s ease !important;
}

.woo-chat-switch:hover {
    background: #e2e8f0 !important;
}

.woo-chat-input textarea {
    flex: 1 !important;
    border: 1.5px solid var(--wc-border) !important;
    border-radius: 18px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    resize: none !important;
    outline: none !important;
    max-height: 100px !important;
    min-height: 40px !important;
    line-height: 1.5 !important;
    transition: border-color 0.15s ease, background 0.15s ease !important;
    color: var(--wc-text) !important;
    background: var(--wc-bg) !important;
    overflow-y: auto !important;
}

.woo-chat-input textarea::placeholder {
    color: #94a3b8 !important;
}

.woo-chat-input textarea:focus {
    border-color: var(--wc-primary) !important;
    background: var(--wc-white) !important;
}

.woo-chat-input button#wc-send {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    background: var(--wc-gradient) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
    padding: 0 !important;
}

.woo-chat-input button#wc-send:hover {
    transform: scale(1.05);
}

.woo-chat-input button#wc-send:active {
    transform: scale(0.94);
}

.woo-chat-input button#wc-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.woo-chat-input button#wc-send svg {
    transform: scaleX(-1);
}

/* ═══════════════════════════════════════
   Scrollbars
   ═══════════════════════════════════════ */
.woo-chat-messages::-webkit-scrollbar,
.woo-chat-form::-webkit-scrollbar,
.woo-chat-departments::-webkit-scrollbar,
.woo-chat-history::-webkit-scrollbar {
    width: 6px;
}

.woo-chat-messages::-webkit-scrollbar-thumb,
.woo-chat-form::-webkit-scrollbar-thumb,
.woo-chat-departments::-webkit-scrollbar-thumb,
.woo-chat-history::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.woo-chat-messages::-webkit-scrollbar-track,
.woo-chat-form::-webkit-scrollbar-track,
.woo-chat-departments::-webkit-scrollbar-track,
.woo-chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.wc-powered {
    text-align: center;
    font-size: 10px;
    color: #94a3b8;
    padding: 6px;
    background: var(--wc-white);
    border-top: 1px solid var(--wc-border);
    flex-shrink: 0;
}

/* ═══════════════════════════════════════
   Mobile full-screen
   ═══════════════════════════════════════ */
@media (max-width: 480px) {
    .woo-chat-home {
        padding: 18px 14px !important;
    }
}

@media (max-width: 480px) {
    .woo-chat-window {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
    }
    

    .woo-chat-btn {
        bottom: 18px !important;
        right: 18px !important;
        width: 56px !important;
        height: 56px !important;
    }
}

/* Reduced motion — الزامی */
@media (prefers-reduced-motion: reduce) {
    .woo-chat-btn,
    .woo-chat-window,
    .wc-msg,
    .wc-msg.wc-msg-new,
    .wc-typing span,
    .wc-loading .wc-spinner {
        animation: none !important;
        transition: none !important;
    }
}
/* ═══════════════════════════════════════
   Speed Dial Menu (منوی سریع شناور)
   ═══════════════════════════════════════ */
.woo-chat-dial {
    position: fixed !important;
    bottom: 96px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    z-index: var(--wc-z-btn) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    padding: 12px !important;
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(8px) !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12) !important;
    border: 1px solid rgba(226, 232, 240, 0.6) !important;
    direction: rtl !important;
    
    /* انیمیشن نرم و حرفه‌ای */
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
    contain: layout style;
}

.woo-chat-dial.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.wc-dial-item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 8px !important;
    border: none !important;
    background: transparent !important;
    cursor: pointer !important;
    text-decoration: none !important;
    border-radius: 12px !important;
    transition: background 0.15s ease !important;
    width: 100% !important;
    font-family: inherit !important;
}

.wc-dial-item:hover {
    background: rgba(99, 102, 241, 0.06) !important;
}

.wc-dial-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.wc-dial-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--wc-text);
    white-space: nowrap;
}

/*_RESPONSIVE*/
@media (max-width: 480px) {
    .woo-chat-dial {
        bottom: 86px !important;
        right: 18px !important;
    }
}