/* هیرا — استایل پایه (موبایل‌محور، راست‌چین) */
@font-face { font-family: 'Peyda'; src: url('../fonts/PeydaWeb-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Peyda'; src: url('../fonts/PeydaWeb-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --blue: #4e9bd3;
  --blue-dark: #2f7fb8;
  --navy: #0a3472;
  --green: #04b276;
  --green-dark: #039561;
  --danger: #e5384a;
  --warn: #ffc107;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #1d2a44;
  --muted: #6b7a94;
  --line: #e2e8f1;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(10, 52, 114, .08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1726; --card: #16223a; --text: #e8eefb; --muted: #9aa9c4; --line: #26344f; --shadow: none; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Peyda', Tahoma, sans-serif; font-size: 16px; line-height: 1.7;
  background: var(--bg); color: var(--text);
  padding-top: var(--safe-top);
}
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.4; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--blue-dark); text-decoration: none; }
.muted { color: var(--muted); }
.ltr { direction: ltr; text-align: left; }
.center { text-align: center; }
.noscript { padding: 24px; text-align: center; }

/* چیدمان صفحه */
.page { padding: 20px 18px calc(24px + var(--safe-bottom)); }
.page.with-nav { padding-bottom: calc(92px + var(--safe-bottom)); }
.hero { text-align: center; padding: 34px 0 18px; }
.hero img { width: 150px; height: auto; margin-bottom: 8px; }
.hero .tagline { color: var(--muted); font-size: .95rem; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }

/* فرم */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .9rem; margin-bottom: 6px; color: var(--muted); }
.input, .select {
  width: 100%; height: 50px; padding: 0 14px; font: inherit; color: var(--text);
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(78, 155, 211, .2); }
.input.error, .select.error { border-color: var(--danger); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' fill='none' stroke='%236b7a94' stroke-width='2'%3E%3Cpath d='M1 1l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center; padding-left: 38px; }
textarea.input { height: auto; padding: 12px 14px; min-height: 84px; resize: vertical; }
.code-input { text-align: center; letter-spacing: .5em; font-size: 1.6rem; direction: ltr; }
.err-text { color: var(--danger); font-size: .82rem; margin-top: 4px; min-height: 1em; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px;
  border: 0; border-radius: 12px; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
  color: #fff; background: var(--blue); transition: transform .05s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--blue-dark); }
.btn.green { background: var(--green); } .btn.green:hover { background: var(--green-dark); }
.btn.ghost { background: transparent; color: var(--blue-dark); border: 1.5px solid var(--line); }
.btn.danger-ghost { background: transparent; color: var(--danger); border: 1.5px solid var(--line); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 6px; font: inherit; color: var(--blue-dark); cursor: pointer; }
.btn-link[disabled] { color: var(--muted); cursor: default; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.spacer { height: 12px; }

/* انتخاب کارتی (جنسیت/نقش) */
.choices { display: flex; gap: 10px; }
.choice { flex: 1; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px;
  padding: 10px; text-align: center; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; font-size: .95rem;
}
.choice small { color: var(--muted); font-size: .75rem; }
.choice input:checked + span { border-color: var(--green); background: rgba(4, 178, 118, .1); color: var(--green-dark); font-weight: 700; }
.choice input:focus-visible + span { box-shadow: 0 0 0 3px rgba(78, 155, 211, .3); }

/* لیست اطلاعات */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .78rem; background: rgba(78, 155, 211, .15); color: var(--blue-dark); }
.badge.green { background: rgba(4, 178, 118, .15); color: var(--green-dark); }
.badge.warn { background: rgba(255, 193, 7, .2); color: #8a6500; }

/* هدر و ناوبری پایین */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.topbar img { height: 34px; width: auto; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--green)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.avatar.big { margin: 0 auto 8px; width: 64px; height: 64px; font-size: 1.6rem; }
.mb8 { margin-bottom: 8px; }
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px;
  display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-bottom); z-index: 5;
}
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 0 8px; font-size: .75rem; color: var(--muted); }
.nav a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a.active { color: var(--blue-dark); font-weight: 700; }
.nav a.disabled { opacity: .45; pointer-events: none; }

.soon { text-align: center; padding: 26px 14px; }
.soon svg { width: 54px; height: 54px; stroke: var(--blue); fill: none; stroke-width: 1.5; margin-bottom: 8px; }

/* Toast و لودینگ */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-bottom)); transform: translate(-50%, 20px); opacity: 0;
  max-width: 88%; padding: 12px 18px; border-radius: 12px; background: #1d2a44; color: #fff; font-size: .92rem; z-index: 20;
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--green-dark); }
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.center-screen { display: flex; align-items: center; justify-content: center; min-height: 70vh; }
.center-screen .spinner { border-color: var(--line); border-top-color: var(--blue); width: 34px; height: 34px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* آواتار عکس‌دار، بنر وضعیت، ردیف مدارک */
img.avatar-img { object-fit: cover; display: block; background: var(--line); }
img.avatar-img.big { margin: 0 auto 8px; }
.banner { display: block; color: var(--text); border-inline-start: 5px solid var(--blue); }
.banner b { display: block; } .banner span { color: var(--muted); font-size: .9rem; }
.banner.s0 { border-color: var(--warn); } .banner.s1 { border-color: var(--blue); } .banner.s2 { border-color: var(--green); } .banner.s3 { border-color: var(--danger); }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc-row:last-child { border-bottom: 0; }
.doc-row .btn { width: auto; height: 40px; padding: 0 16px; flex-shrink: 0; }
.card h3 { margin-bottom: 10px; }

/* نوار به‌روزرسانی نسخه */
.update-bar { position: fixed; left: 12px; right: 12px; bottom: calc(76px + var(--safe-bottom)); max-width: 456px; margin: 0 auto; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 14px;
  background: var(--navy); color: #fff; box-shadow: 0 6px 24px rgba(10,52,114,.35); }
.update-bar .btn-update { border: 0; border-radius: 10px; padding: 7px 16px; font: inherit; font-weight: 700; cursor: pointer; background: var(--green); color: #fff; }
.version-line { font-size: .8rem; margin-top: 18px; direction: rtl; }
