/* Ajirika Collection — public checkout styles */
:root {
  --bg: #f0f4f8;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #f97316;
  --primary-dark: #ea580c;
  --success: #059669;
  --danger: #dc2626;
  --warning: #d97706;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15,23,42,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.site-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  color: #fff;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.site-header .brand { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; display:flex; align-items:center; }
.brand-logo { height: 28px; width: auto; }
.secure-badge {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #94a3b8;
}
.secure-badge svg { width: 14px; height: 14px; }

/* ── Layout ── */
.checkout-wrapper {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  display: grid;
  gap: 16px;
}

/* ── Cards ── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { color: var(--primary); }


.checkout-card { display: grid; gap: 16px; }
.checkout-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.checkout-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.checkout-subtitle { margin-top: 6px; color: var(--muted); font-size: 13px; }
.env-badge { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-radius: 999px; padding: 4px 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.provider-groups { display: grid; gap: 16px; }
.provider-group { display: grid; gap: 8px; }
.group-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
@media (max-width: 640px) {
  .checkout-title-row { flex-direction: column; }
  .form-row { grid-template-columns:1fr; }
}

/* ── Provider grid ── */
.provider-sections { display:grid; gap:16px; }
.provider-section h3 { font-size: 14px; margin-bottom: 8px; color: var(--muted); }
.provider-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 400px) { .provider-grid { grid-template-columns: repeat(2, 1fr); } }

