/* ============================================================
   AdminSettingsModule CSS — هم‌شکل با بقیه‌ی ماژول‌ها.
   همه‌چیز زیر .adminsettings-module اسکوپ شده، متغیرها با پیشوند asm- نام‌گذاری شده‌اند.
   ============================================================ */

.adminsettings-module {
  --asm-c-bg: #f5f5f3;
  --asm-c-surface: #ffffff;
  --asm-c-border: rgba(0,0,0,0.08);
  --asm-c-border-strong: rgba(0,0,0,0.14);
  --asm-c-text: #1a1a18;
  --asm-c-text-2: #5a5a56;
  --asm-c-text-3: #9a9994;
  --asm-c-accent: #2563eb;
  --asm-c-accent-bg: #eff6ff;
  --asm-c-accent-text: #1d4ed8;
  --asm-c-accent-border: #bfdbfe;
  --asm-c-success: #16a34a;
  --asm-c-success-bg: #f0fdf4;
  --asm-c-success-text: #15803d;
  --asm-c-success-border: #bbf7d0;
  --asm-c-warning: #d97706;
  --asm-c-warning-bg: #fffbeb;
  --asm-c-warning-text: #b45309;
  --asm-c-warning-border: #fde68a;
  --asm-c-danger: #dc2626;
  --asm-c-danger-bg: #fef2f2;
  --asm-c-danger-text: #b91c1c;
  --asm-c-danger-border: #fecaca;
  --asm-radius-sm: 6px;
  --asm-radius: 10px;
  --asm-radius-lg: 14px;
  --asm-transition: 0.15s ease;

  font-family: 'Vazirmatn', system-ui, sans-serif;
  color: var(--asm-c-text);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

[data-theme="dark"] .adminsettings-module {
  --asm-c-bg: #15161a;
  --asm-c-surface: #1c1d22;
  --asm-c-border: rgba(255,255,255,0.08);
  --asm-c-border-strong: rgba(255,255,255,0.14);
  --asm-c-text: #f1f1ef;
  --asm-c-text-2: #b3b3ad;
  --asm-c-text-3: #76766f;
  --asm-c-accent-bg: rgba(37,99,235,0.14);
  --asm-c-success-bg: rgba(22,163,74,0.14);
  --asm-c-warning-bg: rgba(217,119,6,0.14);
  --asm-c-danger-bg: rgba(220,38,38,0.14);
}

.adminsettings-module * { box-sizing: border-box; }

/* ── Page header & tabs ── */
.asm-page-hdr { margin-bottom: 20px; }
.asm-page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.asm-page-desc { font-size: 13px; color: var(--asm-c-text-3); margin-top: 3px; }

.asm-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--asm-c-border); margin-bottom: 20px; overflow-x: auto; }
.asm-tab { padding: 10px 16px; font-size: 13px; font-weight: 500; color: var(--asm-c-text-3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--asm-transition), border-color var(--asm-transition); }
.asm-tab:hover { color: var(--asm-c-text); }
.asm-tab.active { color: var(--asm-c-accent); border-bottom-color: var(--asm-c-accent); }

.asm-loading { display: flex; justify-content: center; padding: 60px 0; }
.asm-spinner { width: 14px; height: 14px; border: 2px solid var(--asm-c-border-strong); border-top-color: var(--asm-c-text-2); border-radius: 50%; display: inline-block; animation: asmSpin 0.7s linear infinite; }
.asm-spinner.large { width: 32px; height: 32px; border-width: 3px; border-top-color: var(--asm-c-accent); }
@keyframes asmSpin { to { transform: rotate(360deg); } }

/* ── Buttons ── */
.asm-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; height: 34px; border-radius: var(--asm-radius-sm); border: 1px solid var(--asm-c-border-strong); background: var(--asm-c-surface); color: var(--asm-c-text); font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit; transition: background var(--asm-transition), border-color var(--asm-transition); white-space: nowrap; }
.asm-btn:hover { background: var(--asm-c-bg); }
.asm-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.asm-btn i { font-size: 14px; }
.asm-btn-primary { background: var(--asm-c-accent); border-color: var(--asm-c-accent); color: #fff; }
.asm-btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ── Card / table ── */
.asm-card { background: var(--asm-c-surface); border: 1px solid var(--asm-c-border); border-radius: var(--asm-radius-lg); overflow: hidden; }
.asm-mb-16 { margin-bottom: 16px; }
.asm-card-hdr { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--asm-c-border); flex-wrap: wrap; gap: 10px; }
.asm-card-title { font-size: 14px; font-weight: 600; }
.asm-tbl-wrap { overflow-x: auto; }

