/* HetiPaku v2 — order form
   D3a: vehicle-first chip cards + progressive reveal + photo upload.
   D3b later wires OSRM + map + address autocomplete + OTP. */

:root {
  --hp-orange: #ff5a1f;
  --hp-orange-dark: #ea580c;
  --hp-orange-soft: #fff7ed;
  --hp-text: #15171a;
  --hp-muted: #4b5563;
  --hp-faint: #9ca3af;
  --hp-line: #e5e7eb;
  --hp-bg: #f4f5f7;
  --hp-card: #ffffff;
  --hp-success: #15803d;
  --hp-success-bg: #f0fdf4;
}

* { box-sizing: border-box; }

body.order-new {
  margin: 0;
  background: var(--hp-bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--hp-text);
  line-height: 1.5;
}

.hp-nav {
  background: var(--hp-card);
  border-bottom: 1px solid var(--hp-line);
  padding: 12px 0;
}
.hp-nav__inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.hp-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.hp-brand__mark {
  width: 32px; height: 32px;
  background: var(--hp-orange);
  color: #fff;
  font-weight: 800;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.hp-brand__name { font-weight: 800; font-size: 17px; }

.hp-nav__user {
  font-size: 14px;
  color: var(--hp-muted);
}
.hp-nav__user a { color: var(--hp-orange); text-decoration: none; font-weight: 600; }

.order-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.hero {
  text-align: center;
  margin-bottom: 24px;
}
.hero__title {
  font-size: clamp(28px, 6vw, 38px);
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.hero__title em {
  color: var(--hp-orange);
  font-style: normal;
}
.hero__sub {
  color: var(--hp-muted);
  font-size: 15px;
  margin: 0;
}

.section {
  background: var(--hp-card);
  border: 1.5px solid var(--hp-line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(15, 20, 40, 0.03);
}
.section[hidden] { display: none; }

.section__title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 4px;
}
.section__hint {
  font-size: 13px;
  color: var(--hp-faint);
  margin: 0 0 16px;
}

/* address inputs */
.addr-block { display: flex; flex-direction: column; gap: 14px; position: relative; }
.addr {
  position: relative;
  border: 1.5px solid var(--hp-line);
  border-radius: 12px;
  padding: 14px 16px 14px 44px;
  transition: border-color 0.15s, background 0.15s;
  background: var(--hp-card);
}

/* Inline "missing house number" warning */
.addr-warn[hidden] { display: none !important; }
.addr-warn {
  margin: 8px 0 0;
  padding: 0;
  font-size: 12px;
  color: #991b1b;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.addr-warn__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: 50%;
  font-weight: 800;
  font-size: 11px;
}

/* When the address row carries a warning, hint the field too */
.addr.has-addr-warn {
  border-color: #fca5a5;
  background: #fff7ed;
}

/* Places autocomplete dropdown */
.addr-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1.5px solid var(--hp-line);
  border-radius: 12px;
  z-index: 20;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(15, 20, 40, 0.10);
}
.addr-suggest__item {
  padding: 12px 14px;
  cursor: pointer;
  border-top: 1px solid #f3f4f6;
  font-size: 14px;
  color: var(--hp-text);
}
.addr-suggest__item:first-child { border-top: 0; }
.addr-suggest__item:hover,
.addr-suggest__item.is-active {
  background: var(--hp-orange-soft);
}
.addr-suggest__item.is-active {
  box-shadow: inset 3px 0 0 var(--hp-orange);
}
.addr-suggest__sub {
  font-size: 12px;
  color: var(--hp-faint);
  margin-top: 2px;
}
.addr:focus-within {
  border-color: var(--hp-orange);
  background: var(--hp-orange-soft);
}
.addr__dot {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--hp-orange);
}
.addr--from .addr__dot { background: var(--hp-orange); }
.addr--to .addr__dot {
  background: var(--hp-card);
  border: 3px solid var(--hp-orange);
  width: 12px; height: 12px;
}
.addr__label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hp-muted);
  font-weight: 700;
  margin-bottom: 2px;
}
.addr__input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: var(--hp-text);
  font-family: inherit;
  padding-right: 90px;
}

