/* ============================================================
   وردپرس کار — panel2.css
   لایهٔ بهینه‌سازی پنل (روی CSS اصلی قالب‌ها سوار می‌شود):
   فونت وزمتن، توکن‌های هماهنگ با فرانت، کارت/دکمه/جدول/تب‌ها،
   اسکرول‌بار، حالت‌های فوکوس، حرکت کم. بدون تغییر ساختار DOM.
   ============================================================ */

/* ---------- font + tokens ---------- */
:root {
  --p-primary: #4f46e5;
  --p-secondary: #7c3aed;
  --p-accent: #f59e0b;
  --p-ink: #0b1020;
  --p-body: #eef1f7;
  --p-card: #f7f9fc;
  --p-line: #e7ebf3;
  --p-radius: 14px;
}
body, input, select, textarea, button { font-family: "Vazirmatn", Tahoma, sans-serif !important; }

/* ---------- scrollbars ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; border: 2px solid var(--p-body); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- focus states (accessibility) ---------- */
.input:focus, .filter-input:focus, .cf-input:focus, .cf-textarea:focus,
select:focus, textarea:focus, input[type="text"]:focus, input[type="number"]:focus,
input[type="email"]:focus, input[type="password"]:focus {
  outline: none;
  border-color: rgb(79 70 229 / .55) !important;
  box-shadow: 0 0 0 4px rgb(79 70 229 / .12) !important;
}
:focus-visible { outline: 3px solid rgb(79 70 229 / .45); outline-offset: 2px; }

/* ---------- buttons unified ---------- */
.btn, .st-btn, .btn-primary, .st-btn-primary, .cf-submit,
.page-btn.is-active, .pagination .page-btn.is-active { border-radius: 11px; }
.btn-primary, .st-btn-primary, .login-btn, .nl-btn, .btn-post-action.is-preview {
  background: linear-gradient(135deg, var(--p-primary), var(--p-secondary)) !important;
  box-shadow: 0 5px 16px -6px rgb(79 70 229 / .55);
  border: 0;
  transition: transform .16s ease-out, box-shadow .16s ease-out, filter .16s;
}
.btn-primary:hover, .st-btn-primary:hover, .login-btn:hover,
.btn-post-action.is-preview:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn-ghost:hover, .st-btn-ghost:hover, .dash-btn:hover { transform: translateY(-1px); }
.btn:disabled, .st-btn:disabled { opacity: .55; cursor: wait; }

/* ---------- cards & panels ---------- */
.tabbed-card, .card, .qs-item, .kpi-card, .admin-card, .date-card,
.gen-card, .adv-card, .side-card, .pg-panel, .slide-card,
.table-wrap, .st-header, .settings-page .st-body, .meta-bar,
.filter-bar, .calendar-popup, .comments-header, .comment-form {
  border-radius: var(--p-radius) !important;
}
.filter-bar, .table-wrap { border: 1px solid var(--p-line); }
.table-wrap { box-shadow: 0 1px 2px rgb(16 24 40 / .05); overflow-x: auto; }

/* ---------- tables ---------- */
.posts-table thead th {
  background: var(--p-ink) !important; color: #fff;
  font-size: 12px; letter-spacing: .02em; white-space: nowrap;
}
.posts-table thead th:first-child { border-start-start-radius: 10px; }
.posts-table thead th:last-child { border-end-start-radius: 10px; }
.posts-table tbody tr { transition: background .14s; }
.posts-table tbody tr:hover { background: rgb(79 70 229 / .045) !important; }
.posts-table td { border-color: var(--p-line) !important; }

/* ---------- tabs ---------- */
.tab-btn, .editor-tab, .st-nav-item, .pg-tab, .s-tab, .meta-tab, .time-tab {
  border-radius: 10px; transition: background .16s, color .16s, box-shadow .16s;
}
.tab-btn.is-active, .editor-tab.is-active, .meta-tab.is-active,
.st-nav-item.is-active, .time-tab.is-active, .pg-tab.is-active {
  background: linear-gradient(135deg, rgb(79 70 229 / .12), rgb(124 58 237 / .12)) !important;
  color: var(--p-primary) !important;
  box-shadow: inset 0 0 0 1px rgb(79 70 229 / .25);
}

/* ---------- pills/badges ---------- */
.status-pill, .seo-pill, .tags-badge, .check-pill, .etab-badge,
.comments-count-badge, .cat-hero-count, .status-badge { border-radius: 999px !important; }

