/* BotPanel — استایل اختصاصی روی Unfold. فونت وزیرمتن (OFL) به‌صورت محلی. */
@font-face {
  font-family: "Vazirmatn";
  src: url("fonts/Vazirmatn-wght.woff2") format("woff2-variations"), url("fonts/Vazirmatn-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
html[dir="rtl"] body, html[dir="rtl"] input, html[dir="rtl"] select, html[dir="rtl"] textarea, html[dir="rtl"] button,
.bp-root, .bp-root * {
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
}
.material-symbols-outlined { font-family: "Material Symbols Outlined" !important; }

:root {
  --bp-bg: #fff; --bp-soft: #f8fafc; --bp-border: #e5e7eb; --bp-text: #1f2937; --bp-muted: #6b7280;
  --bp-primary: #0f766e; --bp-primary-soft: #ccfbf1; --bp-ok: #15803d; --bp-ok-soft: #dcfce7;
  --bp-bad: #b91c1c; --bp-bad-soft: #fee2e2; --bp-warn: #b45309; --bp-warn-soft: #fef3c7; --bp-info: #1d4ed8; --bp-info-soft: #dbeafe;
}
html.dark {
  --bp-bg: #111827; --bp-soft: #1f2937; --bp-border: #374151; --bp-text: #e5e7eb; --bp-muted: #9ca3af;
  --bp-primary: #2dd4bf; --bp-primary-soft: #134e4a; --bp-ok: #4ade80; --bp-ok-soft: #14532d;
  --bp-bad: #f87171; --bp-bad-soft: #450a0a; --bp-warn: #fbbf24; --bp-warn-soft: #451a03; --bp-info: #93c5fd; --bp-info-soft: #1e3a8a;
}

.bp-root { color: var(--bp-text); }
.bp-grid { display: grid; gap: 14px; }
.bp-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.bp-two { grid-template-columns: 1fr; }
@media (min-width: 1100px) { .bp-two { grid-template-columns: 1.4fr 1fr; } }
.bp-card { background: var(--bp-bg); border: 1px solid var(--bp-border); border-radius: 14px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); min-width: 0; }
.bp-card h2, .bp-card h3 { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 6px; }
.bp-tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.bp-tile .bp-num { font-size: 28px; font-weight: 800; line-height: 1.2; }
.bp-tile .bp-lbl { color: var(--bp-muted); font-size: 13px; }
.bp-tile.ok .bp-num { color: var(--bp-ok); } .bp-tile.bad .bp-num { color: var(--bp-bad); }
.bp-tile.warn .bp-num { color: var(--bp-warn); } .bp-tile.info .bp-num { color: var(--bp-info); }
.bp-tile.warn.pulse { animation: bp-pulse 1.5s infinite; }
@keyframes bp-pulse { 50% { box-shadow: 0 0 0 4px var(--bp-warn-soft); } }

.bp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bp-table th, .bp-table td { padding: 8px 6px; border-bottom: 1px solid var(--bp-border); text-align: start; white-space: nowrap; }
.bp-table th { color: var(--bp-muted); font-weight: 600; }
.bp-table a { color: var(--bp-primary); text-decoration: none; }

.bp-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.bp-badge.success { background: var(--bp-ok-soft); color: var(--bp-ok); }
.bp-badge.failed { background: var(--bp-bad-soft); color: var(--bp-bad); }
.bp-badge.captcha_wait { background: var(--bp-warn-soft); color: var(--bp-warn); }
.bp-badge.running { background: var(--bp-info-soft); color: var(--bp-info); }
.bp-badge.pending, .bp-badge.cancelled { background: var(--bp-soft); color: var(--bp-muted); }

.bp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--bp-primary); color: #fff !important; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; }
html.dark .bp-btn { color: #042f2e !important; }
.bp-btn.secondary { background: transparent; border-color: var(--bp-border); color: var(--bp-text) !important; }
.bp-btn.danger { background: var(--bp-bad); color: #fff !important; }
.bp-btn:disabled { opacity: .5; cursor: wait; }
.bp-muted { color: var(--bp-muted); font-size: 13px; }
.bp-empty { color: var(--bp-muted); padding: 12px 0; text-align: center; }
.bp-input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bp-border); background: var(--bp-bg); color: var(--bp-text); font-size: 16px; }
.bp-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Captcha cards */
.bp-captcha { display: flex; flex-direction: column; gap: 10px; }
.bp-captcha img { max-width: 100%; height: auto; image-rendering: pixelated; border: 1px solid var(--bp-border); border-radius: 8px; background: #fff; min-height: 50px; }
.bp-captcha-list { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Live view */
.bp-live { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 1100px) { .bp-live { grid-template-columns: 2fr 1fr; } }
.bp-screen { width: 100%; border-radius: 10px; border: 1px solid var(--bp-border); background: var(--bp-soft); min-height: 200px; }
.bp-log { background: #0b1220; color: #d1fae5; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; direction: ltr; text-align: left;
  padding: 10px; border-radius: 10px; max-height: 420px; overflow: auto; white-space: pre-wrap; unicode-bidi: plaintext; }
.bp-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.bp-thumbs img { height: 64px; border-radius: 6px; border: 1px solid var(--bp-border); cursor: pointer; }

/* Auth pages */
.bp-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--bp-soft); }
.bp-auth .bp-card { width: 100%; max-width: 440px; padding: 24px; }
.bp-auth h1 { font-size: 20px; margin: 0 0 6px; }
.bp-auth .bp-icon { font-size: 52px; display: block; text-align: center; margin-bottom: 8px; }
.bp-msg { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-size: 14px; }
.bp-msg.error { background: var(--bp-bad-soft); color: var(--bp-bad); }
.bp-msg.success { background: var(--bp-ok-soft); color: var(--bp-ok); }
.bp-msg.warning { background: var(--bp-warn-soft); color: var(--bp-warn); }
.bp-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; direction: ltr; font-family: ui-monospace, monospace; font-size: 15px; }
.bp-codes span { background: var(--bp-soft); padding: 6px; border-radius: 6px; text-align: center; }
.bp-auth form p { margin: 0 0 12px; }
.bp-auth form label { display: block; margin-bottom: 4px; font-size: 13px; }
.bp-auth form input[type=password], .bp-auth form input[type=text] { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--bp-border); background: var(--bp-bg); color: var(--bp-text); font-size: 16px; }
.bp-auth .helptext, .bp-auth ul.errorlist { font-size: 12px; color: var(--bp-muted); }
.bp-auth ul.errorlist { color: var(--bp-bad); }
details.bp-alt { margin-top: 16px; border-top: 1px solid var(--bp-border); padding-top: 12px; }

