@font-face { font-family: Vazirmatn; font-weight: 400; font-display: swap; src: url(../fonts/Vazirmatn-Regular.woff2) format("woff2"); }
@font-face { font-family: Vazirmatn; font-weight: 700; font-display: swap; src: url(../fonts/Vazirmatn-Bold.woff2) format("woff2"); }

/* رنگ‌ها از تم ایتا (--tg-theme-*) با مقادیر پیش‌فرض برای مرورگر معمولی */
:root {
  --f-bg: #ffffff; --f-bg2: #f2f3f5; --f-text: #111827; --f-hint: #6b7280;
  --f-link: #2563eb; --f-btn: #2563eb; --f-btn-text: #ffffff; --f-danger: #dc2626;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --f-bg: #17191c; --f-bg2: #0f1113; --f-text: #e5e7eb; --f-hint: #9ca3af;
    --f-link: #60a5fa; --f-btn: #3b82f6; --f-btn-text: #ffffff; --f-danger: #f87171;
  }
}
:root[data-theme="dark"] {
  --f-bg: #17191c; --f-bg2: #0f1113; --f-text: #e5e7eb; --f-hint: #9ca3af;
  --f-link: #60a5fa; --f-btn: #3b82f6; --f-btn-text: #ffffff; --f-danger: #f87171;
}
:root {
  --bg: var(--tg-theme-secondary-bg-color, var(--f-bg2));
  --card: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, var(--f-bg)));
  --text: var(--tg-theme-text-color, var(--f-text));
  --hint: var(--tg-theme-hint-color, var(--f-hint));
  --link: var(--tg-theme-link-color, var(--f-link));
  --btn: var(--tg-theme-button-color, var(--f-btn));
  --btn-text: var(--tg-theme-button-text-color, var(--f-btn-text));
  --danger: var(--tg-theme-destructive-text-color, var(--f-danger));
  --border: rgba(127, 127, 127, 0.28);
  --radius: 12px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
[hidden] { display: none !important; }

