/* ============================================================
   ARICA MARINE SOLUTIONS — PAYMENT PAGE
   Step-based payment flow: details form → QR setup (crop) →
   payment proof upload → confirmation. Responsive.
   ============================================================ */

/* ---------- Steps progress ---------- */
.pay-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
}
.pay-step {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  opacity: 0.45;
  transition: opacity var(--dur-mid);
}
.pay-step.active { opacity: 1; }
.pay-step.done { opacity: 1; }
.pay-step .ps-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border-soft);
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--dur-mid);
  flex-shrink: 0;
}
.pay-step.active .ps-dot { background: var(--gradient-gold); border-color: transparent; color: var(--navy-deep); box-shadow: var(--shadow-gold); }
.pay-step.done .ps-dot { background: var(--navy-primary); border-color: var(--navy-primary); color: var(--white); }
.pay-step .ps-label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--navy-primary);
  white-space: nowrap;
}
.pay-step-line {
  width: 42px;
  height: 2px;
  background: var(--border-soft);
  margin: 0 0.8rem;
}
.pay-step.done ~ .pay-step-line { background: var(--navy-primary); }
@media (max-width: 640px) {
  .pay-step .ps-label { display: none; }
  .pay-step-line { width: 22px; margin: 0 0.4rem; }
}

/* ---------- Step panels ---------- */
.pay-panel { display: none; }
.pay-panel.active { display: block; animation: fade-up var(--dur-mid) var(--ease-bearing); }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.pay-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-xl);
  align-items: start;
}
@media (max-width: 980px) { .pay-flow { grid-template-columns: 1fr; gap: var(--space-lg); } }

.pay-summary {
  background: var(--gradient-navy);
  color: var(--white);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  position: sticky;
  top: calc(var(--header-h) + 20px);
}
@media (max-width: 980px) { .pay-summary { position: static; } }
.pay-summary h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-light);
  margin-bottom: var(--space-md);
  letter-spacing: 0.04em;
}
.pay-summary .sum-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 0;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.82);
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.pay-summary .sum-row.total {
  border-bottom: none;
  margin-top: 0.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255,255,255,0.2);
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--white);
  font-size: 1.05rem;
}
.pay-summary .sum-row.total span:last-child { color: var(--gold-light); font-size: 1.25rem; }
.pay-summary .sum-note { font-size: 0.76rem; color: rgba(255,255,255,0.6); line-height: 1.6; margin-top: 0.6rem; }

/* ---------- QR crop tool ---------- */
.qr-upload-zone {
  border: 2px dashed var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-xl) var(--space-md);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
}
.qr-upload-zone:hover, .qr-upload-zone.dragover { border-color: var(--gold); background: rgba(198,168,106,0.05); }
.qr-upload-zone i { font-size: 2.2rem; color: var(--gold); margin-bottom: 0.6rem; display: inline-block; }
.qr-upload-zone p { margin: 0 0 0.2rem; font-weight: 600; color: var(--navy-primary); }
.qr-upload-zone small { color: var(--ink-faint); }

.qr-crop-area { display: none; }
.qr-crop-area.show { display: block; }
.crop-stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 22px 22px;
  touch-action: none;
  user-select: none;
}
.crop-stage img.qr-source {
  width: 100%;
  display: block;
  transform: translate(0, 0) scale(1);
  cursor: grab;
}
.crop-stage img.qr-source:active { cursor: grabbing; }
.crop-window {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crop-square {
  width: 62%;
  aspect-ratio: 1;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(4,30,66,0.55);
}
.crop-square::before, .crop-square::after {
  content: '';
  position: absolute;
  background: var(--gold);
}
.crop-square::before { left: 50%; top: -6px; bottom: -6px; width: 2px; transform: translateX(-50%); }
.crop-square::after { top: 50%; left: -6px; right: -6px; height: 2px; transform: translateY(-50%); }

.crop-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}
.crop-controls label { display: flex; align-items: center; gap: 0.6rem; font-size: 0.82rem; color: var(--ink-soft); }
.crop-controls input[type="range"] { accent-color: var(--gold); }

.qr-preview {
  display: none;
  margin-top: var(--space-lg);
}
.qr-preview.show { display: block; }
.qr-preview .qr-frame {
  width: 230px;
  margin: 0 auto;
  padding: 0.85rem;
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.qr-preview canvas.qr-cropped {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
}
.qr-preview .qr-caption {
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 0.6rem;
}
.qr-preview .qr-caption strong { color: var(--navy-primary); }

/* ---------- Payment methods ---------- */
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
@media (max-width: 460px) { .pay-methods { grid-template-columns: 1fr; } }
.method-option {
  border: 1.5px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy-primary);
  cursor: pointer;
  transition: all var(--dur-fast);
}
.method-option input { accent-color: var(--gold); }
.method-option i { color: var(--gold-dim); }
.method-option:has(input:checked) { border-color: var(--gold); background: rgba(198,168,106,0.06); }

/* ---------- Upload preview (proof) ---------- */
.upload-preview {
  display: none;
  margin-top: 0.8rem;
  position: relative;
  width: 100%;
  max-width: 320px;
}
.upload-preview.show { display: block; }
.upload-preview img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); display: block; }
.upload-preview .up-remove {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(4,30,66,0.8);
  color: var(--white);
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ---------- QR default display ---------- */
.qr-display {
  text-align: center;
}
.qr-display .qr-box {
  display: inline-block;
  background: var(--white);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0.8rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 0.8rem;
}
.qr-display .qr-box img { width: 220px; height: 220px; display: block; }
.qr-display p { font-size: 0.85rem; color: var(--ink-soft); margin: 0.2rem 0; }
.qr-display strong { color: var(--navy-primary); }

/* ---------- Success state ---------- */
.pay-success {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--white);
}
.pay-success .ps-check {
  width: 72px; height: 72px;
  margin: 0 auto 1.2rem;
  border-radius: 50%;
  background: rgba(43,170,82,0.12);
  color: #2BAA52;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem;
  animation: pop-in var(--dur-mid) var(--ease-bearing);
}
@keyframes pop-in { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.pay-success h2 { color: var(--navy-deep); margin-bottom: 0.6rem; }
.pay-success p { color: var(--ink-soft); margin-bottom: var(--space-md); }

/* Honeypot for bots */
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* ---------- OTP step ---------- */
.otp-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  flex-wrap: wrap;
}
.btn-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { color: var(--gold-dim); }
.btn-link:disabled { color: var(--ink-faint); cursor: not-allowed; text-decoration: none; }