* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: #F8FAFC;
  color: #111827;
  line-height: 1.6;
}

/* ---------- Header ---------- */
.pay-header {
  background: #FFFFFF;
  border-bottom: 1px solid #E2E8F0;
  padding: 16px 0;
}
.pay-header .pay-container {
  display: flex;
  align-items: center;
  gap: 16px;
}
.logo {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #4F46E5;
  text-decoration: none;
}
.support-link {
  position: relative;
  font-size: 15px;
  font-weight: 500;
  color: #6B7280;
  text-decoration: none;
  margin-left: auto;
  transition: color 0.2s;
}
.support-link:hover {
  color: #4F46E5;
}
.support-link[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  background: #1F2937;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 400;
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.support-link[data-tooltip]::before {
  content: "";
  position: absolute;
  top: calc(100% - 2px);
  left: 12px;
  border: 6px solid transparent;
  border-bottom-color: #1F2937;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 101;
}
.support-link[data-tooltip]:hover::after,
.support-link[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Container ---------- */
.pay-container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Step Indicator ---------- */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0 28px;
  gap: 0;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
}
.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #E2E8F0;
  color: #9CA3AF;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}
.step-label {
  font-size: 13px;
  font-weight: 500;
  color: #9CA3AF;
  transition: color 0.3s;
}
.step-line {
  width: 60px;
  height: 2px;
  background: #E2E8F0;
  margin: 0 8px;
  margin-bottom: 22px;
  transition: background 0.3s;
}

/* Active step */
.step-item.active .step-circle {
  background: #4F46E5;
  color: #FFFFFF;
}
.step-item.active .step-label {
  color: #4F46E5;
  font-weight: 600;
}

/* Completed step */
.step-item.completed .step-circle {
  background: #16A34A;
  color: #FFFFFF;
}
.step-item.completed .step-label {
  color: #16A34A;
}
.step-line.completed {
  background: #16A34A;
}

/* ---------- Order Summary Card ---------- */
.order-summary {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.order-summary h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #111827;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: #6B7280;
  border-bottom: 1px solid #F1F5F9;
}
.summary-row:last-child {
  border-bottom: none;
}
.summary-row span:last-child {
  font-weight: 600;
  color: #111827;
}
.summary-total {
  padding-top: 12px;
  margin-top: 4px;
  border-top: 1.5px solid #E2E8F0;
  border-bottom: none;
  font-size: 16px;
}
.summary-total span:last-child {
  color: #4F46E5;
  font-weight: 700;
  font-size: 18px;
}

/* ---------- Form ---------- */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: #111827;
  background: #FFFFFF;
}
.form-group input::placeholder {
  color: #9CA3AF;
}
.form-group input:focus {
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}
.form-group input.input-error {
  border-color: #DC2626;
}
.form-group input.input-error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.field-error {
  font-size: 13px;
  color: #DC2626;
  margin-top: 4px;
  min-height: 18px;
}

/* ---------- Params error ---------- */
.params-error {
  text-align: center;
  padding: 48px 0;
}
.params-error .error-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.params-error h2 {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.params-error p {
  color: #6B7280;
  margin-bottom: 20px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
}
.btn-primary {
  background: #4F46E5;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}
.btn-primary:hover {
  background: #4338CA;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}
.btn-primary:disabled {
  background: #9CA3AF;
  cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  background: transparent;
  color: #4F46E5;
  border: 1.5px solid #4F46E5;
}
.btn-secondary:hover {
  background: #EEF2FF;
}
.btn-text {
  background: none;
  color: #6B7280;
  padding: 8px 16px;
  font-weight: 500;
}
.btn-text:hover {
  color: #4F46E5;
}
.btn-block {
  display: block;
  width: 100%;
  margin-top: 8px;
}

/* ---------- Payment Info Card ---------- */
.payment-info-card {
  background: #FFFFFF;
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.payment-info-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #111827;
}
.bank-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  color: #6B7280;
  border-bottom: 1px solid #F1F5F9;
}
.bank-row:last-child {
  border-bottom: none;
}
.bank-row span:last-child {
  font-weight: 600;
  color: #111827;
}
.bank-total span:last-child {
  color: #4F46E5;
  font-weight: 700;
  font-size: 16px;
}
.order-code {
  font-family: monospace;
  letter-spacing: 1px;
}
.order-summary-row {
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 10px;
  margin-bottom: 2px;
}
.order-summary-row span:last-child {
  color: #4F46E5 !important;
}

/* ---------- Payment Hero (QR + countdown + note) ---------- */
.payment-hero {
  text-align: center;
  padding: 32px 0 24px;
  margin-bottom: 24px;
  background: linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  border-radius: 16px;
  border: 1px solid #E2E8F0;
}
.payment-instruction {
  font-size: 0.95rem;
  color: #374151;
  margin: 0 0 20px;
  padding: 0 16px;
}
.payment-instruction .countdown {
  font-weight: 700;
  color: #111827;
  font-variant-numeric: tabular-nums;
}
.payment-instruction .countdown.warning {
  color: #EA580C;
}
.payment-instruction .countdown.expired {
  color: #DC2626;
}

/* ---------- QR Area ---------- */
.qr-area {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.qr-placeholder {
  width: 200px;
  height: 200px;
  border: 2px dashed #E2E8F0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9CA3AF;
  font-size: 16px;
  font-weight: 500;
  background: #FFFFFF;
}

/* ---------- Result States ---------- */
.result-state {
  text-align: center;
  padding: 56px 0 40px;
}
.result-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  margin-bottom: 24px;
}
.result-icon--success {
  background: #DCFCE7;
  color: #16A34A;
}
.result-icon--pending {
  background: #E0E7FF;
  color: #4F46E5;
}
.result-icon--error {
  background: #FEE2E2;
  color: #DC2626;
}
.result-icon--warning {
  background: #FEF3C7;
  color: #F59E0B;
}
.result-state h2 {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 12px;
  color: #111827;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  text-wrap: balance;
}
.result-subtitle {
  font-size: 16px;
  color: #6B7280;
  max-width: 380px;
  margin: 0 auto 28px;
}

/* Info box — highlight actionable info */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #F5F3FF;
  border: 1px solid #C4B5FD;
  border-radius: 12px;
  padding: 16px 20px;
  max-width: 420px;
  margin: 0 auto 28px;
  text-align: left;
}
.info-box-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #A78BFA;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.info-box-text {
  font-size: 14px;
  color: #5B21B6;
  line-height: 1.55;
}