/* ---- splash / fatal ---- */
.splash, .fatal {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center; color: var(--hint);
}
.fatal { color: var(--text); }
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--btn);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- layout ---- */
.layout { max-width: 1180px; margin: 0 auto; padding: 0 16px calc(96px + var(--safe-bottom)); }
.topbar { padding: 14px 0 6px; }
.topbar h1 { font-size: 17px; margin: 0; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-side { display: flex; align-items: center; gap: 8px; flex: none; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px 4px 12px; border-radius: 999px; flex: none;
  border: 1px solid var(--border); color: var(--hint); font-size: 13px; text-decoration: none; white-space: nowrap;
}
.back-link:hover { color: var(--text); border-color: var(--text); }
/* در راست‌به‌چپ «برگشت» به سمت راست است */
.back-arrow { font-size: 18px; line-height: 1; transform: scaleX(-1); }
[dir="ltr"] .back-arrow { transform: none; }
/* گوشی باریک : فقط پیکان ( متن در title )، تا نشان «ویژه» و «خرید بسته» در سربرگ جا شوند */
@media (max-width: 400px) { .back-link { padding: 4px 9px; } .back-link .back-text { display: none; } .topbar-side { gap: 6px; } }
.lang-btn {
  border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px;
  padding: 4px 12px; min-height: 36px; font-size: 14px; cursor: pointer;
}

/* ---- انتخاب زبان ---- */
.lang-pick { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: 20px; max-width: 460px; margin: 0 auto; padding: 24px 16px; }
.lang-pick-head { text-align: center; }
.lang-pick-head h1 { font-size: 20px; margin: 0 0 6px; }
.lang-pick-head p { margin: 2px 0; color: var(--hint); }
.lang-options { display: grid; gap: 10px; }
.lang-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start;
  min-height: 64px; padding: 12px 16px; border-radius: var(--radius); cursor: pointer;
  background: var(--card); color: var(--text); border: 1.5px solid var(--border);
}
.lang-option b { font-size: 18px; }
.lang-option small { color: var(--hint); font-size: 13px; }
.lang-option[aria-pressed="true"] { border-color: var(--btn); box-shadow: 0 0 0 2px var(--btn) inset; }
.steps { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 4px; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.step-chip {
  flex: none; border: 1px solid var(--border); background: var(--card); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; color: var(--hint); cursor: pointer; min-height: 32px;
}
.step-chip[aria-current="step"] { background: var(--btn); color: var(--btn-text); border-color: var(--btn); }
.step-chip.done { color: var(--text); }

.main { display: block; }
.aside { display: none; }
@media (min-width: 960px) {
  .main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .aside { display: block; position: sticky; top: 12px; }
  .only-mobile { display: none !important; }
}

/* ---- cards & fields ---- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; border: 1px solid var(--border); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; font-size: 15px; }
.step-title { font-size: 19px; margin: 16px 0 2px; }
.step-desc { color: var(--hint); margin: 0 0 8px; font-size: 14px; }

.field { display: block; margin: 0 0 14px; }
.field:last-child { margin-bottom: 0; }
.field > span { display: block; font-size: 13px; color: var(--hint); margin-bottom: 4px; }
.field .req { color: var(--danger); }
.input {
  width: 100%; min-height: 46px; padding: 10px 12px; font-size: 16px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; outline: none;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.8; }
.input:focus { border-color: var(--btn); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18); }
.input[dir="ltr"] { text-align: left; }
.input[dir="ltr"]::placeholder { text-align: left; }
.field.has-error .input { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; margin-top: 4px; }
.hint { color: var(--hint); font-size: 12.5px; margin-top: 4px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 3px 0 0; flex: none; accent-color: var(--btn); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 46px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  background: var(--btn); color: var(--btn-text); font-weight: 700; cursor: pointer;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); font-weight: 400; }
.btn-danger-text { background: transparent; color: var(--danger); border: none; min-height: 44px; padding: 0 8px; cursor: pointer; }
.btn-add { width: 100%; background: transparent; color: var(--link); border: 1.5px dashed var(--border); }
.btn-block { width: 100%; }

/* ---- bottom nav ---- */
.bottom {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 10;
  background: var(--card); border-top: 1px solid var(--border);
  padding: 10px 16px calc(10px + var(--safe-bottom));
}
.bottom-inner { max-width: 1180px; margin: 0 auto; display: flex; gap: 10px; align-items: center; }
.bottom-inner .btn { flex: 1; }
.bottom-inner .btn-ghost.only-mobile { flex: 0 0 auto; }

/* ---- photo ---- */
.photo-row { display: flex; align-items: center; gap: 14px; }
.photo-thumb {
  width: 72px; height: 72px; border-radius: 12px; object-fit: cover; flex: none;
  background: var(--bg); border: 1px solid var(--border);
}
.photo-actions { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.file-label { position: relative; overflow: hidden; }
.file-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- بخش‌های اختیاری و «سایر بخش‌ها» ---- */
.link-add {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0; margin-bottom: 4px;
  background: none; border: none; color: var(--link); font-weight: 700; cursor: pointer;
}
.subcard { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 0 0 10px; background: var(--bg); }
.subcard .input { background: var(--card); }
.subcard .card-title { margin-bottom: 4px; }
.section-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.section-picker .btn { flex: 1 1 calc(50% - 8px); min-width: 140px; font-weight: 400; }

/* ---- chips (skills) ---- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px;
  border-radius: 999px; background: var(--bg); border: 1px solid var(--border); font-size: 14px;
  padding-inline: 10px 4px;
}
.chip button { border: none; background: none; color: var(--hint); cursor: pointer; min-width: 32px; min-height: 32px; font-size: 18px; line-height: 1; }
.inline-add { display: flex; gap: 8px; }
.inline-add .input { flex: 1; }
.inline-add .btn { flex: none; }

/* ---- design step ---- */
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.option {
  position: relative; border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 6px;
  background: var(--bg); cursor: pointer; text-align: center; min-height: 64px; font-size: 14px;
}
.option[aria-pressed="true"] { border-color: var(--btn); box-shadow: 0 0 0 2px var(--btn) inset; }
.option { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 6px 6px; }
.option small { display: block; color: var(--hint); font-size: 12px; }
.option small.badge-premium { color: #b45309; font-weight: 700; }
.premium-box { border: 1.5px solid #f59e0b; background: rgba(245, 158, 11, 0.08); border-radius: 10px; padding: 12px; margin-bottom: 4px; }
.btn-buy { background: #d97706; color: #fff; }
.notice-ok { color: #15803d; background: rgba(22, 163, 74, 0.1); font-weight: 700; }
.upsell { margin-top: 8px; }
.upsell summary { cursor: pointer; color: #b45309; font-weight: 700; min-height: 32px; }
.upsell .btn { margin-top: 8px; }
.premium-box p { margin: 4px 0 10px; font-size: 14px; color: var(--hint); }

/* طرح کوچک قالب‌ها روی دکمه انتخاب */
.thumb {
  position: relative; display: block; width: 58px; height: 80px; margin-bottom: 4px;
  background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); overflow: hidden;
}
.thumb i { display: block; }
.thumb .tl { height: 2px; background: #d1d5db; margin: 3px 6px 0; border-radius: 1px; }
.thumb .tl:nth-child(odd) { margin-inline-end: 14px; }
.thumb .th { height: 5px; width: 26px; margin-block: 7px 3px; margin-inline: 6px auto; border-radius: 1px; }
.thumb .trule { height: 1px; margin: 5px 6px 1px; }
.thumb-modern { display: flex; }
.thumb-side { width: 19px; height: 100%; padding-top: 6px; flex: none; }
.thumb-side .tp { width: 10px; height: 10px; margin: 0 auto 4px; background: rgba(255, 255, 255, 0.55); }
.thumb-side .tl-light { background: rgba(255, 255, 255, 0.6); margin: 3px 3px 0; }
.thumb-side .tl-light:nth-child(odd) { margin-inline-end: 6px; }
.thumb-main { flex: 1; }
.thumb-main .th { width: 22px; margin-block: 7px 4px; margin-inline: 4px auto; }
.thumb-main .tl { margin: 3px 4px 0; }
.thumb-main .tl:nth-child(odd) { margin-inline-end: 9px; }
.thumb-formal .tbar { height: 4px; margin: 5px 5px 2px; background: #eef1f4; border-inline-start: 2px solid; }
.thumb-formal .tgrid { display: grid; grid-template-columns: 2fr 1fr; gap: 1px; margin: 0 5px; background: #d1d5db; border: 1px solid #d1d5db; }
.thumb-formal .tc { height: 4px; background: #fff; }
.thumb .tsub { height: 2px; width: 18px; margin: 0 auto 0; margin-inline-start: 6px; background: #9ca3af; border-radius: 1px; }
.thumb-classic .th { margin-inline: auto; }
.thumb-classic .tsub { margin-inline: auto; }
.thumb-classic .trule { margin-top: 4px; }
.thumb-classic .thc { height: 3px; width: 16px; margin: 6px auto 1px; border-radius: 1px; }
.thumb-banner .tband { display: flex; align-items: center; gap: 3px; height: 18px; padding-inline: 5px; }
.thumb-banner .tp { width: 9px; height: 9px; background: rgba(255, 255, 255, 0.7); }
.thumb-banner .tname { width: 22px; height: 3px; background: #fff; border-radius: 1px; }
.thumb-banner .tpill { height: 4px; margin: 6px 5px 1px; border-radius: 2px; }
.thumb-timeline .tthick { height: 2px; margin: 0 6px 4px; }
.thumb-timeline .trow { display: flex; gap: 2px; margin: 0 6px; }
.thumb-timeline .twhen { width: 9px; height: 2px; margin-top: 3px; flex: none; }
.thumb-timeline .tbody { flex: 1; border-inline-start: 1.5px solid; padding-bottom: 3px; }
.thumb-timeline .tbody .tl { margin-inline: 3px 0; }
.thumb-timeline .tbody .tl:nth-child(odd) { margin-inline-end: 6px; }
.thumb-soft { display: flex; }
.thumb-soft .thumb-main .tsub { margin-inline: 4px auto; margin-bottom: 2px; }
.thumb-soft .thumb-side .tp { background: #fff; }
.thumb-soft .thumb-side .tl-light { background: rgba(0, 0, 0, 0.18); }
.thumb-cards { background: #eef0f3; padding: 3px; }
.thumb-cards .thead { height: 13px; border-radius: 2px; margin-bottom: 3px; }
.thumb-cards .tcard { display: block; background: #fff; border-radius: 2px; padding: 3px 0 4px; margin-bottom: 3px; }
.thumb-cards .tch { height: 3px; width: 16px; margin-inline: 3px auto; background: #9ca3af; border-inline-start: 2px solid; }
.thumb-cards .tcard .tl { margin: 2px 3px 0; }
.thumb-cards .tcard .tl:nth-child(odd) { margin-inline-end: 8px; }
@media (min-width: 400px) { .tpl-options { grid-template-columns: repeat(4, 1fr); } }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--card); cursor: pointer;
  box-shadow: 0 0 0 1px var(--border);
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--btn); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: none; background: var(--bg); min-height: 44px; padding: 0 18px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--btn); color: var(--btn-text); }

.notice { background: var(--bg); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; color: var(--hint); }
.ready-box { border: 1.5px solid #16a34a; background: rgba(22, 163, 74, 0.08); border-radius: 10px; padding: 12px; margin-top: 12px; }
.ready-box p { margin: 0 0 10px; }
.status-err { color: var(--danger); margin-top: 10px; font-size: 14px; }
.link-btn { background: none; border: none; color: var(--link); cursor: pointer; padding: 0; text-decoration: underline; font-size: inherit; }

/* ---- preview ---- */
.pv-wrap { position: relative; overflow: hidden; direction: ltr; border-radius: 6px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18); background: #fff; }
.pv-wrap iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: 0 0; background: #fff; }
.aside-title { font-size: 13px; color: var(--hint); margin: 16px 0 8px; }
.overlay {
  position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto;
  padding: 12px 12px calc(24px + var(--safe-bottom));
}
.overlay-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.overlay-head h2 { font-size: 16px; margin: 0; }

/* ---- modal ---- */
.modal-back { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--card); width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + var(--safe-bottom));
}
@media (min-width: 600px) { .modal-back { align-items: center; } .modal { border-radius: 16px; } }
.modal h2 { margin-top: 0; font-size: 17px; }
.modal h3 { font-size: 15px; margin: 14px 0 4px; }
.modal p, .modal li { font-size: 14px; }
