/* =========================================================
   سامانه نوبت‌دهی بیمارستان کیان — پایه مشترک
   رنگ سازمانی سرمه‌ای کیان، فونت وزیرمتن (روی هاست)
   ========================================================= */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Variable.woff2") format("woff2-variations"), url("../fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --primary: #194a85;
  --primary-600: #133a69;
  --primary-700: #0e2c50;
  --primary-soft: #e7eef7;
  --primary-tint: #f2f6fb;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f0f3f7;
  --line: #e1e6ed;
  --line-strong: #cdd5df;
  --text: #13213a;
  --muted: #5c6b80;
  --faint: #8a97a8;
  --ok: #127c52;
  --ok-soft: #e3f4ec;
  --warn: #a2640c;
  --warn-soft: #fbf0dc;
  --danger: #b4332a;
  --danger-soft: #fbe7e5;
  --info: #0f6f86;
  --info-soft: #e0f1f5;
  --violet: #5b4bb7;
  --violet-soft: #ece9fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(19, 33, 58, .06), 0 4px 16px rgba(19, 33, 58, .05);
  --shadow-lg: 0 12px 40px rgba(19, 33, 58, .18);
  --font: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "ss01";
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0; text-wrap: balance; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: grid; gap: 12px; }
.stack-sm { display: grid; gap: 6px; }
svg.chev { width: 20px; height: 20px; flex: none; color: var(--faint); }
.row > svg { width: 18px; height: 18px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }

/* ---------- دکمه ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: #d9e5f2; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #0e6a45; }
.btn-danger { background: var(--surface); border-color: #efc4bf; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- فرم ---------- */
.field { display: grid; gap: 6px; }
.field > span, .field > .label { font-weight: 600; font-size: 13.5px; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .err-msg { font-size: 12.5px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.8; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.has-error, .select.has-error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.input-sm { min-height: 38px; padding: 6px 12px; border-radius: 10px; font-size: 14px; }
.input::placeholder { color: var(--faint); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.search-box { position: relative; }
.search-box svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search-box .input { padding-inline-start: 42px; }

/* ---------- کارت و نشان ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.card-pad { padding: 16px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.9; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.b-booked { background: var(--primary-soft); color: var(--primary); }
.b-checked_in { background: var(--info-soft); color: var(--info); }
.b-in_room { background: var(--violet-soft); color: var(--violet); }
.b-done { background: var(--ok-soft); color: var(--ok); }
.b-skipped { background: var(--warn-soft); color: var(--warn); }
.b-no_show { background: var(--danger-soft); color: var(--danger); }
.b-cancelled { background: var(--surface-2); color: var(--faint); text-decoration: line-through; }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-danger { background: var(--danger-soft); color: var(--danger); }

.avatar {
  flex: none; display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-weight: 800; font-size: 18px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 84px; height: 84px; font-size: 26px; }
.avatar.sm { width: 40px; height: 40px; font-size: 14px; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--line-strong); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 14px; background: var(--primary-tint); border: 1px solid var(--primary-soft); }
.alert-warn { background: var(--warn-soft); border-color: #f1dcb5; color: #6d4408; }
.alert-danger { background: var(--danger-soft); border-color: #f2c9c4; color: #7e231c; }
.alert-ok { background: var(--ok-soft); border-color: #c5e8d7; color: #0b5a3a; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), #e8edf3, var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

.spinner { width: 22px; height: 22px; border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 48px 0; }

/* ---------- اعلان (toast) ---------- */
.toast-wrap { position: fixed; inset-inline: 0; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); display: grid; justify-items: center; gap: 8px; z-index: 1000; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; background: var(--text); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); max-width: 480px; animation: tin .2s ease-out; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- پنجره (modal) ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(14, 25, 45, .45); z-index: 900; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal {
  background: var(--surface); border-radius: 18px; width: 100%; max-width: 520px;
  max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow-lg);
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }
@keyframes fade { from { opacity: 0; } }

/* ---------- تقویم شمسی (انتخاب تاریخ) ---------- */
.jdp { position: absolute; z-index: 950; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px; width: 288px; }
.jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.jdp-grid .wd { font-size: 11px; color: var(--faint); padding: 4px 0; }
.jdp-grid button { border: 0; background: none; border-radius: 8px; height: 34px; cursor: pointer; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.jdp-grid button:hover { background: var(--primary-soft); }
.jdp-grid button.sel { background: var(--primary); color: #fff; }
.jdp-grid button.today { box-shadow: inset 0 0 0 1px var(--primary); }
.jdp-grid button:disabled { color: var(--line-strong); cursor: default; background: none; }

/* ---------- جدول ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: start; font-weight: 600; font-size: 12.5px; color: var(--muted); background: var(--surface-2); padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--primary-tint); }
.table .num { text-align: start; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