/* Wide button */
.btn-wide {
  min-width: 200px;
}
.result-state .btn {
  margin-bottom: 8px;
}

/* Spinner */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E0E7FF;
  border-top-color: #4F46E5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Auto-detect note ---------- */
.auto-detect-note {
  color: #94A3B8;
  font-size: 0.82rem;
  margin: 0;
  padding: 0 16px;
}

/* ---------- Cancel button in step 2 ---------- */
#btn-cancel-pay {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .step-line {
    width: 36px;
  }
  .order-summary,
  .payment-info-card {
    padding: 16px 18px;
  }
  .qr-placeholder {
    width: 160px;
    height: 160px;
  }
}

/* ---------- Agree checkbox (Terms + Privacy) ---------- */
.form-agree {
  margin: 4px 0 18px;
}
.agree-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 0.92rem;
  line-height: 1.55;
  color: #475569;
}
.agree-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.agree-box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 1.5px solid #CBD5E1;
  border-radius: 5px;
  background: #fff;
  position: relative;
  transition: all 0.15s ease;
  margin-top: 2px;
}
.agree-label:hover .agree-box {
  border-color: #4F46E5;
}
.agree-label input[type="checkbox"]:focus-visible + .agree-box {
  outline: 2px solid rgba(79,70,229,0.4);
  outline-offset: 2px;
}
.agree-label input[type="checkbox"]:checked + .agree-box {
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  border-color: #4F46E5;
}
.agree-label input[type="checkbox"]:checked + .agree-box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 6px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.agree-text a {
  color: #4F46E5;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}
.agree-text a:hover {
  color: #4338CA;
}
.form-agree.error .agree-box {
  border-color: #EF4444;
}
.form-agree.error .field-error {
  display: block;
}

/* Disabled submit looks soft */
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary:disabled:hover {
  transform: none;
}

/* ---------- Coupon section ---------- */
.coupon-section {
  margin: 0 0 18px;
  padding: 14px 16px;
  background: #FAFAFF;
  border: 1px dashed #C7D2FE;
  border-radius: 10px;
}
.coupon-section.applied {
  background: #ECFDF5;
  border-color: #6EE7B7;
  border-style: solid;
}
.coupon-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
  margin: 0 0 8px;
}
.coupon-input-row {
  display: flex;
  gap: 8px;
}
.coupon-input-row input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s;
}
.coupon-input-row input:focus {
  outline: none;
  border-color: #4F46E5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
.btn-ghost {
  padding: 10px 18px;
  background: transparent;
  color: #4F46E5;
  border: 1px solid #C7D2FE;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn-ghost:hover {
  background: #EEF2FF;
  border-color: #4F46E5;
}
.btn-ghost:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-ghost.remove {
  color: #94A3B8;
  border-color: #E2E8F0;
}
.btn-ghost.remove:hover {
  color: #EF4444;
  border-color: #FCA5A5;
  background: #FEF2F2;
}
.coupon-message {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  min-height: 1.2em;
}
.coupon-message.success {
  color: #047857;
  font-weight: 500;
}
.coupon-message.error {
  color: #DC2626;
}

.summary-discount {
  color: #047857;
}
.summary-discount span:last-child {
  font-weight: 600;
}
.summary-original {
  color: #94A3B8;
}
.summary-original span:last-child {
  text-decoration: line-through;
}
