/*
 * Parcel funnel — self-contained, scoped styles.
 * Everything is nested under #parcel-app and prefixed .pcl- so it can be dropped
 * into any host page (incl. easydelivery) without colliding with its CSS.
 * Plain CSS on purpose: no Tailwind/build step required to embed.
 */
#parcel-app {
  --pcl-orange: #ff6600;
  --pcl-orange-dark: #e55a00;
  --pcl-orange-tint: #ffe7d6;
  --pcl-ink: #1f2937;
  --pcl-muted: #6b7280;
  --pcl-line: #e5e7eb;
  --pcl-bg: #f7f7f8;
  --pcl-field: #f3f4f6;
  --pcl-green: #16a34a;
  --pcl-green-tint: #e7f6ec;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--pcl-ink);
  background: var(--pcl-bg);
  max-width: 660px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
  display: flex;
  flex-direction: column;
}
#parcel-app *,
#parcel-app *::before,
#parcel-app *::after { box-sizing: border-box; }
#parcel-app [x-cloak] { display: none !important; }

/* Header */
.pcl-header {
  background: var(--pcl-orange);
  color: #fff;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.pcl-header h1 { font-size: 18px; font-weight: 700; margin: 0; flex: 1; text-align: center; }
.pcl-back {
  background: rgba(255,255,255,.15);
  border: 0; color: #fff; width: 34px; height: 34px; border-radius: 9px;
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.pcl-back:disabled { opacity: 0; pointer-events: none; }
.pcl-header-spacer { width: 34px; }

/* Step dots */
.pcl-steps { display: flex; justify-content: center; gap: 6px; padding: 12px 0 4px; }
.pcl-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--pcl-line); transition: all .25s; }
.pcl-dot.is-active { background: var(--pcl-orange); width: 22px; }
.pcl-dot.is-done { background: var(--pcl-orange-tint); }

