/* Checkout: the form, the summary panel, and the receipt.

   Loaded only on checkout and the confirmation. No colour literal appears here -
   every value reads from tokens.css. */

.checkout {
  display: grid;
  gap: 20px;
}

.checkout__form {
  display: grid;
  gap: 16px;
}

/* Field ---------------------------------------------------------------- */
.field {
  display: grid;
  gap: 6px;
}

.field__label {
  font-size: var(--text-meta);
  font-weight: 800;
  color: var(--ink);
}

.field__optional {
  font-weight: 600;
  color: var(--ink-muted);
}

/* 48px on desktop as the specification asks for the submit control, and a
   comfortable 44px at every size on the way there. */
.field__input {
  inline-size: 100%;
  min-block-size: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-ctrl);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.field__input--area {
  min-block-size: 88px;
  resize: vertical;
}

.field__input:focus-visible {
  outline: 2px solid var(--pink-ink);
  outline-offset: 1px;
  border-color: var(--pink-ink);
}

/* A field in error carries a border AND a message. Red alone would be the only
   signal for someone who cannot see it. */
.field--bad .field__input {
  border-color: var(--danger);
  background: var(--pink-tint);
}

.field__hint {
  font-size: 12px;
  color: var(--ink-muted);
}

.field__error {
  font-size: 12px;
  font-weight: 700;
  color: var(--danger);
}

.formerror {
  margin-block-end: 12px;
  padding: 12px 14px;
  background: var(--pink-tint);
  border: 1px solid var(--danger);
  border-radius: var(--radius-ctrl);
  color: var(--danger);
  font-weight: 700;
  font-size: var(--text-meta);
}

.field-row {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  /* Region and area side by side once there is room for both. */
  .field-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* Summary -------------------------------------------------------------- */
.checkout__summary {
  align-self: start;
}

.checkout__submit {
  inline-size: 100%;
  margin-block-start: 12px;
  text-align: center;
}

@media (min-width: 1024px) {
  /* Two columns from 1024px. The form takes the first column, which in RTL is
     the right edge - the fields are what she must act on, so they get the side
     the eye lands on first. The summary is reference material and follows. */
  .checkout {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 28px;
    align-items: start;
  }

  .checkout__summary {
    position: sticky;
    inset-block-start: calc(var(--header-h) + 16px);
  }

  .field__input {
    min-block-size: 48px;
  }

  .checkout__submit {
    min-block-size: 48px;
  }
}

/* Receipt -------------------------------------------------------------- */
/* Single column at every width, matching Screen 06 of V3 Warm Editorial.
   Capped at 640px-720px and centered across mobile and desktop. */
.receipt {
  max-inline-size: 640px;
  margin-inline: auto;
  padding-block: 16px 40px;
}

.receipt__header {
  text-align: center;
  margin-block-end: 20px;
}

/* 66px circular badge in soft pink with pink-ink checkmark */
.receipt__badge {
  inline-size: 66px;
  block-size: 66px;
  border-radius: var(--radius-pill);
  background: var(--pink-soft);
  color: var(--pink-ink);
  display: grid;
  place-items: center;
  margin-inline: auto;
  margin-block-end: 14px;
}

.receipt__badge-icon {
  inline-size: 26px;
  block-size: 26px;
}

.receipt__eyebrow {
  font-size: var(--text-meta);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pink-ink);
  margin-block: 0 4px;
}

.receipt__title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin-block: 0 8px;
  line-height: 1.3;
}

.receipt__subtitle {
  font-size: var(--text-meta);
  line-height: 1.55;
  color: var(--ink-muted);
  margin-block: 0;
}

.receipt__reference {
  font-family: var(--font-price);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.receipt__subtitle-sep {
  margin-inline: 2px;
}

/* Card containers: rounded, lifted from warm paper with shadow-card */
.receipt__card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-block-end: 14px;
  box-shadow: var(--shadow-card);
}

/* Distinct styled container for the key status and payment facts */
.receipt__card--status {
  background: var(--paper-2);
  border: 1px solid var(--pink-line);
  padding: 14px 16px;
}

.receipt__card-title {
  font-size: var(--text-name);
  font-weight: 800;
  color: var(--ink);
  margin-block: 0 12px;
}

