/* ============================================================
   تعمیر مبل — استایل مشترک فرم مشتری و صفحه‌ی مدیریت
   ایده‌ی بصری: درز و بخیه‌ی مبل. خط‌چین زرد (نخ) فقط جایی می‌آید
   که چیزی را از چیز دیگر جدا می‌کند یا لبه‌ی «برگه‌ی کار» را می‌دوزد.
   ============================================================ */

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

:root {
  /* theme:start — مقدارهای پیش‌فرض؛ مقدارهای واقعی را /theme.css می‌گذارد */
  --velvet: #17353a;
  --thread: #e0a526;
  --thread-hover: #e6b54d;
  --thread-soft: #e5b650;
  --linen: #f1f2ee;
  --paper: #fbfbfa;
  --chalk: #ccd3d4;
  --edge: #7f9093;
  --seam: #b9c2c4;
  --wash: #f1f3f3;
  --wash-strong: #e3e7e7;
  --band-text: #f6f7f7;
  --band-dim: #dadfdf;
  --band-edge: #748689;
  /* theme:end */
  --ink: #1c2426;
  --muted: #55656a;
  --error: #a82e27;
  --error-bg: #fbedec;
  --error-line: #e3b2ae;
  --ok: #24704a;
}

/* بخیه‌ها از رنگ‌های بالا ساخته می‌شوند؛ روی پیش‌نمایش هم باید دوباره محاسبه شوند */
:root,
.preview {
  --stitch-dark: repeating-linear-gradient(to left, var(--seam) 0 9px, transparent 9px 16px);
  --stitch-thread: repeating-linear-gradient(to left, var(--thread) 0 9px, transparent 9px 16px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--linen);
  color: var(--ink);
  font: 400 1.0625rem/1.85 "Vazirmatn", Tahoma, system-ui, sans-serif;
}

h1, h2, h3, p, dl, dd, ul { margin: 0; padding: 0; }

a { color: var(--velvet); }

/* ---------- سرصفحه ---------- */

.band {
  position: relative;
  background: var(--velvet);
  color: var(--band-text);
  padding: 26px 20px 68px;
}

.band--slim { padding: 16px 20px 56px; }

.band::after {
  content: "";
  position: absolute;
  inset-inline: 20px;
  bottom: 38px;
  height: 2px;
  background: var(--stitch-thread);
}

.band--slim::after { bottom: 30px; }

.band-inner {
  max-width: 640px;
  margin: 0 auto;
}

.band-inner--wide { max-width: 880px; }

.band-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--band-dim);
}

.brand svg { flex: none; }

.band h1 {
  font-weight: 800;
  font-size: clamp(2rem, 8.5vw, 3.1rem);
  line-height: 1.3;
  margin: 18px 0 8px;
}

.band--slim h1 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  margin: 14px 0 0;
}

.lede {
  max-width: 34ch;
  color: var(--band-dim);
}

.band .btn-quiet {
  color: var(--band-text);
  border-color: var(--band-edge);
  min-height: 42px;
  padding: 0 16px;
  font-weight: 600;
}

.band .btn-quiet:hover { background: rgba(255, 255, 255, 0.08); }

/* ---------- صفحه و برگه‌ی فرم ---------- */

.page {
  max-width: 640px;
  margin: -30px auto 56px;
  padding: 0 16px;
  position: relative;
}

.page--wide { max-width: 880px; }

.ticket {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--chalk);
  border-radius: 14px;
  padding: 30px 22px 24px;
}

/* بخیه‌ی لبه‌ی برگه */
.ticket::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1.5px dashed var(--thread-soft);
  border-radius: 9px;
  pointer-events: none;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
  margin-bottom: 14px;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--velvet);
}

.seam {
  border: 0;
  height: 2px;
  margin: 26px 0;
  background: var(--stitch-dark);
}

/* ---------- فیلدها ---------- */

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.field:last-child { margin-bottom: 0; }

label, .label { font-weight: 600; }

.req {
  margin-inline-start: 8px;
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

input, select, textarea {
  font: inherit;
  font-size: 1rem; /* ۱۶ پیکسل؛ جلوی بزرگ‌شدن خودکار صفحه در iOS را می‌گیرد */
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--edge);
  border-radius: 8px;
}

textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.8;
}

input[type="tel"],
input[type="password"] {
  direction: ltr;
  text-align: right;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--velvet);
  outline-offset: 2px;
  border-color: var(--velvet);
}

/* ---------- آپلود عکس ---------- */

.drop {
  position: relative;
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 116px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  background: var(--wash);
  border: 2px dashed var(--edge);
  border-radius: 12px;
}

.drop:hover,
.drop.is-over {
  background: var(--wash-strong);
  border-color: var(--velvet);
}

.drop:focus-within {
  outline: 3px solid var(--velvet);
  outline-offset: 2px;
}

.drop strong {
  font-weight: 800;
  color: var(--velvet);
  font-size: 1.1rem;
}

.drop span { color: var(--muted); font-size: 0.95rem; }

.drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
}