/* ---------- نمایش زنده: نمایشگر ---------- */
.lv-root { display: flex; flex-direction: column; gap: 6px; height: 100%; min-height: 0; }
.lv-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lv-step { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.lv-url { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
.lv-stage { position: relative; flex: 1; min-height: 120px; background: var(--bp-soft); border: 1px solid var(--bp-border); border-radius: 10px; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.lv-img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.lv-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lv-controls .bp-btn { padding: 5px 10px; font-size: 13px; }
.lv-ctl-tools { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lv-steps { font-size: 11px; max-height: 120px; overflow: auto; margin: 0; padding-inline-start: 18px; text-align: left; }
.lv-msg.bp-msg { margin: 4px 0; padding: 6px 10px; }

/* ---------- نمایش زنده: دکمه و پنجره شناور ---------- */
.bp-live-btn { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--bp-border); background: var(--bp-bg); color: var(--bp-text);
  border-radius: 999px; padding: 4px 10px; font-size: 13px; cursor: pointer; font-family: inherit; margin-inline-start: 8px; white-space: nowrap; }
.bp-live-btn.fab { position: fixed; bottom: 16px; left: 16px; z-index: 9998; box-shadow: 0 4px 14px rgba(0,0,0,.18); padding: 10px 14px; }
.bp-live-btn.active { border-color: var(--bp-bad); color: var(--bp-bad); }
.bp-live-btn.active .material-symbols-outlined { animation: bp-blink 1.2s infinite; }
@keyframes bp-blink { 50% { opacity: .35; } }
.bp-live-count { background: var(--bp-bad); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
@media (max-width: 700px) { .bp-live-btn .bp-live-btn-txt { display: none; } }
.bp-live-win { position: fixed; z-index: 9999; background: var(--bp-bg); border: 1px solid var(--bp-border); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden; min-width: 260px; }
.bp-live-win.sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100% !important; border-radius: 16px 16px 0 0; }
.bp-live-win.min .bp-live-body, .bp-live-win.min .bp-live-resize { display: none; }
.bp-live-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--bp-border); cursor: move; touch-action: none; background: var(--bp-soft); }
.bp-live-win.sheet .bp-live-head { cursor: default; }
.bp-live-select { max-width: 55%; font-size: 12px; padding: 3px 6px; border-radius: 8px; border: 1px solid var(--bp-border); background: var(--bp-bg); color: var(--bp-text); }
.bp-live-ico { border: 0; background: transparent; color: var(--bp-muted); cursor: pointer; padding: 2px; display: inline-flex; }
.bp-live-ico .material-symbols-outlined { font-size: 20px; }
.bp-live-body { flex: 1; padding: 8px; min-height: 0; overflow: auto; }
.bp-live-resize { position: absolute; bottom: 0; left: 0; width: 22px; height: 22px; cursor: nesw-resize; touch-action: none;
  background: linear-gradient(225deg, transparent 50%, var(--bp-border) 50%); }
html[dir="ltr"] .bp-live-resize { left: auto; right: 0; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, var(--bp-border) 50%); }
.bp-chart { position: relative; height: 260px; }
