/* هستهٔ ظاهری ویجت آپلود؛ فقط هنگام فعال بودن ویجت روی صفحه اعمال می‌شود. */
:root {
    --upload-input-bg: var(--card-bg, #fff);
    --upload-input-text: var(--text, #243047);
    --upload-input-border: var(--border, #cbd5e1);
    --upload-button-bg: #eaf2ff;
    --upload-button-text: #1e40af;
    --upload-button-border: #b8cdf0;
    --upload-input-focus: rgba(37, 99, 235, .22);
}

html[data-theme="dark"] {
    --upload-input-bg: #101c2d;
    --upload-input-text: #e5edf8;
    --upload-input-border: #40536e;
    --upload-button-bg: #1b3152;
    --upload-button-text: #a9c9ff;
    --upload-button-border: #4a6b96;
    --upload-input-focus: rgba(96, 165, 250, .28);
}

html.upload-widget-file-style body input[type="file"] {
    display: block !important;
    visibility: visible !important;
    position: relative !important;
    z-index: 1;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 48px;
    margin: 0;
    padding: 6px !important;
    overflow: hidden;
    color: var(--upload-input-text) !important;
    background: var(--upload-input-bg) !important;
    border: 1px solid var(--upload-input-border) !important;
    border-radius: 10px !important;
    font: inherit !important;
    font-size: 13px !important;
    line-height: 1.6;
    cursor: pointer;
    opacity: 1 !important;
    pointer-events: auto !important;
    touch-action: manipulation;
}

html.upload-widget-file-style body input[type="file"]:focus {
    outline: 0 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px var(--upload-input-focus) !important;
}
html.upload-widget-file-style body input[type="file"]:focus-visible {
    outline: 0 !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px var(--upload-input-focus) !important;
}

html.upload-widget-file-style body input[type="file"]::-webkit-file-upload-button {
    min-height: 34px !important;
    margin: 0 0 0 9px !important;
    padding: 6px 12px !important;
    color: var(--upload-button-text) !important;
    background: var(--upload-button-bg) !important;
    border: 1px solid var(--upload-button-border) !important;
    border-radius: 8px !important;
    font: inherit !important;
    font-weight: 800 !important;
    cursor: pointer !important;
}
html.upload-widget-file-style body input[type="file"]::file-selector-button {
    min-height: 34px !important;
    margin: 0 0 0 9px !important;
    padding: 6px 12px !important;
    color: var(--upload-button-text) !important;
    background: var(--upload-button-bg) !important;
    border: 1px solid var(--upload-button-border) !important;
    border-radius: 8px !important;
    font: inherit !important;
    font-weight: 800 !important;
    cursor: pointer !important;
}

html.upload-widget-file-style body input[type="file"]:disabled { opacity: .55 !important; cursor: not-allowed; }

/* حالت پایه هنگام غیرفعال‌کردن ویجت در پنل ادمین؛ انتخاب فایل مرورگر باقی می‌ماند. */
html.upload-widget-basic-file-style body input[type="file"] {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: inherit !important;
    font: inherit !important;
}
html.upload-widget-basic-file-style body input[type="file"]::-webkit-file-upload-button {
    appearance: auto !important;
    -webkit-appearance: push-button !important;
    margin: 0 0 0 6px !important;
    padding: 2px 6px !important;
    border-radius: 2px !important;
    font: menu !important;
}
html.upload-widget-basic-file-style body input[type="file"]::file-selector-button {
    appearance: auto !important;
    -webkit-appearance: push-button !important;
    margin: 0 0 0 6px !important;
    padding: 2px 6px !important;
    border-radius: 2px !important;
    font: menu !important;
}

#uploadWidgetTray { position:fixed; left:50%; bottom:18px; transform:translateX(-50%); z-index:2147483000; display:flex; flex-direction:column; gap:7px; width:92vw; max-width:390px; width:min(92vw,390px); direction:rtl; font-family:Vazirmatn,Tahoma,sans-serif; pointer-events:none; }
.uw-item { display:grid; grid-template-columns:1fr auto; gap:5px 10px; align-items:center; padding:10px 12px; border:1px solid rgba(148,163,184,.45); border-radius:13px; background:rgba(15,23,42,.96); color:#fff; box-shadow:0 9px 30px rgba(15,23,42,.3); pointer-events:auto; }
.uw-item.uw-no-cancel { grid-template-columns:1fr; }
.uw-copy { min-width:0; }
.uw-copy b,.uw-copy small { display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.uw-copy b { font-size:11.5px; }
.uw-copy small { margin-top:2px; color:#cbd5e1; font-size:9.5px; }
.uw-counter { display:inline-block; margin-top:3px; padding:1px 9px; border-radius:20px; background:rgba(52,211,153,.18); border:1px solid rgba(52,211,153,.45); color:#6ee7b7; font:800 9.5px inherit; font-style:normal; letter-spacing:.2px; }
.uw-counter[hidden] { display:none!important; }
.uw-item.uw-failed .uw-counter { background:rgba(248,113,113,.18); border-color:rgba(248,113,113,.5); color:#fecaca; }
.uw-cancel { width:auto!important; margin:0!important; border:1px solid #fca5a5!important; border-radius:9px!important; background:#7f1d1d!important; color:#fff!important; padding:7px 10px!important; font:800 10px inherit!important; cursor:pointer; }
.uw-cancel:disabled { opacity:.55; cursor:default; }
.uw-progress { grid-column:1/-1; height:4px; border-radius:6px; background:#334155; overflow:hidden; }
.uw-progress span { display:block; width:4%; height:100%; border-radius:inherit; background:#34d399; transition:width .12s; }
.uw-item.uw-failed .uw-progress span { background:#f87171; }
.uw-item.uw-indeterminate .uw-progress span { width:35%; animation:uw-indeterminate 1.1s ease-in-out infinite; }
@keyframes uw-indeterminate { 0%{transform:translateX(210%)} 100%{transform:translateX(-310%)} }

@media (max-width:480px) {
    html.upload-widget-file-style body input[type="file"] { min-height:46px; font-size:12px!important; }
}

.uw-shared-preview{display:flex;align-items:center;gap:10px;flex-wrap:wrap;width:100%;box-sizing:border-box;margin-top:9px;padding:9px 12px;border:1px solid #bbf7d0;border-radius:10px;background:var(--success-soft,#ecfdf5);color:var(--success,#087f5b);font-size:12px;font-weight:750}
.uw-shared-preview[hidden],.uw-shared-preview-media[hidden]{display:none!important}
.uw-shared-preview-status{display:inline-flex;align-items:center;gap:6px}
.uw-shared-preview-media img{display:block;max-width:150px;max-height:90px;object-fit:contain;border:1px solid #bbf7d0;border-radius:8px;background:#fff}
.uw-shared-preview-actions{display:flex;align-items:center;gap:7px;margin-right:auto;flex-wrap:wrap}
.uw-shared-preview-actions:empty{display:none}
html[data-theme="dark"] .uw-shared-preview{background:#173b32;border-color:#28604f;color:#9be4c9}

/* دکمه مشترک «حذف و آپلود دوباره» داخل جعبه پیش‌نمایش — توسط خود ویجت ساخته می‌شود. */
.uw-preview-discard{display:inline-flex;align-items:center;gap:6px;background:#fef2f2;color:#b91c1c;border:1px solid #fecaca;border-radius:8px;padding:6px 12px;font-family:inherit;font-size:12px;font-weight:700;cursor:pointer}
.uw-preview-discard:hover{background:#fee2e2}
.uw-preview-discard:disabled{opacity:.55;cursor:not-allowed}
html[data-theme="dark"] .uw-preview-discard{background:#42212b;color:#ffb5c0;border-color:#713647}
html[data-theme="dark"] .uw-preview-discard:hover{background:#55293a}

/* دکمه تأیید نهایی در همان نوار سبز پیش‌نمایش قرار می‌گیرد. */
.uw-preview-send{display:inline-flex;align-items:center;gap:6px;background:#15803d;color:#fff;border:1px solid #166534;border-radius:8px;padding:6px 14px;font-family:inherit;font-size:12px;font-weight:800;cursor:pointer}
.uw-preview-send:hover{background:#166534}
.uw-preview-send:disabled{opacity:.55;cursor:not-allowed}
html[data-theme="dark"] .uw-preview-send{background:#1f7a4d;color:#fff;border-color:#55b987}
html[data-theme="dark"] .uw-preview-send:hover{background:#17613d}

/* دکمه قدیمی صفحه فقط وقتی روال ویجت جای آن را گرفته مخفی می‌شود. */
html.upload-widget-enabled [data-upload-page-submit],
[data-upload-page-submit][data-upload-widget-hidden="1"]{display:none!important}
html.upload-widget-enabled [data-upload-fallback-discard]{display:none!important}

/* راهنمای «مرورگر داخلی پیام‌رسان» هنگام زدن دکمهٔ انتخاب فایل (ایتا، روبیکا، تلگرام و…) */
#uwInAppNotice.uw-inapp-notice{position:fixed;left:0;right:0;bottom:0;z-index:2147483001;display:flex;justify-content:center;padding:0 12px 12px;padding-bottom:calc(12px + env(safe-area-inset-bottom,0px));direction:rtl;font-family:Vazirmatn,Tahoma,sans-serif;pointer-events:none;box-sizing:border-box}
#uwInAppNotice .uw-inapp-card{position:relative;pointer-events:auto;width:100%;max-width:440px;max-height:calc(100vh - 24px);overflow-y:auto;-webkit-overflow-scrolling:touch;box-sizing:border-box;background:#fff;color:#1e293b;border:1px solid #fcd34d;border-top:4px solid #f59e0b;border-radius:16px;box-shadow:0 12px 36px rgba(15,23,42,.28);padding:14px 14px 12px;text-align:right;line-height:1.8}
#uwInAppNotice .uw-inapp-title{display:block;font-size:14px;font-weight:800;color:#92400e;padding-left:30px;margin:0 0 6px}
#uwInAppNotice .uw-inapp-title i{margin-left:5px;color:#f59e0b}
#uwInAppNotice .uw-inapp-text{margin:0 0 4px;font-size:13px;color:#1e293b}
#uwInAppNotice .uw-inapp-steps{margin:0 0 8px;padding:0 20px 0 0;font-size:12.5px;color:#334155}
#uwInAppNotice .uw-inapp-steps li{margin:0}
#uwInAppNotice .uw-inapp-address{display:block;width:100%;max-width:none;height:auto;box-sizing:border-box;margin:0 0 10px;padding:9px 10px;font:600 13px/1.5 Tahoma,Arial,sans-serif;direction:ltr;text-align:left;color:#0f172a;background:#f8fafc;border:1px dashed #94a3b8;border-radius:10px;box-shadow:none;-webkit-user-select:all;user-select:all}
#uwInAppNotice .uw-inapp-actions{display:flex;flex-wrap:wrap;gap:8px}
#uwInAppNotice .uw-inapp-copy,#uwInAppNotice .uw-inapp-dismiss{display:inline-flex;align-items:center;justify-content:center;gap:6px;width:auto;min-height:42px;margin:0;border-radius:10px;padding:8px 14px;font-family:inherit;font-size:13px;font-weight:800;line-height:1.5;cursor:pointer;box-shadow:none}
#uwInAppNotice .uw-inapp-copy{flex:1 1 200px;background:#15803d;color:#fff;border:1px solid #166534}
#uwInAppNotice .uw-inapp-copy[data-copied="1"]{background:#166534}
#uwInAppNotice .uw-inapp-open{display:flex;flex-direction:column;gap:8px;margin:8px 0 10px}
#uwInAppNotice .uw-inapp-chrome,#uwInAppNotice .uw-inapp-other{display:flex;align-items:center;justify-content:center;gap:7px;width:100%;min-height:44px;margin:0;border-radius:10px;padding:9px 12px;font:800 13.5px/1.5 inherit;font-family:inherit;cursor:pointer;box-sizing:border-box}
#uwInAppNotice .uw-inapp-chrome{background:#1d4ed8;color:#fff;border:1px solid #1e40af}
#uwInAppNotice .uw-inapp-other{background:#fff;color:#1d4ed8;border:1px solid #93c5fd}
#uwInAppNotice [data-uw-inapp-open][data-failed="1"]{background:#fff7ed;color:#9a3412;border-color:#fdba74;font-weight:700}
#uwInAppNotice .uw-inapp-or{margin:0 0 4px;font-size:12px;font-weight:700;color:#64748b}
#uwInAppNotice .uw-inapp-dismiss{flex:0 0 auto;background:#f1f5f9;color:#334155;border:1px solid #cbd5e1}
#uwInAppNotice .uw-inapp-close{position:absolute;top:8px;left:8px;width:30px;height:30px;min-height:0;margin:0;padding:0;border:0;border-radius:50%;background:#f1f5f9;color:#475569;font:400 20px/30px Tahoma,Arial,sans-serif;text-align:center;cursor:pointer;box-shadow:none}