.receipt__card-text {
  font-size: var(--text-meta);
  line-height: 1.55;
  color: var(--ink-muted);
  margin-block: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Facts list */
.receipt__facts {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.receipt__facts--plain {
  gap: 10px;
}

.receipt__fact {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.receipt__fact dt {
  font-size: var(--text-meta);
  font-weight: 700;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.receipt__fact dd {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  text-align: end;
  min-inline-size: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.receipt__fact--notes dd {
  white-space: pre-line;
}

/* Amber/warn for unpaid payment status */
.receipt__val--warn {
  color: var(--warn);
  font-weight: 800;
}

.receipt__val--status {
  color: var(--ink);
  font-weight: 700;
}

/* Due row: separated by line, prominent pink-ink price */
.receipt__fact--due {
  border-block-start: 1px solid var(--line);
  margin-block-start: 12px;
  padding-block-start: 12px;
  align-items: baseline;
}

.receipt__fact--due dt {
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--ink);
  flex-shrink: 1;
  min-inline-size: 0;
}

.receipt__val--price,
.receipt__fact--due dd {
  font-family: var(--font-price);
  font-size: 21px;
  font-weight: 800;
  color: var(--pink-ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.receipt__pending {
  color: var(--warn);
  font-style: italic;
  font-size: var(--text-meta);
}

html[lang="ar"] .receipt__pending {
  font-style: normal;
}

.receipt__phone {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
}

/* Itemised lines */
.receipt__lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.receipt__lines .line,
.receipt__line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-block: 10px;
  padding-inline: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border-block-end: 1px solid var(--line);
  margin-block-end: 0;
}

.receipt__lines .line:last-child,
.receipt__line:last-child {
  border-block-end: none;
}

.receipt__line-lead {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-inline-size: 0;
  flex: 1;
}

.receipt__line-name {
  font-weight: 700;
  font-size: var(--text-body);
  color: var(--ink);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.receipt__line-qty {
  font-size: var(--text-meta);
  font-weight: 700;
  color: var(--ink-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.receipt__line-price {
  font-family: var(--font-price);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Summary inside receipt itemised breakdown card */
.receipt__summary {
  margin-block-start: 14px;
  padding: 12px 0 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border-block-start: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.receipt__summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: var(--text-meta);
  color: var(--ink-muted);
}

.receipt__summary-row .summary__label {
  font-weight: 600;
  color: var(--ink-muted);
  min-inline-size: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.receipt__summary-row .summary__value {
  font-family: var(--font-price);
  font-size: var(--text-body);
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.receipt__summary-row--total {
  border-block-start: 1px solid var(--line);
  margin-block-start: 8px;
  padding-block-start: 10px;
  font-size: var(--text-body);
  font-weight: 800;
  color: var(--pink-ink);
}

.receipt__summary-row--total .summary__label {
  font-weight: 800;
  color: var(--pink-ink);
  min-inline-size: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.receipt__summary-row--total .summary__value,
.receipt__summary-row--total .receipt__summary-val {
  font-family: var(--font-price);
  font-size: 20px;
  font-weight: 800;
  color: var(--pink-ink);
  white-space: nowrap;
  flex-shrink: 0;
}

.receipt__actions {
  margin-block-start: 14px;
}

.receipt__actions .btn {
  inline-size: 100%;
}

@media (min-width: 640px) {
  .receipt {
    padding-block: 24px 48px;
  }

  .receipt__title {
    font-size: 24px;
  }

  .receipt__actions .btn {
    inline-size: auto;
  }
}

@media print {
  .site-header,
  .bottom-nav,
  .receipt__actions,
  .skip-link,
  .toast,
  .site-footer {
    display: none !important;
  }

  .receipt {
    padding-block: 0;
    max-inline-size: 100%;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .receipt__card {
    box-shadow: none;
    border: 1px solid var(--line);
    break-inside: avoid;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* Location Autocomplete Picker -------------------------------------------- */
.location-search-wrap {
  position: relative;
}

.location-results {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  inset-block-start: 100%;
  margin-block-start: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card-hover);
  max-block-size: 240px;
  overflow-y: auto;
  z-index: 50;
}

.location-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  border-block-end: 1px solid var(--line);
  font-size: var(--text-sm);
  transition: background var(--transition-quick);
}

.location-item:last-child {
  border-block-end: 0;
}

.location-item:hover,
.location-item.is-highlighted {
  background: var(--pink-tint);
}

.location-item__fee {
  font-family: var(--font-price);
  font-weight: 700;
  color: var(--pink-ink);
  font-size: var(--text-meta);
}

.location-selected-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--pink-soft);
  border: 1px solid var(--pink-line);
  border-radius: var(--radius-card);
  margin-block-start: 8px;
}

.location-selected-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--pink-ink);
}

.location-selected-fee {
  font-family: var(--font-price);
  color: var(--pink-ink);
}

.location-change-btn {
  background: var(--surface);
  border: 1px solid var(--pink-line);
  color: var(--pink-ink);
  font-size: var(--text-meta);
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--transition-quick);
}

.location-change-btn:hover {
  background: var(--pink-tint);
}

.location-manual-toggle {
  margin-block-start: 8px;
}

.location-manual-summary {
  font-size: var(--text-meta);
  color: var(--pink-ink);
  cursor: pointer;
  user-select: none;
}

.location-manual-row {
  margin-block-start: 8px;
}

/* Payment Method Card ----------------------------------------------------- */
.payment-method-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border: 1.5px solid var(--pink-line);
  border-radius: var(--radius-card);
  background: var(--pink-tint);
}

.payment-method-card__inner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.payment-method-card__radio {
  accent-color: var(--pink-ink);
  inline-size: 18px;
  block-size: 18px;
  margin: 0;
}

.payment-method-card__label {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.payment-method-card__title {
  font-weight: 700;
  color: var(--ink);
  font-size: var(--text-sm);
}

.payment-method-card__desc {
  font-size: var(--text-meta);
  color: var(--ink-muted);
}

.payment-method-card__badge {
  font-size: var(--text-meta);
  font-weight: 700;
  background: var(--pink-soft);
  color: var(--pink-ink);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}