table.asm-tbl { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
table.asm-tbl th { text-align: right; padding: 10px 14px; color: var(--asm-c-text-3); font-weight: 600; font-size: 11px; border-bottom: 1px solid var(--asm-c-border); background: var(--asm-c-bg); }
table.asm-tbl td { padding: 11px 14px; border-bottom: 1px solid var(--asm-c-border); vertical-align: middle; }
table.asm-tbl tr:last-child td { border-bottom: none; }
table.asm-tbl tr:hover td { background: var(--asm-c-bg); }
.asm-mono { font-family: 'Courier New', monospace; }

.asm-inline-textarea, .asm-inline-select { width: 100%; border: 1px solid var(--asm-c-border); border-radius: var(--asm-radius-sm); padding: 6px 8px; font-size: 12px; background: var(--asm-c-surface); color: var(--asm-c-text); font-family: inherit; }
.asm-inline-textarea { resize: vertical; min-height: 36px; }

/* ── Badge ── */
.asm-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--asm-c-accent-bg); color: var(--asm-c-accent-text); border: 1px solid var(--asm-c-accent-border); }

/* ── Form ── */
.asm-form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.asm-field { display: flex; flex-direction: column; gap: 5px; }
.asm-field label { font-size: 11px; font-weight: 600; color: var(--asm-c-text-2); letter-spacing: 0.02em; }
.asm-field input, .asm-field select, .asm-field textarea { border: 1px solid var(--asm-c-border-strong); border-radius: var(--asm-radius-sm); padding: 8px 11px; font-size: 13px; background: var(--asm-c-surface); color: var(--asm-c-text); font-family: inherit; outline: none; transition: border-color var(--asm-transition), box-shadow var(--asm-transition); }
.asm-field input, .asm-field select { height: 36px; padding: 0 11px; }
.asm-field textarea { resize: vertical; }
.asm-field input:focus, .asm-field select:focus, .asm-field textarea:focus { border-color: var(--asm-c-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.asm-form-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--asm-c-border); }
.asm-hint { font-size: 11px; color: var(--asm-c-text-3); margin-top: 4px; }

.asm-permission-checklist { max-height: 260px; overflow-y: auto; border: 1px solid var(--asm-c-border); border-radius: var(--asm-radius-sm); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.asm-checkbox-row-inline { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--asm-radius-sm); cursor: pointer; font-size: 12px; }
.asm-checkbox-row-inline:hover { background: var(--asm-c-bg); }
.asm-checkbox-row-inline input { width: 15px; height: 15px; }

/* ── Row action buttons ── */
td.asm-row-actions { white-space: nowrap; }
.asm-row-act-btn { width: 27px; height: 27px; border: 1px solid var(--asm-c-border); background: var(--asm-c-surface); border-radius: var(--asm-radius-sm); display: inline-flex; align-items: center; justify-content: center; color: var(--asm-c-text-2); cursor: pointer; margin-inline-start: 4px; transition: background var(--asm-transition), border-color var(--asm-transition), color var(--asm-transition); }
.asm-row-act-btn:first-child { margin-inline-start: 0; }
.asm-row-act-btn:hover { background: var(--asm-c-accent-bg); border-color: var(--asm-c-accent-border); color: var(--asm-c-accent); }
.asm-row-act-btn.danger:hover { background: var(--asm-c-danger-bg); border-color: var(--asm-c-danger-border); color: var(--asm-c-danger); }

/* ── Toast ── */
.asm-toast-wrap { position: fixed; bottom: 24px; left: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.asm-toast { display: flex; align-items: center; gap: 10px; background: var(--asm-c-text); color: #fff; padding: 12px 16px; border-radius: var(--asm-radius); font-size: 13px; font-weight: 500; cursor: pointer; animation: asmSlideUp 0.25s ease; }
.asm-toast i { font-size: 16px; }
@keyframes asmSlideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ── Modal ── */
.asm-modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,15,14,0.5); z-index: 10000; align-items: center; justify-content: center; padding: 20px; }
.asm-modal-backdrop.open { display: flex; animation: asmFadeIn 0.15s ease; }
@keyframes asmFadeIn { from { opacity: 0; } to { opacity: 1; } }
.asm-modal-box { width: 100%; max-width: 560px; background: var(--asm-c-surface); border-radius: var(--asm-radius-lg); border: 1px solid var(--asm-c-border); box-shadow: 0 24px 64px rgba(0,0,0,0.32); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden; animation: asmModalPop 0.18s ease; }
@keyframes asmModalPop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.asm-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--asm-c-border); flex-shrink: 0; }
.asm-modal-title { font-size: 14px; font-weight: 600; }
.asm-modal-close { width: 30px; height: 30px; border: none; background: var(--asm-c-bg); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--asm-c-text-2); cursor: pointer; flex-shrink: 0; }
.asm-modal-close:hover { background: var(--asm-c-border); color: var(--asm-c-text); }
.asm-modal-body { padding: 20px; overflow-y: auto; }