.provider-tile {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fafafa;
  user-select: none;
}
.provider-tile:hover { border-color: #fdba74; background: #fff7ed; }
.provider-tile.selected {
  border-color: var(--primary);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.15);
}
.provider-tile.bank { }
.provider-logo { width: 40px; height: 40px; object-fit: contain; }
.provider-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}
.badge-vodacom  { background: #e6001e; }
.badge-airtel   { background: #d71920; }
.badge-tigo     { background: #0048a0; }
.badge-halopesa { background: #00857a; }
.badge-mpesa    { background: #00a550; }
.badge-crdb     { background: #003087; }
.badge-nmb      { background: #1a6e2e; }
.badge-azampesa { background: #1B3FA0; }
.badge-default  { background: #475569; }
.provider-name  { font-size: 11px; font-weight: 600; text-align: center; color: var(--text); }
.provider-channel-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.provider-tile.selected .provider-channel-tag { color: var(--primary); }

.provider-tile.maintenance {
  opacity: 0.7;
  cursor: not-allowed;
  background: #fff7ed;
  border-color: #fed7aa;
}
.provider-tile.maintenance:hover {
  background: #fff7ed;
  border-color: #fdba74;
}

/* ── Form ── */
.form-group { display: grid; gap: 6px; }
.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 4px;
}
.form-label .required { color: var(--danger); font-size: 10px; }
.form-input {
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}
.form-input.error { border-color: var(--danger); }
.input-hint { font-size: 12px; color: var(--muted); }
.field-error { font-size: 12px; color: var(--danger); display: none; }
.field-error.visible { display: block; }

.form-grid { display: grid; gap: 14px; }

/* ── OTP section ── */
#bank-otp-section {
  display: none;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  padding: 16px;
  gap: 12px;
}
#bank-otp-section.visible { display: grid; }
.otp-instructions {
  font-size: 13px;
  color: #0369a1;
  line-height: 1.6;
}
.otp-instructions strong { font-weight: 700; }
.otp-divider { height: 1px; background: #bae6fd; }

/* ── Amount display ── */
.amount-display {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.amount-display .label { font-size: 13px; color: var(--muted); }
.amount-display .value { font-size: 22px; font-weight: 800; color: var(--primary); }

/* ── Submit button ── */
.btn-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-submit:hover { background: var(--primary-dark); }
.btn-submit:active { transform: scale(0.99); }
.btn-submit:disabled { background: #94a3b8; cursor: not-allowed; transform: none; }
.btn-submit.loading::after {
  content: "";
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-left: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Provider error ── */
#provider-error {
  display: none;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  font-size: 13px;
  color: var(--danger);
}
#provider-error.visible { display: block; }

/* ── Trust footer ── */
.trust-bar {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}
.trust-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}
.trust-item svg { width: 14px; height: 14px; color: var(--success); }

/* ── Status pages ── */
.status-card {
  text-align: center;
  padding: 40px 24px;
}
.status-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 32px;
}
.status-icon.pending  { background: #fef3c7; }
.status-icon.success  { background: #d1fae5; }
.status-icon.failed   { background: #fee2e2; }
.status-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.status-subtitle { font-size: 15px; color: var(--muted); margin-bottom: 24px; line-height: 1.5; }
.ref-badge {
  display: inline-block;
  padding: 6px 14px;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 13px;
  font-family: monospace;
  color: var(--text);
  margin-bottom: 20px;
}
.btn-secondary {
  display: inline-block;
  padding: 10px 20px;
  background: #e2e8f0;
  color: var(--text);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #cbd5e1; }
.pulse-ring {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 0 rgba(217,119,6,0.4);
  animation: pulse 1.5s infinite;
  margin: 0 auto 16px;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(217,119,6,0.5); }
  70%  { box-shadow: 0 0 0 12px rgba(217,119,6,0); }
  100% { box-shadow: 0 0 0 0 rgba(217,119,6,0); }
}
.progress-bar {
  height: 4px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin: 16px 0;
}
.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  animation: progress 20s linear;
}
@keyframes progress { from { width: 0%; } to { width: 100%; } }

/* ── Enhanced provider tiles ── */
.provider-tile-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.provider-initials {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.provider-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}
.channel-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.maintenance-tag { font-size: 9px; }

/* Step cards */
.step-card { position: relative; }
.step-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.step-number {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.step-title {
  font-size: 15px;
  font-weight: 700;
}

/* Selected provider bar */
.selected-provider-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #fff7ed;
  border: 1.5px solid #fdba74;
  border-radius: 10px;
  margin-bottom: 12px;
}
.selected-provider-bar img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.provider-badge-inline {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--primary); color: #fff;
  font-weight: 700; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.badge-channel {
  font-size: 10px; background: #ffedd5; color: #9a3412;
  border-radius: 999px; padding: 2px 8px; font-weight: 700;
}
.clear-provider-btn {
  margin-left: auto; background: none; border: none;
  color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
}
.clear-provider-btn:hover { background: #fee2e2; color: var(--danger); }

/* Loading state */
.loading-state {
  display: flex; align-items: center; gap: 10px;
  padding: 20px; color: var(--muted); font-size: 13px;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty states */
.empty-state {
  padding: 16px; text-align: center; color: var(--muted);
  font-size: 13px; background: var(--bg); border-radius: 8px;
  border: 1px dashed var(--border);
}

/* Submit spinner */
.btn-spinner {
  width: 18px; height: 18px;
  animation: spin 0.8s linear infinite;
}

/* Environment banner */
#env-banner {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  background: #fef9c3; color: #854d0e; border: 1px solid #fde68a;
}

/* Provider tile selected enhanced */
.provider-tile.selected {
  border-color: var(--primary);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}
.provider-tile.maintenance {
  opacity: 0.5; cursor: not-allowed;
  filter: grayscale(1);
}

.status-note { font-size:13px; color:var(--muted); margin-bottom:16px; }
.status-title-success { color:#059669; }
.status-title-failed { color:#dc2626; }
.status-title-cancelled { color:#d97706; }
.status-title-expired { color:#6b7280; }
.status-actions { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin-top:8px; }

/* ── Transaction summary on status pages ── */
.transaction-summary {
  margin: 16px auto 20px;
  padding: 14px 18px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-width: 360px;
  width: 100%;
}
.transaction-summary-success {
  background: #f0fdf4;
  border-color: #86efac;
}
.transaction-summary-pending {
  background: #fffbeb;
  border-color: #fde68a;
}
.txn-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
}
.txn-row + .txn-row {
  border-top: 1px solid #e2e8f0;
}
.txn-label {
  color: var(--muted);
  font-weight: 500;
}
.txn-value {
  font-weight: 600;
  color: var(--text);
  text-align: right;
}
.txn-value-success {
  color: #059669;
  font-size: 15px;
}
.txn-mono {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  word-break: break-all;
}
.status-help {
  margin: 12px 0 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.status-icon.cancelled { background: #fef3c7; }
.status-icon.expired { background: #f3f4f6; }

/* Read-only form inputs (email pre-filled, merchant details auto-filled) */
.form-input.input-readonly,
.form-input[readonly] {
  background: #f8fafc;
  color: var(--muted);
  cursor: default;
  border-color: #cbd5e1;
}
.form-input.input-readonly:focus,
.form-input[readonly]:focus {
  outline: none;
  box-shadow: none;
  border-color: #cbd5e1;
}

/* Locked field display (pre-filled from redirect) */
.locked-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: #fff7ed;
  border: 1.5px solid #fdba74;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #9a3412;
}
.locked-field .locked-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* Auto-fill badge next to label */
.autofill-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ffedd5;
  color: #c2410c;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

/* Subscription status panel */
.subscription-status-panel {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 10px;
  padding: 12px 16px;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.sub-status-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #15803d;
}
.sub-status-icon { font-size: 15px; }
.sub-status-title { flex: 1; }
.sub-plan-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: #bbf7d0;
  color: #166534;
}
.sub-status-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #166534;
}
.sub-status-sep { color: #86efac; }
.sub-accumulate-preview {
  margin-top: 4px;
  padding: 8px 10px;
  background: #ecfdf5;
  border: 1px dashed #86efac;
  border-radius: 6px;
  color: #065f46;
  font-size: 12px;
  line-height: 1.5;
}

/* Plan days preview — shown for ALL users when a plan is selected */
.plan-days-preview {
  padding: 11px 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  font-size: 13px;
  color: #9a3412;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.55;
}
.plan-days-preview .pdp-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.plan-days-preview .pdp-text { flex: 1; }
.plan-days-preview .pdp-text strong { color: #c2410c; }
