/* ==========================================================================
   Base — ریست، تایپوگرافی فارسی، RTL
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-fa);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--text);
}

h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-md); }

p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--primary-hover); }

ul, ol { margin: 0; padding: 0; list-style: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  direction: rtl;
}

button { cursor: pointer; border: none; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }

img, svg { display: block; max-width: 100%; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--s-4) 0;
}

code, kbd, .mono {
  font-family: var(--font-mono);
  direction: ltr;
  unicode-bidi: embed;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: var(--fs-xs);
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
  color: var(--text-2);
}

/* اعداد و تاریخ‌ها همیشه چپ‌چین داخل جریان راست‌چین */
.ltr { direction: ltr; unicode-bidi: embed; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* --- Scrollbar --- */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-2);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: content-box; }

/* --- Focus --- */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection { background: var(--primary-soft); color: var(--primary); }

/* --- Utilities --- */
.row { display: flex; align-items: center; gap: var(--s-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink0 { flex-shrink: 0; }

.g1 { gap: var(--s-1); } .g2 { gap: var(--s-2); } .g3 { gap: var(--s-3); }
.g4 { gap: var(--s-4); } .g5 { gap: var(--s-5); } .g6 { gap: var(--s-6); }

.mt1{margin-top:var(--s-1)} .mt2{margin-top:var(--s-2)} .mt3{margin-top:var(--s-3)}
.mt4{margin-top:var(--s-4)} .mt5{margin-top:var(--s-5)} .mt6{margin-top:var(--s-6)}
.mb2{margin-bottom:var(--s-2)} .mb3{margin-bottom:var(--s-3)} .mb4{margin-bottom:var(--s-4)}

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.big { font-size: var(--fs-lg); }
.bold { font-weight: 700; }
.semi { font-weight: 600; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hidden { display: none !important; }
.clickable { cursor: pointer; }
.mono-num { font-variant-numeric: tabular-nums; }

.c-success { color: var(--success); }
.c-danger  { color: var(--danger); }
.c-warn    { color: var(--warn); }
.c-info    { color: var(--info); }
.c-primary { color: var(--primary); }