.asm-confirm-icon { width: 52px; height: 52px; border-radius: 50%; background: var(--asm-c-danger-bg); color: var(--asm-c-danger); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.asm-confirm-icon i { font-size: 26px; }
.asm-confirm-text { text-align: center; font-size: 13px; color: var(--asm-c-text-2); line-height: 1.7; margin-bottom: 4px; }
.asm-modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.asm-modal-actions .asm-btn { flex: 1; justify-content: center; }

/* ── Toolbar ── */
.asm-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--asm-c-border); flex-wrap: wrap; }
.asm-search-box { display: flex; align-items: center; gap: 8px; background: var(--asm-c-bg); border: 1px solid var(--asm-c-border); border-radius: var(--asm-radius-sm); padding: 0 10px; height: 34px; flex: 1; min-width: 180px; transition: border-color var(--asm-transition); }
.asm-search-box:focus-within { border-color: var(--asm-c-accent); }
.asm-search-box i { font-size: 15px; color: var(--asm-c-text-3); flex-shrink: 0; }
.asm-search-box input { border: none; outline: none; background: transparent; font-family: inherit; font-size: 12.5px; color: var(--asm-c-text); width: 100%; height: 100%; }
.asm-search-box input::placeholder { color: var(--asm-c-text-3); }

/* ── Empty state ── */
.asm-empty { text-align: center; padding: 40px 20px; color: var(--asm-c-text-3); }
.asm-empty i { font-size: 34px; margin-bottom: 10px; display: block; opacity: 0.4; }
.asm-empty p { font-size: 13px; }

/* ── تب «ادمین‌ها» (AdminUsersTab) ── */
.asm-field-block { background: var(--asm-c-surface); border: 1px solid var(--asm-c-border); border-radius: var(--asm-radius-lg); padding: 18px; margin-bottom: 20px; }
.asm-tab-title { font-size: 14px; font-weight: 600; color: var(--asm-c-text); margin-bottom: 12px; }
.asm-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.asm-checklist-item { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--asm-c-text-2); cursor: pointer; }
.asm-checklist-item input { width: 15px; height: 15px; }
.asm-dragging { opacity: 0.4; background: var(--asm-c-accent-bg); }

@media (max-width: 720px) {
  .asm-toolbar { padding: 10px 12px; }
  .asm-search-box { min-width: 0; }
  .asm-card-hdr { flex-direction: column; align-items: stretch; }
  .asm-modal-backdrop { padding: 0; align-items: flex-end; }
  .asm-modal-box { max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; animation: asmSheetUp 0.22s ease; }
  @keyframes asmSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .asm-modal-body { padding: 16px; }
  .asm-form-grid { grid-template-columns: 1fr; }
  td.asm-row-actions { display: flex !important; justify-content: flex-start !important; gap: 6px; }
  .asm-toast-wrap { bottom: 12px; left: 12px; right: 12px; }
  .asm-toast { width: 100%; }
}

/* ── جست‌وجوی زنده در فهرست کامپوننت‌ها (۲۲ اوت ۲۰۲۶) — به‌جای select ساده با صدها گزینه ── */
.asm-combo { position: relative; }
.asm-combo-catcher { position: fixed; inset: 0; z-index: 1099; background: transparent; }
.asm-combo-input-wrap {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--asm-c-border-strong); border-radius: var(--asm-radius-sm);
  padding: 0 11px; height: 36px; background: var(--asm-c-surface); transition: border-color var(--asm-transition), box-shadow var(--asm-transition);
}
.asm-combo-input-wrap:focus-within { border-color: var(--asm-c-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.asm-combo-input-wrap i.ti-search { font-size: 14px; color: var(--asm-c-text-3); flex-shrink: 0; }
.asm-combo-input { flex: 1; border: none; outline: none; background: transparent; font-family: inherit; font-size: 13px; color: var(--asm-c-text); height: 100%; padding: 0; }
.asm-combo-input::placeholder { color: var(--asm-c-text-3); }
.asm-combo-clear { border: none; background: var(--asm-c-bg); border-radius: 50%; width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--asm-c-text-2); flex-shrink: 0; font-size: 10px; }
.asm-combo-clear:hover { background: var(--asm-c-border); color: var(--asm-c-text); }

.asm-combo-list {
  position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 1100;
  background: var(--asm-c-surface); border: 1px solid var(--asm-c-border); border-radius: var(--asm-radius-sm);
  box-shadow: 0 12px 32px rgba(0,0,0,0.14); max-height: 260px; overflow-y: auto; padding: 4px;
}
.asm-combo-item { padding: 8px 10px; border-radius: 6px; font-size: 12.5px; color: var(--asm-c-text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asm-combo-item:hover { background: var(--asm-c-accent-bg); color: var(--asm-c-accent-text); }
.asm-combo-item.selected { background: var(--asm-c-accent-bg); color: var(--asm-c-accent-text); font-weight: 600; }
.asm-combo-empty, .asm-combo-more { padding: 10px; text-align: center; font-size: 11.5px; color: var(--asm-c-text-3); }
