/* Public submission and success pages. Mobile first: most users fill the form on a phone. */
@font-face {
  font-family: Vazirmatn;
  src: url('../vendor/vazirmatn/33.003/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Vazirmatn;
  src: url('../vendor/vazirmatn/33.003/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --brand: #047857;
  --brand-dark: #065f46;
  --brand-ink: #064e3b;
  --brand-soft: #e6f4ee;
  --bg: #f1f5f3;
  --surface: #ffffff;
  --line: #d8e4de;
  --input-line: #c3d4cc;
  --ink: #1b2a23;
  --muted: #5a6b63;
  --danger: #c0392b;
  --danger-soft: #fdecea;
  --note: #fff7e0;
  --note-line: #f0d68a;
  --note-ink: #684c00;
}

body.submit-page {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Vazirmatn, Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.8;
}

/* Header */
.hero {
  background: radial-gradient(circle at 15% 10%, #10a37a 0, transparent 45%),
              linear-gradient(160deg, var(--brand-ink), var(--brand) 70%);
  color: #fff;
  text-align: center;
  padding: 28px 16px 76px;
}
.hero-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  background: #fff;
  border-radius: 50%;
  padding: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.hero h1 { font-size: 1.55rem; font-weight: 700; margin: 12px 0 2px; }
.hero p { margin: 0; opacity: .9; font-size: .95rem; }
/* Stepper: number in a circle; the circle becomes a white tick when the step is complete. */
.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-width: 440px;
  margin: 16px auto 0;
  padding: 0;
  list-style: none;
}
.stepper a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
  font-size: .82rem;
  line-height: 1.4;
}
.stepper .dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .55);
  font-weight: 700;
  transition: background .2s, color .2s;
}
.stepper .dot .bi { display: none; font-size: 1.1rem; }
.stepper a.done { color: #fff; font-weight: 700; }
.stepper a.done .dot { background: #fff; border-color: #fff; color: var(--brand); }
.stepper a.done .dot span { display: none; }
.stepper a.done .dot .bi { display: block; }

/* Page and sections */
.page { max-width: 680px; margin: -52px auto 0; padding: 0 12px 150px; }
.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(6, 78, 59, .07);
  margin-bottom: 16px;
  scroll-margin-top: 16px;
}
.step-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.step-head h2 { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--brand-ink); }
.step-head p { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.5; }
.step-num {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.15rem;
  font-weight: 700;
  transition: background .2s, color .2s;
}
.step-num .bi-check-lg { display: none; }
.step.done .step-num { background: var(--brand); color: #fff; }
.step.done .step-num span { display: none; }
.step.done .step-num .bi-check-lg { display: block; }
.step-body { padding: 18px; }
.grid-2 { display: grid; gap: 0 14px; }
@media (min-width: 560px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Fields */
.field { margin-bottom: 16px; }
.field-label { display: block; font-weight: 700; font-size: .95rem; margin-bottom: 6px; }
.req { color: var(--danger); }
.field-box {
  display: flex;
  align-items: center;
  min-height: 56px;
  background: #fff;
  border: 1.5px solid var(--input-line);
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.field-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(4, 120, 87, .15); }
.field-box.ltr { direction: ltr; }
.field-box input {
  order: 1;
  flex: 1;
  min-width: 0;
  height: 53px;
  padding: 0 12px;
  border: 0 !important;
  outline: 0;
  box-shadow: none !important;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 1.05rem;
}
.field-box.ltr input {
  text-align: left;
  font-size: 1.2rem;
  letter-spacing: .05em;
  font-variant-numeric: tabular-nums;
}
/* Very light, so users do not think the example digits are already filled in. */
.field-box input::placeholder { color: #d2dbd6; opacity: 1; }
.field-icon { order: 0; flex: none; width: 46px; text-align: center; color: var(--brand); font-size: 1.25rem; }
.field-box.ltr .field-icon { order: 3; }
.field-prefix { order: 0; padding-left: 14px; font-weight: 700; font-size: 1.2rem; letter-spacing: .05em; color: var(--brand-ink); }
.field-box.has-prefix input { padding-left: 6px; padding-right: 4px; }
/* The IBAN is 30 characters with dashes: shrink it to fit a phone screen. */
.field-box.has-prefix input, .field-box.has-prefix .field-prefix { font-size: clamp(.78rem, 3.75vw, 1.2rem); letter-spacing: 0; }
.field-box.has-prefix .field-ok { padding: 0 6px; }
@media (max-width: 480px) { .field-box.has-prefix .field-icon { display: none; } }
.field-ok { order: 2; flex: none; display: none; padding: 0 10px; color: var(--brand); font-size: 1.2rem; }
.field.valid .field-ok { display: block; }
.field-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: .82rem; color: var(--muted); line-height: 1.6; }
.field-help { flex: 1 1 60%; }
.field-bank { color: var(--brand-dark); font-weight: 700; }
.field-count { white-space: nowrap; }
.field-count.full { color: var(--brand); font-weight: 700; }
.field-error { display: none; gap: 6px; align-items: flex-start; margin-top: 4px; color: var(--danger); font-size: .88rem; line-height: 1.6; }
.field-error .bi { margin-top: 2px; }
.field.has-error .field-error { display: flex; }
.field.has-error .field-box { border-color: var(--danger); background: #fffafa; }
.field.has-error .field-box:focus-within { box-shadow: 0 0 0 4px rgba(192, 57, 43, .15); }
.field.has-error .field-ok { display: none; }
.field-error-text { color: var(--danger); font-size: .88rem; margin-bottom: 8px; }

/* Notices */
.notice, .alert-box { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: .92rem; line-height: 1.7; }
.notice { background: var(--note); border: 1px solid var(--note-line); color: var(--note-ink); }
.alert-box { background: var(--danger-soft); border: 1px solid #f3c1bb; color: #8e2219; }
.notice .bi, .alert-box .bi { margin-top: 3px; }
.alert-box ul { margin: 0; padding: 0; list-style: none; }

/* Saved values (stored only on the user's phone) */
.sub-head { font-size: 1rem; font-weight: 700; color: var(--brand-ink); margin: 8px 0 12px; padding-top: 14px; border-top: 1px dashed var(--line); }
.saved-note { background: var(--brand-soft); border-color: #b9dfcd; color: var(--brand-ink); }
.saved-picker { margin-bottom: 14px; }
.saved-title { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.saved-list { display: flex; flex-wrap: wrap; gap: 8px; }
.saved-chip {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  background: #fff;
  border: 1.5px solid var(--brand);
  border-radius: 12px;
  overflow: hidden;
}
.saved-chip.selected { background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
/* Name on the first line, full numbers below it. */
.saved-use {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 46px;
  padding: 6px 12px;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  font-family: inherit;
  line-height: 1.6;
  text-align: start;
}
.saved-use strong { font-weight: 700; }
.saved-use bdi {
  color: var(--ink);
  font-size: clamp(.72rem, 3.4vw, .95rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
}
.saved-remove {
  flex: none;
  width: 40px;
  border: 0;
  border-inline-start: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.saved-remove:hover, .saved-remove:focus-visible { background: var(--danger-soft); color: var(--danger); }
.forget-saved { text-align: center; color: var(--muted); font-size: .85rem; margin: 4px 0 16px; }
.link-btn {
  min-height: 44px;
  padding: 4px 10px;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-family: inherit;
  font-size: .9rem;
  text-decoration: underline;
}

/* Prize codes */
.award-entry { background: #f7faf9; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px 0; margin-bottom: 12px; }
.award-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.award-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: .9rem;
  font-weight: 700;
}
.award-remove {
  min-height: 40px;
  padding: 4px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--danger);
  font-family: inherit;
  font-size: .9rem;
}
.award-remove:hover, .award-remove:focus-visible { background: var(--danger-soft); }
.add-award {
  width: 100%;
  min-height: 56px;
  border: 2px dashed var(--brand);
  border-radius: 14px;
  background: #fff;
  color: var(--brand);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
}
.add-award:hover, .add-award:focus-visible { background: var(--brand-soft); }
.awards-note { margin: 8px 0 0; text-align: center; font-size: .85rem; color: var(--muted); }

/* Extra questions (rendered by crispy forms) */
.extra .form-label { font-weight: 700; }
.extra .form-control, .extra .form-select { min-height: 52px; border: 1.5px solid var(--input-line); border-radius: 12px; font-family: inherit; }
.extra .form-control:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(4, 120, 87, .15); }
.extra .form-check-inline { margin: 0 0 8px 8px; padding: 0; }
.extra .form-check-inline .form-check-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.extra .form-check-inline .form-check-label {
  display: inline-block;
  min-height: 44px;
  padding: 8px 18px;
  border: 1.5px solid var(--brand);
  border-radius: 999px;
  color: var(--brand);
  cursor: pointer;
}
.extra .form-check-input:checked + .form-check-label { background: var(--brand); color: #fff; }
.extra .form-check-input:focus-visible + .form-check-label { box-shadow: 0 0 0 4px rgba(4, 120, 87, .25); }
.extra-error { color: var(--danger); font-size: .88rem; }

/* Buttons */
.cta, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 14px;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
}
.cta { border: 0; background: var(--brand); color: #fff; }
.cta:hover, .cta:focus-visible { background: var(--brand-dark); color: #fff; }
.cta:disabled { opacity: .7; }
.ghost { border: 1.5px solid var(--input-line); background: #fff; color: var(--ink); }
.ghost:hover, .ghost:focus-visible { background: var(--bg); }

/* Sticky submit bar */
.submit-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .97);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .06);
}
.submit-inner { display: flex; align-items: center; gap: 12px; max-width: 680px; margin: auto; }
.submit-info { flex: 1; min-width: 0; line-height: 1.5; }
.submit-info strong { display: block; color: var(--brand-ink); }
.submit-info small { color: var(--muted); }
.submit-info small.error { color: var(--danger); font-weight: 700; }

/* Narrow phones (320–400px): smaller gaps so long numbers fit without side scrolling. */
@media (max-width: 400px) {
  .page { padding-inline: 8px; }
  .hero { padding-inline: 8px; }
  .step-head { padding: 14px 12px; }
  .step-body { padding: 14px 12px; }
  .award-entry { padding-inline: 10px; }
  .field-icon { width: 36px; font-size: 1.1rem; }
  .field-ok { padding: 0 6px; }
  .field-box.ltr input { padding: 0 8px; font-size: clamp(.95rem, 4.6vw, 1.2rem); letter-spacing: .02em; }
  .field-box.has-prefix input { padding: 0 4px 0 6px; font-size: clamp(.78rem, 3.75vw, 1.2rem); letter-spacing: 0; }
  .submit-bar { padding-inline: 8px; }
  .submit-inner { gap: 8px; }
  .submit-info { overflow: hidden; }
  .submit-info small { display: none; }
  .submit-info small.error { display: block; }
  .cta { padding: 0 16px; }
}

/* Confirmation sheet */
body.sheet-open { overflow: hidden; }
.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 28, 20, .55);
}
.sheet[hidden] { display: none; }
.sheet-panel {
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  background: #fff;
  border-radius: 22px 22px 0 0;
  animation: sheet-up .2s ease-out;
}
@media (min-width: 600px) {
  .sheet { align-items: center; }
  .sheet-panel { border-radius: 22px; }
}
@media (prefers-reduced-motion: reduce) { .sheet-panel { animation: none; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-panel h2 { font-size: 1.2rem; font-weight: 700; color: var(--brand-ink); margin: 0; }
.sheet-lead { color: var(--muted); font-size: .92rem; margin: 4px 0 0; }
.summary { margin: 12px 0 18px; }
.summary > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary > div.stack { display: block; }
.summary dt { font-weight: 400; color: var(--muted); }
.summary dt span { color: var(--brand-dark); font-weight: 700; }
.summary dd { margin: 0; font-weight: 700; }
.summary .num { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.summary .big { font-size: clamp(1rem, 4.4vw, 1.2rem); white-space: nowrap; color: var(--brand-ink); }
.code-list { margin: 4px 0 0; padding: 0 20px 0 0; }
.code-list li { padding: 2px 0; }
.code-list bdi { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; }
@media (min-width: 600px) { .sheet-actions { flex-direction: row; } .sheet-actions .cta { flex: 1; } }

/* Success page */
.done-card { text-align: center; padding: 28px 20px; }
.done-icon {
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 2.6rem;
}
.done-card h2 { font-size: 1.3rem; font-weight: 700; color: var(--brand-ink); margin: 14px 0 6px; }
.done-card p { color: var(--muted); margin: 0 0 20px; }