/* GPS quick-fill button, sits inside .addr.--from on the right */
.addr__gps {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--hp-orange-soft);
  color: var(--hp-orange);
  border: 1px solid var(--hp-orange);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: all 0.15s;
}
.addr__gps:hover {
  background: var(--hp-orange);
  color: #fff;
}
.addr__gps.is-loading {
  opacity: 0.65;
  cursor: progress;
}
.addr__gps.is-error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}
.addr__gps-icon { font-size: 13px; }
@media (max-width: 480px) {
  .addr__gps-label { display: none; }
  .addr__gps { padding: 6px 10px; }
  .addr__input { padding-right: 50px; }
}

/* vehicle picker (the headline of D3a) */
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 720px) {
  .vehicle-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  /* 5 cards in a 2-column grid leaves the last one alone on its
     row, so let it span both columns for a clean bottom. */
  .vehicle-card:nth-child(5) { grid-column: 1 / -1; }
}
.vehicle-card {
  background: var(--hp-card);
  border: 2px solid var(--hp-line);
  border-radius: 14px;
  padding: 0 10px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  user-select: none;
  overflow: hidden;
}
.vehicle-card:hover {
  border-color: var(--hp-orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 90, 31, 0.12);
}
.vehicle-card.is-selected {
  border-color: var(--hp-orange);
  background: var(--hp-orange-soft);
  box-shadow: 0 0 0 4px rgba(255, 90, 31, 0.12);
}
.vehicle-card.is-selected::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  background: var(--hp-orange);
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  display: inline-flex;
  align-items: center; justify-content: center;
}
.vehicle-card__art {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 -10px 4px;
}
.vehicle-card__img {
  width: 100%;
  height: auto;
  max-height: 130px;
  display: block;
  object-fit: contain;
}
.vehicle-card__fallback,
.vehicle-card__emoji {
  font-size: 36px;
  line-height: 1;
}
.vehicle-card__name {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 2px;
}
.vehicle-card__size {
  font-size: 11px;
  color: var(--hp-faint);
  margin-bottom: 8px;
}
.vehicle-card__payload {
  font-size: 12px;
  color: var(--hp-muted);
  line-height: 1.35;
  min-height: 32px;
}

/* selected-collapsed (after pick, only the chosen card is shown with a Change button) */
.vehicle-selected {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--hp-orange-soft);
  border: 1.5px solid var(--hp-orange);
  border-radius: 12px;
  padding: 14px;
}
.vehicle-selected__emoji { font-size: 36px; }
.vehicle-selected__body { flex: 1; }
.vehicle-selected__name { font-weight: 700; font-size: 15px; }
.vehicle-selected__meta { font-size: 12px; color: var(--hp-muted); }
.vehicle-selected__change {
  background: transparent;
  border: 1px solid var(--hp-orange);
  color: var(--hp-orange);
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}

/* helper + when chip groups (simpler than vehicle cards) */
.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  background: var(--hp-card);
  border: 2px solid var(--hp-line);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  color: var(--hp-text);
}
.chip:hover { border-color: var(--hp-orange); }
.chip.is-selected {
  background: var(--hp-orange);
  color: #fff;
  border-color: var(--hp-orange);
}

