/* پایه مشترک نماهای برنامه و لینک‌های عمومی: قلم، رنگ‌ها و صفحه آغاز */

/* IRANSansFa: رقم‌های لاتین با شکل فارسی نمایش داده می‌شوند؛ مقدار داده لاتین می‌ماند. */
@font-face { font-family: 'IRANSansFa'; src: url('/fonts/iransans-fa-200.woff2') format('woff2'); font-weight: 200; font-display: swap; }
@font-face { font-family: 'IRANSansFa'; src: url('/fonts/iransans-fa-300.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'IRANSansFa'; src: url('/fonts/iransans-fa-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IRANSansFa'; src: url('/fonts/iransans-fa-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IRANSansFa'; src: url('/fonts/iransans-fa-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
/* IRANSans با رقم لاتین برای کد، نشانی و شماره کارت */
@font-face { font-family: 'IRANSans'; src: url('/fonts/iransans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IRANSans'; src: url('/fonts/iransans-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --sa-saffron: #FF7A00;
  --sa-saffron-deep: #D95F00;
  --sa-saffron-soft: #FFF1E3;
  --sa-turquoise: #0F9E9E;
  --sa-turquoise-soft: #E2F6F6;
  --sa-lapis: #1F2A6E;
  --sa-lapis-deep: #141C4F;
  --sa-lapis-soft: #E9ECFA;
  --sa-pomegranate: #E0243B;
  --sa-pistachio: #4E9A2A;
  --sa-pistachio-soft: #E8F4E1;
  --sa-tile: #F4F7FB;
  --sa-surface: #FFFFFF;
  --sa-ink: #18203F;
  --sa-muted: #5B6585;
  --sa-line: rgba(31, 42, 110, .09);
  --sa-line-strong: rgba(31, 42, 110, .16);
  --sa-r-sheet: 26px;
  --sa-r-card: 18px;
  --sa-r-input: 12px;
  --sa-dock-h: 68px;
  --sa-safe-b: env(safe-area-inset-bottom, 0px);
  --sa-safe-t: env(safe-area-inset-top, 0px);
  --sa-font: 'IRANSansFa', Tahoma, sans-serif;
  --sa-girih: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%2321C2C2' stroke-opacity='.22' stroke-width='1.2'%3E%3Cpolygon points='36,6 45.7,15.7 59.4,15.7 59.4,29.4 69,36 59.4,42.6 59.4,56.3 45.7,56.3 36,66 26.3,56.3 12.6,56.3 12.6,42.6 3,36 12.6,29.4 12.6,15.7 26.3,15.7'/%3E%3Cpath d='M0 0L12.6 15.7M72 0L59.4 15.7M0 72L12.6 56.3M72 72L59.4 56.3M36 6V0M36 66v6M3 36H0M69 36h3'/%3E%3Ccircle cx='36' cy='36' r='9'/%3E%3C/g%3E%3C/svg%3E");
  color-scheme: light;
}

/* رنگ‌های حالت تیره: انتخاب کاربر در برنامه (data-theme روی <html>) بر حالت سیستم مقدم است؛
   بی‌انتخاب (مثل لینک‌های عمومی) حالت سیستم دنبال می‌شود. همین دو بلوک باید هم‌سان بمانند. */
html[data-theme="dark"] {
  --sa-tile: #0B1030;
  --sa-surface: #141B47;
  --sa-ink: #E8ECFA;
  --sa-muted: #A7B0D4;
  --sa-line: rgba(255, 255, 255, .09);
  --sa-line-strong: rgba(255, 255, 255, .16);
  --sa-saffron-soft: rgba(255, 138, 31, .14);
  --sa-turquoise-soft: rgba(44, 196, 196, .14);
  --sa-lapis-soft: rgba(142, 155, 255, .14);
  --sa-pistachio-soft: rgba(123, 198, 85, .14);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sa-tile: #0B1030;
    --sa-surface: #141B47;
    --sa-ink: #E8ECFA;
    --sa-muted: #A7B0D4;
    --sa-line: rgba(255, 255, 255, .09);
    --sa-line-strong: rgba(255, 255, 255, .16);
    --sa-saffron-soft: rgba(255, 138, 31, .14);
    --sa-turquoise-soft: rgba(44, 196, 196, .14);
    --sa-lapis-soft: rgba(142, 155, 255, .14);
    --sa-pistachio-soft: rgba(123, 198, 85, .14);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--sa-tile);
  color: var(--sa-ink);
  font-family: var(--sa-font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; min-height: 100dvh; overscroll-behavior-y: contain; }

a { color: inherit; }

.ltr { direction: ltr; unicode-bidi: isolate; font-family: 'IRANSans', var(--sa-font); }

:focus-visible { outline: 3px solid var(--sa-turquoise); outline-offset: 2px; border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── صفحه آغاز تا بارگیری برنامه ── */
#app-splash {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--sa-lapis) var(--sa-girih);
  color: #fff;
  transition: opacity .4s ease, visibility .4s;
}
#app-splash.out { opacity: 0; visibility: hidden; }
.splash-star svg { animation: sa-spin-in 1.1s cubic-bezier(.2, .8, .2, 1) both; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
.splash-title { font-weight: 700; font-size: 1.35rem; font-family: 'IRANSans', var(--sa-font); }
.splash-bar { width: 140px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.splash-bar span {
  display: block;
  height: 100%;
  width: calc(var(--blazor-load-percentage, 12%));
  background: var(--sa-saffron);
  border-radius: 4px;
  transition: width .25s ease;
}
@keyframes sa-spin-in {
  from { transform: rotate(-135deg) scale(.4); opacity: 0; }
  to { transform: rotate(0) scale(1); opacity: 1; }
}

#blazor-error-ui {
  display: none;
  position: fixed;
  inset-inline: 12px;
  bottom: calc(12px + var(--sa-safe-b));
  z-index: 6000;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--sa-pomegranate);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(224, 36, 59, .35);
}
#blazor-error-ui .reload { color: #fff; font-weight: 700; margin-inline-start: 8px; }