.thumbs {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.thumbs:empty { display: none; }

.thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--chalk);
  border-radius: 8px;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb button {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--velvet);
  background: color-mix(in srgb, var(--velvet) 90%, transparent);
  color: #fff;
  font: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.thumb button:focus-visible {
  outline: 3px solid var(--thread);
  outline-offset: 2px;
}

/* ---------- دکمه‌ها ---------- */

.btn {
  font: inherit;
  font-weight: 800;
  min-height: 54px;
  padding: 0 26px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.btn:focus-visible {
  outline: 3px solid var(--velvet);
  outline-offset: 3px;
}

.band .btn:focus-visible { outline-color: var(--thread); }

.btn-primary {
  width: 100%;
  margin-top: 28px;
  background: var(--thread);
  color: var(--ink);
}

.btn-primary:hover { background: var(--thread-hover); }

.btn[disabled] { opacity: 0.6; cursor: progress; }

.btn-quiet {
  background: transparent;
  color: var(--velvet);
  border: 1.5px solid var(--velvet);
}

.btn-danger {
  min-height: 44px;
  padding: 0 18px;
  background: transparent;
  color: var(--error);
  border: 1.5px solid var(--error);
  font-weight: 600;
}

.btn-danger:hover { background: var(--error-bg); }

/* ---------- پیام‌ها ---------- */

.notice {
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1.5px solid;
  border-radius: 8px;
  font-weight: 600;
}

.notice-error {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error-line);
}

/* ---------- پس از ثبت موفق ---------- */

.done { text-align: center; padding: 14px 0 6px; }

.done h2 {
  font-weight: 800;
  font-size: 1.7rem;
  line-height: 1.5;
  color: var(--velvet);
  margin-bottom: 6px;
}

.done h2:focus { outline: none; }

/* تنها حرکتِ خودکار صفحه: بخیه، پس از ثبت، از راست به چپ دوخته می‌شود */
.sew {
  height: 2px;
  margin: 20px 0 22px;
  background: var(--stitch-thread);
  clip-path: inset(0 0 0 100%);
  animation: sew 1.2s steps(26, end) forwards;
}

@keyframes sew { to { clip-path: inset(0 0 0 0); } }

@media (prefers-reduced-motion: reduce) {
  .sew { animation: none; clip-path: none; }
}

/* ============================================================
   صفحه‌ی مدیریت
   ============================================================ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.chip {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  min-height: 42px;
  padding: 0 16px;
  color: var(--velvet);
  background: #fff;
  border: 1.5px solid var(--edge);
  border-radius: 999px;
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  color: #fff;
  background: var(--velvet);
  border-color: var(--velvet);
}

.chip:focus-visible {
  outline: 3px solid var(--velvet);
  outline-offset: 2px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 4px;
  color: var(--muted);
}

.job {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 24px 0;
}

.job + .job::before {
  content: "";
  position: absolute;
  top: 0;
  inset-inline: 0;
  height: 2px;
  background: var(--stitch-dark);
}

.job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
}

.job h3 {
  font-weight: 800;
  font-size: 1.2rem;
  line-height: 1.6;
}

.badge {
  display: inline-block;
  padding: 2px 12px;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1.5px solid;
  border-radius: 999px;
}

.s0 { color: #6b4a00; background: #fff3d6; border-color: #e7c772; }
.s1 { color: #1d4b63; background: #e1eef4; border-color: #a9cbda; }
.s2 { color: #4b2f7a; background: #ede6f6; border-color: #c6b4e0; }
.s3 { color: #1f5b3a; background: #e0f0e6; border-color: #a7d1b6; }
.s4 { color: #4a4f50; background: #ececea; border-color: #c5c8c6; }

.meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 16px;
}

.meta dt { color: var(--muted); }
.meta dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

.photos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photos a {
  display: block;
  width: 92px;
  height: 92px;
  overflow: hidden;
  background: var(--chalk);
  border-radius: 8px;
}

.photos a:focus-visible {
  outline: 3px solid var(--velvet);
  outline-offset: 2px;
}

.photos img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.job-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.job-actions label { font-weight: 600; }

.job-actions select {
  width: auto;
  min-width: 170px;
  min-height: 44px;
}

.job-actions .btn-danger { margin-inline-start: auto; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding-top: 20px;
  background: var(--stitch-dark) top / 100% 2px no-repeat;
}

.pager .btn { min-height: 46px; padding: 0 20px; font-weight: 600; }

.empty {
  padding: 40px 8px;
  text-align: center;
  color: var(--muted);
}

.toast {
  position: fixed;
  inset-inline: 16px;
  bottom: 18px;
  max-width: 420px;
  margin-inline: auto;
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  color: #fff;
  background: var(--velvet);
  border-radius: 10px;
}

.toast.is-error { background: var(--error); }

/* ---------- صفحه‌های بزرگ‌تر ---------- */

@media (min-width: 720px) {
  .ticket { padding: 38px 40px 32px; }
  .ticket::before { inset: 9px; }
  .thumbs { grid-template-columns: repeat(5, 1fr); }
  .btn-primary { width: auto; min-width: 240px; }
}