/* Body / cards */
.pcl-body { flex: 1; padding: 16px 16px 120px; }
.pcl-card { background: #fff; border: 1px solid var(--pcl-line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.pcl-card h2 { font-size: 16px; margin: 0 0 4px; }
.pcl-card .pcl-sub { color: var(--pcl-muted); font-size: 13px; margin: 0 0 14px; }
.pcl-title-lg { font-size: 20px; font-weight: 700; text-align: center; margin: 6px 0 16px; }

/* Labels + fields */
.pcl-label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
.pcl-field, .pcl-input, .pcl-select, .pcl-textarea {
  width: 100%; padding: 13px 14px; border: 1px solid var(--pcl-line);
  border-radius: 11px; background: var(--pcl-field); font-size: 15px; color: var(--pcl-ink);
  -webkit-appearance: none; appearance: none; font-family: inherit;
}
.pcl-textarea { min-height: 70px; resize: vertical; }
.pcl-input:focus, .pcl-select:focus, .pcl-textarea:focus { outline: 2px solid var(--pcl-orange); outline-offset: 1px; border-color: transparent; background-color: #fff; }
.pcl-input::placeholder, .pcl-textarea::placeholder { color: #9ca3af; }
/* appearance:none above strips the native arrow, so draw our own chevron. */
.pcl-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.pcl-field-group { margin-bottom: 14px; }
.pcl-field-icon { position: relative; }
.pcl-field-icon > svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--pcl-orange); width: 20px; height: 20px; }
.pcl-field-icon > .pcl-input { padding-left: 42px; }
.pcl-field-locked { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #eef0f2; color: var(--pcl-ink); cursor: not-allowed; }
.pcl-lock-note { font-size: 12px; color: var(--pcl-muted); white-space: nowrap; }
.pcl-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pcl-row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
/* 2×2 on small screens, four-across once there's room. */
.pcl-row4 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 480px) { #parcel-app .pcl-row4 { grid-template-columns: repeat(4, 1fr); } }

/* Segmented toggle (Domestic / International) */
.pcl-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: var(--pcl-orange-tint); padding: 6px; border-radius: 13px; margin-bottom: 18px; }
.pcl-seg button {
  border: 0; background: transparent; padding: 11px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--pcl-orange-dark); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
}
.pcl-seg button.is-active { background: var(--pcl-orange); color: #fff; box-shadow: 0 2px 6px rgba(255,102,0,.35); }

/* Buttons */
.pcl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px; border: 0; border-radius: 999px; background: var(--pcl-orange);
  color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.pcl-btn:hover { background: var(--pcl-orange-dark); }
.pcl-btn:disabled { opacity: .55; cursor: not-allowed; }
.pcl-btn-ghost { background: #fff; color: var(--pcl-ink); border: 1px solid var(--pcl-line); }
.pcl-btn-ghost:hover { background: var(--pcl-bg); }
.pcl-btn-sm { width: auto; padding: 10px 18px; font-size: 14px; }
/* Button sized to sit flush with an adjacent input (same height/radius). */
.pcl-btn-field { width: 100%; padding: 13px 14px; font-size: 15px; border-radius: 11px; }
.pcl-btn-link { background: none; border: 0; color: var(--pcl-orange); font-weight: 600; cursor: pointer; padding: 0; font-size: 14px; font-family: inherit; }

/* Radios (parcel size) */
.pcl-radio { display: flex; align-items: center; gap: 12px; padding: 14px 0; cursor: pointer; font-size: 15px; }
.pcl-radio input { accent-color: var(--pcl-orange); width: 20px; height: 20px; }

/* Quote option card */
/* Selected-option summary, shown on the downstream steps (3–5). */
.pcl-selected { display: flex; align-items: center; gap: 12px; background: var(--pcl-orange-tint); border: 1px solid var(--pcl-orange); border-radius: 14px; padding: 12px 14px; margin-bottom: 14px; }
.pcl-selected-logo { width: 46px; height: 34px; object-fit: contain; border-radius: 6px; flex-shrink: 0; background: #fff; }
.pcl-selected-info { min-width: 0; }
.pcl-selected-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.pcl-selected-meta { font-size: 13px; color: var(--pcl-orange-dark); font-weight: 600; margin-top: 2px; }

.pcl-quote { background: #fff; border: 1px solid var(--pcl-line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.pcl-quote-top { padding: 16px 16px 12px; display: flex; gap: 12px; }
.pcl-quote-logo { width: 64px; height: 48px; object-fit: contain; border-radius: 8px; flex-shrink: 0; background: var(--pcl-bg); }
.pcl-quote-name { font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.pcl-badge { display: inline-block; font-size: 12px; font-weight: 600; color: #2563eb; border: 1px solid #bfdbfe; background: #eff6ff; border-radius: 7px; padding: 2px 8px; margin-right: 6px; }
.pcl-badge-ins { color: #166534; border-color: #bbf7d0; background: var(--pcl-green-tint); }
/* Badge row: delivery/insurance badges left, drop-off action pushed to the right. */
.pcl-quote-badges { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pcl-badge-action { margin: 0; cursor: pointer; font-family: inherit; color: var(--pcl-orange-dark); border-color: #ffd9b8; background: var(--pcl-orange-tint); white-space: nowrap; }
.pcl-badge-action:hover { background: var(--pcl-orange); color: #fff; border-color: var(--pcl-orange); }
.pcl-quote-meta { padding: 12px 16px; border-top: 1px solid var(--pcl-line); display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--pcl-muted); }
.pcl-quote-tags { padding: 8px 16px; display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--pcl-muted); border-top: 1px solid var(--pcl-line); }
.pcl-quote-tag { display: inline-flex; align-items: center; gap: 5px; }
.pcl-price-row { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pcl-price-row.is-primary { background: var(--pcl-orange-tint); }
.pcl-price { font-size: 20px; font-weight: 800; }
.pcl-price small { display: block; font-size: 11px; font-weight: 500; color: var(--pcl-muted); }
.pcl-book-btn { flex-shrink: 0; }

/* Service-point picker */
.pcl-sp { border: 1px solid var(--pcl-line); border-radius: 11px; padding: 12px; margin-top: 8px; }
.pcl-sp.is-selected { border-color: var(--pcl-orange); background: var(--pcl-orange-tint); }
.pcl-sp-name { font-weight: 600; font-size: 14px; }
/* Proximity pill — subtle badge so "0.8 mi away" reads as distinct meta. */
.pcl-sp-dist { display: inline-block; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--pcl-orange-dark); background: var(--pcl-orange-tint); border-radius: 7px; padding: 2px 8px; }
.pcl-sp-dist::before { content: "📍 "; }
.pcl-sp-addr { font-size: 12px; color: var(--pcl-muted); }

/* Drop-off notice */
.pcl-notice { display: flex; gap: 10px; align-items: flex-start; background: var(--pcl-green-tint); color: #166534; border: 1px solid #bbf7d0; border-radius: 12px; padding: 13px 14px; font-size: 14px; margin-bottom: 16px; }
.pcl-notice svg { flex-shrink: 0; width: 22px; height: 22px; }

/* Alerts */
.pcl-alert { border-radius: 11px; padding: 12px 14px; font-size: 13px; margin-bottom: 14px; }
.pcl-alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; white-space: pre-wrap; word-break: break-word; }

/* Sticky footer */
.pcl-footer {
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--pcl-line);
  padding: 14px 16px; display: flex; align-items: center; gap: 14px; z-index: 20;
}
.pcl-footer .pcl-total { flex: 1; }
.pcl-footer .pcl-total span { display: block; font-size: 12px; color: var(--pcl-muted); }
.pcl-footer .pcl-total strong { font-size: 20px; color: var(--pcl-orange); }
.pcl-footer .pcl-btn { width: auto; min-width: 130px; }

/* Bottom-sheet modal (mobile). Becomes a centered modal on tablet/desktop below. */
.pcl-sheet-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.pcl-sheet { background: #fff; width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); max-height: 88vh; overflow-y: auto; overflow-x: hidden; }
.pcl-sheet-grip { width: 44px; height: 5px; border-radius: 999px; background: var(--pcl-line); margin: -8px auto 14px; }
/* Tablet/desktop: a centered modal instead of an edge-anchored sheet. */
@media (min-width: 640px) {
  #parcel-app .pcl-sheet-overlay { align-items: center; padding: 20px; }
  #parcel-app .pcl-sheet { width: auto; max-width: 460px; border-radius: 16px; padding: 24px; max-height: 85vh; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
  #parcel-app .pcl-sheet-grip { display: none; }
}
.pcl-sheet h2 { margin: 0 0 16px; font-size: 20px; }
.pcl-sheet-close { position: absolute; }

/* HS results */
.pcl-hs-item { border: 1px solid var(--pcl-line); border-radius: 11px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.pcl-hs-item:hover { border-color: var(--pcl-orange); background: var(--pcl-orange-tint); }
.pcl-hs-code { font-weight: 700; font-family: ui-monospace, monospace; }

/* Parcel block */
.pcl-parcel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }

/* Success */
.pcl-success { text-align: center; padding: 24px 8px; }
.pcl-success-check { width: 72px; height: 72px; border-radius: 999px; background: var(--pcl-green-tint); color: var(--pcl-green); display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; }
.pcl-success h2 { font-size: 22px; margin: 0 0 6px; }
.pcl-kv { display: flex; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--pcl-line); font-size: 14px; }
.pcl-kv span { color: var(--pcl-muted); }

/* Spinner */
.pcl-spin { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 999px; animation: pcl-spin .7s linear infinite; }
@keyframes pcl-spin { to { transform: rotate(360deg); } }
.pcl-loading-overlay { position: fixed; inset: 0; background: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; z-index: 60; }
.pcl-loading-overlay .pcl-spin { width: 34px; height: 34px; border-color: var(--pcl-orange-tint); border-top-color: var(--pcl-orange); }

/* Stripe element mount */
.pcl-stripe { padding: 14px; border: 1px solid var(--pcl-line); border-radius: 11px; background: #fff; min-height: 44px; }
.pcl-muted-note { font-size: 13px; color: var(--pcl-muted); text-align: center; margin: 14px 0; }

/* Step 2: sort + filter toolbar */
.pcl-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.pcl-toolbar .pcl-seg-sort { flex: 1; margin-bottom: 0; }
.pcl-filters-btn { width: auto; padding: 11px 18px; font-size: 14px; white-space: nowrap; }
.pcl-filters-btn .pcl-badge { margin: 0; background: var(--pcl-orange); color: #fff; border-color: var(--pcl-orange); }

/* Filters sheet: checkbox rows + subheading + footer actions */
.pcl-filter-list { display: flex; flex-direction: column; }
.pcl-check { display: flex; align-items: center; gap: 12px; padding: 12px 2px; cursor: pointer; font-size: 15px; }
.pcl-check input { accent-color: var(--pcl-orange); width: 20px; height: 20px; flex-shrink: 0; }
.pcl-filter-subhead { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--pcl-muted); margin: 16px 0 2px; }
.pcl-sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
/* Base .pcl-btn is width:100%; reset to auto so flex sizing controls the split
   (otherwise a flex:0 0 auto button would claim the full width). */
.pcl-sheet-actions .pcl-btn { flex: 1; width: auto; }

/* Split sheet: fixed header + footer, only the middle (.pcl-sheet-body) scrolls.
   Opt-in via .pcl-sheet-split so the simpler HS sheet keeps whole-sheet scroll. */
.pcl-sheet-split { overflow: hidden; display: flex; flex-direction: column; }
.pcl-sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* Spinner shown inside a white sheet (the base one is white-on-white). */
.pcl-sheet .pcl-spin { width: 28px; height: 28px; border-color: var(--pcl-orange-tint); border-top-color: var(--pcl-orange); }