/* ---------- toggles & switches ---------- */
.dl-toggle input:checked + .dl-toggle-track,
.switch-inline input:checked ~ .switch,
label.switch input:checked, .toggle-track:has(input:checked) {
  background: linear-gradient(135deg, var(--p-primary), var(--p-secondary)) !important;
}

/* ---------- quick-add / calendar ---------- */
.quick-add { transition: transform .25s ease-out, box-shadow .25s; }
 .quick-menu, .calendar-popup { box-shadow: 0 16px 48px -12px rgb(16 24 40 / .25) !important; border: 1px solid var(--p-line); }
.cal-day { transition: background .12s, transform .12s; border-radius: 9px !important; }
.cal-day:hover { transform: scale(1.12); }

/* ---------- editor ---------- */
.editor { border-radius: var(--p-radius) !important; overflow: hidden; }
.toolbar { background: var(--p-ink) !important; }
.tb-btn { border-radius: 8px; }
.tb-btn.is-active { background: rgb(79 70 229 / .85) !important; color: #fff !important; }
.editor-body:focus { outline: none; box-shadow: inset 0 0 0 2px rgb(79 70 229 / .2); }

/* ---------- settings header status ---------- */
.st-status { border-radius: 999px !important; }

/* ---------- login ---------- */
.login-card { border-radius: 20px; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ============ categories manager ============ */
.cat-table td-actions { white-space: nowrap; }
.cat-btn {
  border: 1px solid var(--p-line); background: #fff; border-radius: 9px;
  min-width: 34px; height: 32px; cursor: pointer; font-size: 14px; padding: 0 8px;
  margin-inline-start: 4px; transition: border-color .16s, background .16s, transform .16s;
}
.cat-btn:hover { border-color: rgb(79 70 229 / .5); color: var(--p-primary); transform: translateY(-1px); }
.cat-btn.c-del:hover { border-color: #dc2626; color: #dc2626; }

.cat-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.cat-modal-scrim { position: absolute; inset: 0; background: rgb(11 16 32 / .5); backdrop-filter: blur(2px); }
.cat-modal-card {
  position: relative; width: min(520px, 100%); max-height: 92vh; overflow: auto;
  background: #fff; border-radius: 18px; padding: 22px 24px; box-shadow: 0 16px 48px -12px rgb(16 24 40 / .35);
  animation: catpop .22s ease-out;
}
@keyframes catpop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.cat-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cat-modal-head h3 { font-size: 17px; }
.cat-x { border: 0; background: none; font-size: 24px; color: #8592a3; cursor: pointer; padding: 2px 8px; }
.cat-x:hover { color: #1f2937; }
.cf-field { display: grid; gap: 6px; margin-bottom: 13px; font-size: 13.5px; font-weight: 600; color: #4b5563; }
.cf-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.cf-req { color: #dc2626; }
.cat-input {
  width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--p-line);
  background: var(--p-card); font: inherit; font-size: 14px; font-weight: 400; color: var(--p-ink, #1f2937);
}
.cat-input:focus { outline: none; border-color: rgb(79 70 229 / .55); box-shadow: 0 0 0 4px rgb(79 70 229 / .12); background: #fff; }
textarea.cat-input { resize: vertical; min-height: 56px; }
.chk-row { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: #4b5563; cursor: pointer; margin-bottom: 6px; }
.cat-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.cat-modal-foot .btn-ghost { background: #fff; border: 1px solid var(--p-line); color: #4b5563; }
@media (max-width: 560px) { .cf-row { grid-template-columns: 1fr; } }

/* ============ categories manager (plain form version) ============ */
.cat-btn {
  display: inline-grid; place-items: center; vertical-align: middle;
  border: 1px solid var(--p-line); background: #fff; border-radius: 9px;
  min-width: 34px; height: 32px; cursor: pointer; font-size: 14px; padding: 0 8px;
  margin-inline-start: 4px; text-decoration: none; color: #1f2937;
  transition: border-color .16s, color .16s, transform .16s;
}
.cat-btn:hover { border-color: rgb(79 70 229 / .5); color: var(--p-primary); transform: translateY(-1px); }
.cat-btn.c-del { color: #6b7280; }
.cat-btn.c-del:hover { border-color: #dc2626; color: #dc2626; }
.cat-del-form { display: inline; }

.cat-form-card {
  background: #fff; border: 1px solid var(--p-line); border-radius: var(--p-radius);
  padding: 22px 24px; margin-bottom: 20px; box-shadow: 0 1px 2px rgb(16 24 40 / .05);
}
.cat-form-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cat-form-head h2 { font-size: 17px; }
.cat-x { border: 0; background: none; font-size: 24px; color: #8592a3; cursor: pointer; padding: 2px 8px; text-decoration: none; line-height: 1; }
.cat-x:hover { color: #1f2937; }
.cf-field { display: grid; gap: 6px; margin-bottom: 13px; font-size: 13.5px; font-weight: 600; color: #4b5563; }
.cf-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.cf-req { color: #dc2626; }
.cat-input {
  width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--p-line);
  background: var(--p-card); font: inherit; font-size: 14px; font-weight: 400; color: #1f2937;
}
.cat-input:focus { outline: none; border-color: rgb(79 70 229 / .55); box-shadow: 0 0 0 4px rgb(79 70 229 / .12); background: #fff; }
textarea.cat-input { resize: vertical; min-height: 56px; }
.chk-row { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: #4b5563; cursor: pointer; margin-bottom: 6px; }
.cat-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.cat-modal-foot .btn-ghost { background: #fff; border: 1px solid var(--p-line); color: #4b5563; }
.cat-filter-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; }
.cat-notices { display: grid; gap: 8px; margin-bottom: 16px; }
.cat-notice { border-radius: 11px; padding: 11px 16px; font-size: 14px; font-weight: 600; border: 1px solid; }
.cat-notice-success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.cat-notice-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
@media (max-width: 560px) { .cf-row { grid-template-columns: 1fr; } }

/* ============ list thumbnails + actions + editor cover ============ */
.td-media .media-thumb { display: inline-block; width: 52px; height: 34px; border-radius: 7px; overflow: hidden; position: relative; border: 1px solid var(--p-line); background: #eef1f6; }
.td-media .media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.td-media .mt-play { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(11 16 32 / .35); color: #fff; font-size: 12px; }
.td-media .media-thumb:hover { outline: 2px solid rgb(79 70 229 / .5); }
.td-actions-pl { white-space: nowrap; }
.pl-act { display: inline-grid; place-items: center; width: 32px; height: 32px; margin-inline-start: 4px; border-radius: 9px; border: 1px solid var(--p-line); background: #fff; color: #4b5563; text-decoration: none; transition: border-color .16s, color .16s; }
.pl-act:hover { border-color: rgb(79 70 229 / .55); color: var(--p-primary); }
.thumb-preview.is-cover { margin-top: 8px; }
.cover-tag { position: absolute; top: 6px; inset-inline-start: 6px; background: rgb(11 16 32 / .72); color: #fff; font-size: 11px; font-weight: 700; border-radius: 7px; padding: 3px 8px; pointer-events: none; }
.thumb-preview { position: relative; }

/* ============ media dropzone preview boxes ============ */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; overflow: hidden; }
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dz-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: none; }
.dropzone.has-media { border-style: solid; border-color: rgb(79 70 229 / .45); background: #0b1020; cursor: default; }
.dropzone.has-media .dz-empty { display: none; }
.dropzone.has-media .dz-preview { display: block; }
.dropzone .thumb-remove { position: absolute; top: 8px; inset-inline-end: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgb(17 22 38 / .78); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.dropzone .thumb-remove:hover { background: #dc2626; }
.dz-meta { margin-top: 8px; font-size: 12.5px; color: #6b7280; background: #f4f6fb; border: 1px solid var(--p-line); border-radius: 9px; padding: 7px 10px; line-height: 1.8; text-align: center; }

/* ============ dashboard tabbed-grid: report + finance tabs ============ */
.rp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; padding: 4px 0 14px; }
.rp-stat { background: #f7f9fc; border: 1px solid var(--p-line); border-radius: 12px; padding: 14px 10px; text-align: center; display: grid; gap: 4px; }
.rp-val { font-size: 19px; font-weight: 800; color: #1f2937; }
.rp-val.is-sale { background: linear-gradient(120deg, #4f46e5, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rp-cap { font-size: 12px; color: #6b7280; }
.rp-weeks { border-top: 1px dashed var(--p-line); padding-top: 10px; max-height: 220px; overflow: auto; }
.rp-weeks-title { font-size: 12.5px; font-weight: 700; color: #4b5563; margin-bottom: 6px; }
.rp-week-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: #374151; padding: 5px 4px; border-radius: 8px; }
.rp-week-row:nth-child(odd) { background: #f7f9fc; }
.rp-week-nums { color: #6b7280; white-space: nowrap; }
.list-empty { padding: 18px; text-align: center; color: #8592a3; font-size: 13px; list-style: none; }