.when-picker {
  margin-top: 12px;
}
.when-picker__label {
  display: block;
  font-size: 13px;
  color: var(--hp-muted);
  margin-bottom: 6px;
}
.when-picker__input {
  width: 100%;
  max-width: 320px;
  padding: 10px 14px;
  border: 1.5px solid var(--hp-line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}

/* detail textarea + photo */
.detail-textarea {
  width: 100%;
  min-height: 80px;
  border: 1.5px solid var(--hp-line);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
}
.detail-textarea:focus { border-color: var(--hp-orange); outline: none; }

.photo-up {
  margin-top: 16px;
  border: 2px dashed var(--hp-line);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.photo-up.has-file {
  border-style: solid;
  border-color: var(--hp-orange);
  background: var(--hp-orange-soft);
}
.photo-up__input { display: none; }
.photo-up__btn {
  background: transparent;
  border: 1.5px solid var(--hp-orange);
  color: var(--hp-orange);
  padding: 10px 22px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  display: inline-block;
}
.photo-up__btn:hover { background: var(--hp-orange-soft); }
.photo-up__hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--hp-faint);
}
.photo-up__preview { display: none; align-items: center; gap: 12px; }
.photo-up.has-file .photo-up__btn { display: none; }
.photo-up.has-file .photo-up__preview { display: flex; }
.photo-up.has-file .photo-up__hint { display: none; }
.photo-up__img {
  max-width: 100px;
  max-height: 100px;
  border-radius: 8px;
  object-fit: cover;
}
.photo-up__filename {
  flex: 1;
  text-align: left;
  font-size: 13px;
  color: var(--hp-muted);
  word-break: break-all;
}
.photo-up__remove {
  background: transparent;
  border: 1px solid var(--hp-faint);
  color: var(--hp-muted);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

/* contact section fields */
.field {
  margin-bottom: 12px;
}
.field__label {
  display: block;
  font-size: 13px;
  color: var(--hp-muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.field__input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--hp-line);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
}
.field__input:focus { border-color: var(--hp-orange); outline: none; }
.field__hint {
  font-size: 12px;
  color: var(--hp-faint);
  margin: 4px 0 0;
}

/* submit */
.submit-row {
  margin-top: 24px;
}
.submit-row[hidden] { display: none; }
.submit-btn {
  width: 100%;
  background: var(--hp-orange);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 16px 24px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 4px 12px rgba(255, 90, 31, 0.25);
  transition: transform 0.1s, box-shadow 0.15s;
}
.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 90, 31, 0.35);
}
.submit-btn:active { transform: translateY(0); }
.submit-hint {
  text-align: center;
  font-size: 12px;
  color: var(--hp-faint);
  margin: 8px 0 0;
}

/* honeypot (visually hidden) */
.honey {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* received page */
.received-card {
  background: var(--hp-card);
  border: 1.5px solid var(--hp-line);
  border-radius: 14px;
  padding: 32px 24px;
  text-align: center;
}
.received-card__icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.received-card__title {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 8px;
}
.received-card__body {
  color: var(--hp-muted);
  margin: 0 0 16px;
}
.received-card__code {
  display: inline-block;
  background: var(--hp-orange-soft);
  color: var(--hp-orange-dark);
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 14px;
}
.received-card__back {
  display: inline-block;
  margin-top: 16px;
  color: var(--hp-orange);
  text-decoration: none;
  font-weight: 600;
}

/* ─────────────── order progress pipeline (ported from v1) ─────────────── */
.pipe {
  display: grid;
  gap: 0;
  margin: 18px 0 6px;
  position: relative;
  text-align: initial;
}
.pipe--n6 { grid-template-columns: repeat(6, 1fr); }
.pipe--n5 { grid-template-columns: repeat(5, 1fr); }
.pipe--n4 { grid-template-columns: repeat(4, 1fr); }
.pipe__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  padding-top: 4px;
}
.pipe__step::before {
  content: '';
  position: absolute;
  top: 17px; left: 0; right: 0;
  height: 2px;
  background: #e5e7eb;
  z-index: 0;
}
.pipe__step:first-child::before { left: 50%; }
.pipe__step:last-child::before  { right: 50%; }
.pipe__step--done::before,
.pipe__step--current::before { background: var(--hp-orange, #ff5a1f); }
.pipe__step:last-child.pipe__step--current::before { background: #e5e7eb; }
.pipe__dot {
  position: relative;
  z-index: 1;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
}
.pipe__step--done .pipe__dot {
  background: var(--hp-orange, #ff5a1f);
  border-color: var(--hp-orange, #ff5a1f);
  color: #fff;
}
.pipe__step--current .pipe__dot {
  background: #fff;
  border-color: var(--hp-orange, #ff5a1f);
  color: var(--hp-orange, #ff5a1f);
  box-shadow: 0 0 0 4px rgba(255, 90, 31, 0.14);
}
.pipe__step--current .pipe__dot::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--hp-orange, #ff5a1f);
  opacity: .5;
  animation: pipePulse 1.6s ease-out infinite;
}
@keyframes pipePulse {
  0%   { transform: scale(.8); opacity: .55; }
  100% { transform: scale(1.5); opacity: 0;   }
}
.pipe__label {
  margin-top: 7px;
  font-size: 10px;
  line-height: 1.25;
  color: #6b7280;
  text-align: center;
  font-weight: 500;
  letter-spacing: 0.01em;
  max-width: 70px;
}
.pipe__step--done .pipe__label,
.pipe__step--current .pipe__label { color: #15171a; }
.pipe__step--current .pipe__label { color: #c2410c; font-weight: 700; }
