
/* Parking QR Proxy overlay.
   All rules are scoped to #pqp-overlay or html.pqp-enabled so the original SPA
   (in particular the untouched login page) can never be affected. */
#pqp-overlay { display: none; }

html.pqp-enabled #pqp-overlay {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  margin: 0;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #f6f7f9;
  color: #1e2b3d;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Hide the original app shell only while the coupon overlay is active.
   The SPA keeps running underneath: token handling, QR generation and the
   coupon-scanned WebSocket stay authoritative. */
html.pqp-enabled #app { display: none !important; }

/* The upstream coupon-list popup is driven internally to select the two-hour
   coupon, so never show it (Vant popups may teleport outside #app). */
html.pqp-enabled .van-popup,
html.pqp-enabled .van-overlay { display: none !important; }

#pqp-overlay *,
#pqp-overlay *::before,
#pqp-overlay *::after { box-sizing: border-box; }

#pqp-overlay .pqp-card {
  width: 100%;
  max-width: 430px;
  margin: auto;
  padding: 40px 26px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

#pqp-overlay .pqp-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.32;
  font-weight: 700;
  color: #1e2b3d;
}

#pqp-overlay .pqp-subtitle {
  margin: 10px 0 0;
  min-height: 22px;
  font-size: 16px;
  line-height: 1.4;
  color: #8a93a2;
}

/* Coupon switcher: defaults to the two-hour coupon, still allows the
   three-hour one (and back). Hidden when the account has a single coupon. */
#pqp-overlay .pqp-coupons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

#pqp-overlay .pqp-coupons[hidden] { display: none; }

#pqp-overlay .pqp-chip {
  max-width: 100%;
  padding: 7px 14px;
  border: 1px solid #d7dde7;
  border-radius: 999px;
  background: #ffffff;
  color: #4a5568;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#pqp-overlay .pqp-chip[aria-pressed="true"] {
  background: #1a7cf0;
  border-color: #1a7cf0;
  color: #ffffff;
  font-weight: 600;
}

#pqp-overlay .pqp-chip:focus-visible { outline: 3px solid #9cc6ff; outline-offset: 2px; }

/* Locked state: only this subtle button is shown; the coupon choices (including
   the three-hour one) stay hidden until the passcode is accepted. */
#pqp-overlay .pqp-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 7px 16px;
  border: 1px solid #d7dde7;
  border-radius: 999px;
  background: #ffffff;
  color: #6b7686;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#pqp-overlay .pqp-switch[hidden] { display: none; }
#pqp-overlay .pqp-switch:active { background: #f1f4f8; }
#pqp-overlay .pqp-switch-icon { flex: 0 0 auto; }

/* Passcode prompt shown before any coupon switch (verified by the Worker). */
#pqp-overlay .pqp-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 24, 39, 0.45);
}

#pqp-overlay .pqp-modal[hidden] { display: none; }

#pqp-overlay .pqp-modal-card {
  width: 100%;
  max-width: 320px;
  padding: 22px 20px 18px;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.28);
  text-align: center;
}

#pqp-overlay .pqp-modal-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  color: #1e2b3d;
}

#pqp-overlay .pqp-passcode-input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid #d7dde7;
  border-radius: 10px;
  background: #ffffff;
  color: #1e2b3d;
  font: inherit;
  font-size: 17px;
  text-align: center;
  letter-spacing: 2px;
  outline: none;
}

#pqp-overlay .pqp-passcode-input:focus {
  border-color: #1a7cf0;
  box-shadow: 0 0 0 3px rgba(26, 124, 240, 0.18);
}

#pqp-overlay .pqp-modal-error {
  margin: 10px 0 0;
  min-height: 18px;
  font-size: 13px;
  color: #e5484d;
}

#pqp-overlay .pqp-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

#pqp-overlay .pqp-modal-actions button {
  flex: 1;
  height: 44px;
  border: 1px solid #d7dde7;
  border-radius: 10px;
  background: #ffffff;
  color: #4a5568;
  font: inherit;
  font-size: 16px;
  cursor: pointer;
}

#pqp-overlay .pqp-modal-ok {
  background: #1a7cf0;
  border-color: #1a7cf0;
  color: #ffffff;
  font-weight: 600;
}

#pqp-overlay .pqp-modal-ok[disabled] { opacity: 0.6; }

#pqp-overlay .pqp-qr-wrap {
  margin: 26px 0 20px;
  width: min(64vw, 250px);
  height: min(64vw, 250px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 6px 22px rgba(23, 43, 77, 0.08);
}

#pqp-overlay .pqp-qr {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 12px;
}

#pqp-overlay .pqp-qr-empty {
  font-size: 14px;
  color: #a3abb8;
}

#pqp-overlay .pqp-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  background: #e6f7ee;
  color: #12a150;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
}

#pqp-overlay .pqp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

#pqp-overlay .pqp-status[data-state="loading"] { background: #eef1f5; color: #6b7686; }
#pqp-overlay .pqp-status[data-state="error"] { background: #fdecec; color: #e5484d; }

#pqp-overlay .pqp-instruction {
  margin: 18px 0 0;
  font-size: 16px;
  line-height: 1.4;
  color: #8a93a2;
}

#pqp-overlay .pqp-refresh {
  margin-top: 22px;
  width: 100%;
  min-height: 62px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: #1a7cf0;
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

#pqp-overlay .pqp-refresh:active { background: #166fe0; transform: translateY(1px); }
#pqp-overlay .pqp-refresh:focus-visible { outline: 3px solid #9cc6ff; outline-offset: 2px; }
#pqp-overlay .pqp-refresh[disabled] { opacity: 0.62; cursor: default; transform: none; }
#pqp-overlay .pqp-refresh-icon { flex: 0 0 auto; }
#pqp-overlay .pqp-refresh.is-loading .pqp-refresh-icon { animation: pqp-spin 0.8s linear infinite; }

#pqp-overlay .pqp-remaining {
  margin: 18px 0 0;
  min-height: 24px;
  font-size: 17px;
  line-height: 1.4;
  color: #8a93a2;
}

@keyframes pqp-spin { to { transform: rotate(360deg); } }

@media (min-width: 480px) {
  html.pqp-enabled #pqp-overlay { background: #eef0f4; }
  #pqp-overlay .pqp-card {
    background: #f6f7f9;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(23, 43, 77, 0.10);
  }
}

@media (prefers-reduced-motion: reduce) {
  #pqp-overlay .pqp-refresh { transition: none; }
  #pqp-overlay .pqp-refresh.is-loading .pqp-refresh-icon { animation: none; }
}