/* ============================================================
   تاریخ شمسی، زبانه‌ها و بخش «ظاهر سایت»
   ============================================================ */

/* ---------- تقویم ---------- */

.date-picker {
  position: relative;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.date-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 14px;
  font: inherit;
  font-size: 1rem;
  text-align: start;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--edge);
  border-radius: 8px;
  cursor: pointer;
}

.date-btn[data-empty="true"] span { color: var(--muted); }
.date-btn svg { flex: none; color: var(--muted); }
.date-btn:focus-visible, .date-clear:focus-visible, .cal-nav:focus-visible, .cal-day:focus-visible {
  outline: 3px solid var(--thread);
  outline-offset: 2px;
}

.date-clear {
  flex: none;
  width: 50px;
  font: inherit;
  font-size: 1.4rem;
  color: var(--muted);
  background: #fff;
  border: 1.5px solid var(--edge);
  border-radius: 8px;
  cursor: pointer;
}

.cal {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 6px);
  z-index: 20;
  padding: 12px;
  background: #fff;
  border: 1.5px solid var(--edge);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cal-title { font-weight: 700; }

.cal-nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--ink);
  background: var(--wash);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.cal-nav:disabled { opacity: 0.35; cursor: default; }

.cal-grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: center;
}

.cal-grid th {
  padding: 6px 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.cal-grid td { padding: 2px; }

.cal-day {
  width: 100%;
  min-height: 42px;
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.cal-day:hover:not(:disabled) { background: var(--wash-strong); }
.cal-day:disabled { color: #9aa6a9; cursor: default; text-decoration: line-through; }
.cal-day.is-friday, .cal-grid th.is-friday { color: var(--error); }
.cal-day.is-today { border-color: var(--edge); }
.cal-day[aria-pressed="true"] {
  color: var(--band-text);
  background: var(--velvet);
  border-color: var(--velvet);
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  background: var(--stitch-dark) bottom / 100% 2px no-repeat;
}

.tab {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 0 22px;
  color: var(--velvet);
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}

.tab:hover { background: var(--wash-strong); }

.tab[aria-selected="true"] {
  color: #fff;
  background: var(--velvet);
}

.tab:focus-visible {
  outline: 3px solid var(--velvet);
  outline-offset: 2px;
}

.notice-warn {
  color: #6b4a00;
  background: #fff3d6;
  border-color: #e7c772;
}

.presets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin: 8px 0 22px;
}

.preset {
  font: inherit;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--edge);
  border-radius: 10px;
  cursor: pointer;
  text-align: start;
}

.preset:hover { background: var(--wash); }

.preset[aria-pressed="true"] {
  border-color: var(--velvet);
  box-shadow: inset 0 0 0 1.5px var(--velvet);
}

.preset:focus-visible {
  outline: 3px solid var(--velvet);
  outline-offset: 2px;
}

.swatches {
  display: inline-flex;
  flex: none;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.swatch {
  width: 16px;
  height: 28px;
}

.colors {
  display: grid;
  gap: 14px;
}

.color-field {
  display: flex;
  align-items: center;
  gap: 14px;
}

.color-field input[type="color"] {
  flex: none;
  width: 64px;
  min-height: 50px;
  padding: 4px;
  cursor: pointer;
}

.color-name {
  display: grid;
  line-height: 1.6;
}

.color-name .hint { line-height: 1.5; }

.hex {
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--muted);
  font-size: 0.9rem;
}

.preview {
  overflow: hidden;
  color: var(--ink);
  background: var(--linen);
  border: 1.5px solid var(--edge);
  border-radius: 12px;
  pointer-events: none;
  user-select: none;
}

.preview .band { padding: 16px 16px 46px; }
.preview .band::after { inset-inline: 16px; bottom: 26px; }
.preview .band h1 { font-size: 1.4rem; margin: 10px 0 2px; }
.preview .lede { font-size: 0.95rem; line-height: 1.7; }
.preview .ticket { margin: -24px 14px 16px; padding: 16px; }
.preview .ticket::before { inset: 5px; }

.pv-field {
  min-height: 42px;
  margin-bottom: 12px;
  padding: 6px 12px;
  color: var(--muted);
  background: #fff;
  border: 1.5px solid var(--edge);
  border-radius: 8px;
}

.preview .btn {
  display: grid;
  place-items: center;
  width: auto;
  min-height: 46px;
  margin-top: 4px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 26px;
}

.form-actions .btn-primary {
  width: auto;
  min-width: 160px;
  margin-top: 0;
}

.colors + .notice {
  margin: 16px 0 0;
}

/* ---------- پیامک و فهرست مبل در پنل ---------- */

.sms-state { font-size: 0.85rem; color: var(--muted); }
.sms-state.is-failed { color: var(--error); }
.counter { font-size: 0.85rem; color: var(--muted); }
.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.checkbox input { width: 22px; min-height: 22px; height: 22px; }
.sms-preview {
  padding: 12px 14px;
  background: var(--wash);
  border: 1.5px dashed var(--seam);
  border-radius: 8px;
  line-height: 1.8;
}
