/* ============================================================
   JP SHEET — Checkout Styles
   assets/css/checkout.css
   ============================================================ */

/* ── Overlay ─────────────────────────────────────────────────── */
.checkout-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.checkout-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

/* ── Panel ───────────────────────────────────────────────────── */
.checkout-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 100%;
  max-width: 480px;
  background: #fff;
  z-index: 510;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 32px rgba(0,0,0,.12);
}
.checkout-panel.open {
  transform: translateX(0);
}

/* ── Panel Header ────────────────────────────────────────────── */
.checkout-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.checkout-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
}
.checkout-header-chassis {
  font-size: 12px;
  color: var(--text-3);
  font-family: 'Courier New', monospace;
  margin-top: 2px;
  letter-spacing: .04em;
}
.checkout-close {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.checkout-close:hover { background: var(--bg-3); }
.checkout-close svg {
  width: 13px; height: 13px;
  stroke: var(--text-2);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ── Steps indicator ─────────────────────────────────────────── */
.checkout-steps {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  gap: 0;
  flex-shrink: 0;
  background: var(--bg-2);
}
.checkout-step {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
}
.checkout-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-2);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  flex-shrink: 0;
}
.checkout-step.active .checkout-step-num {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.checkout-step.done .checkout-step-num {
  background: #16A34A;
  border-color: #16A34A;
  color: #fff;
}
.checkout-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}
.checkout-step.active .checkout-step-label { color: var(--text); }
.checkout-step.done  .checkout-step-label  { color: #16A34A; }
.checkout-step-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  margin: 0 8px;
}

/* ── Panel Body ──────────────────────────────────────────────── */
.checkout-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Vehicle summary ─────────────────────────────────────────── */
.checkout-vehicle {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  margin-bottom: 20px;
}
.checkout-vehicle-img {
  width: 72px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-3);
  flex-shrink: 0;
}
.checkout-vehicle-model {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.02em;
  margin-bottom: 3px;
}
.checkout-vehicle-specs {
  font-size: 12px;
  color: var(--text-3);
}

/* ── Plan selection ──────────────────────────────────────────── */
.plan-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.plan-option {
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: all .18s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
}
.plan-option:hover { border-color: var(--brand); background: var(--brand-dim); }
.plan-option.selected {
  border-color: var(--brand);
  background: var(--brand-dim);
}
.plan-option-radio {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-2);
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.plan-option.selected .plan-option-radio {
  border-color: var(--brand);
  background: var(--brand);
}
.plan-option.selected .plan-option-radio::after {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
}
.plan-option-body { flex: 1; }
.plan-option-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: 3px;
}
.plan-option-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}
.plan-option-price {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -.04em;
  flex-shrink: 0;
}
.plan-option-badge {
  position: absolute;
  top: -1px; right: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 0 0 6px 6px;
  padding: 2px 8px;
}

/* ── Form fields ─────────────────────────────────────────────── */
.checkout-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.01em;
  margin-bottom: 12px;
}
.checkout-field {
  margin-bottom: 12px;
}
.checkout-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 5px;
}
.checkout-field input,
.checkout-field select {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-2);
  outline: none;
  transition: all .18s;
  font-family: inherit;
}
.checkout-field input:focus,
.checkout-field select:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-dim);
}
.checkout-field input.error { border-color: #EF4444; }
.checkout-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Payment methods ─────────────────────────────────────────── */
.payment-methods {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.payment-method-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.payment-method-btn:hover { border-color: var(--border-2); color: var(--text); }
.payment-method-btn.active {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
}
.payment-method-btn svg { flex-shrink: 0; }

/* ── Stripe card element ─────────────────────────────────────── */
#stripe-card-element {
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-2);
  transition: border-color .2s;
  margin-bottom: 12px;
}
#stripe-card-element.StripeElement--focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px var(--brand-dim);
}
#stripe-card-element.StripeElement--invalid { border-color: #EF4444; }

/* ── PayPal container ────────────────────────────────────────── */
#paypal-button-container {
  margin-bottom: 12px;
  min-height: 45px;
}

/* ── Order summary ───────────────────────────────────────────── */
.order-summary {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.order-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-2);
  padding: 4px 0;
}
.order-summary-row.total {
  border-top: 1px solid var(--border);
  margin-top: 8px;
  padding-top: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.order-summary-row.total span:last-child { color: var(--brand); }

/* ── Panel footer ────────────────────────────────────────────── */
.checkout-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  background: #fff;
}
.checkout-pay-btn {
  width: 100%;
  padding: 13px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.checkout-pay-btn:hover {
  background: var(--brand-hover);
  box-shadow: 0 4px 16px var(--brand-glow);
  transform: translateY(-1px);
}
.checkout-pay-btn:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.checkout-pay-btn .spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: none;
}
.checkout-pay-btn.loading .spinner { display: block; }
.checkout-pay-btn.loading .btn-text { display: none; }

.checkout-back-btn {
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-3);
  cursor: pointer;
  font-family: inherit;
  text-align: center;
  padding: 4px;
  transition: color .15s;
}
.checkout-back-btn:hover { color: var(--text); }

.checkout-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-3);
}
.checkout-secure svg {
  width: 12px; height: 12px;
  stroke: #16A34A;
  fill: none;
  stroke-width: 2;
}

/* ── Success screen ──────────────────────────────────────────── */
.checkout-success {
  text-align: center;
  padding: 32px 20px;
}
.success-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(22,163,74,.1);
  border: 2px solid #BBF7D0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.success-icon svg {
  width: 32px; height: 32px;
  stroke: #16A34A;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.success-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.03em;
  margin-bottom: 8px;
}
.success-sub {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 24px;
  line-height: 1.6;
}
.success-report-link {
  display: block;
  background: var(--brand-dim);
  border: 1px solid rgba(187,24,35,.2);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  text-align: left;
}
.success-report-link-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}
.success-report-link-url {
  font-size: 13px;
  color: var(--text-2);
  word-break: break-all;
  font-family: 'Courier New', monospace;
}
.success-order-ref {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 20px;
}
.success-order-ref strong { color: var(--text); }

/* ── Error message ───────────────────────────────────────────── */
.checkout-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 13px;
  color: #DC2626;
  margin-bottom: 12px;
  display: none;
}
.checkout-error.visible { display: block; }

@media(max-width: 520px) {
  .checkout-panel { max-width: 100%; }
  .checkout-row { grid-template-columns: 1fr; }
}
