/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-focus: rgba(99,102,241,0.6);
  --primary: #6366f1;
  --primary-end: #a855f7;
  --text: #f0f0f5;
  --text-muted: #9090a8;
  --text-subtle: #5a5a72;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 14px;
  --radius-sm: 8px;
}

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

/* ── Background Orbs ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.15;
}
.orb-1 { width: 500px; height: 500px; background: #6366f1; top: -150px; right: -100px; }
.orb-2 { width: 400px; height: 400px; background: #a855f7; bottom: -100px; left: -100px; }
.orb-3 { width: 300px; height: 300px; background: #06b6d4; top: 50%; left: 50%; transform: translate(-50%,-50%); }

/* ── Pages ── */
.page { display: none; min-height: 100vh; position: relative; z-index: 1; }
.page.active { display: flex; align-items: center; justify-content: center; padding: 2rem 1rem; }

/* ── Container & Card ── */
.container { width: 100%; max-width: 520px; }

.card {
  background: rgba(14,14,22,0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 32px 64px rgba(0,0,0,0.5),
    0 0 80px rgba(99,102,241,0.06);
  animation: slideUp 0.5s cubic-bezier(.16,1,.3,1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card Header ── */
.card-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}
.logo {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(168,85,247,0.2));
  border: 1px solid rgba(99,102,241,0.3);
  display: flex; align-items: center; justify-content: center;
}
.card-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff 40%, #a0a0c0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Form ── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}
.required { color: var(--error); }

.input-wrapper { position: relative; }
.input-prefix {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); font-weight: 500; font-size: 1rem;
  pointer-events: none;
}

.form-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input.has-prefix { padding-left: 2rem; }
.form-input::placeholder { color: var(--text-subtle); }
.form-input:hover { border-color: rgba(255,255,255,0.15); }
.form-input:focus {
  border-color: var(--border-focus);
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
/* Remove number arrows */
.form-input[type=number]::-webkit-inner-spin-button,
.form-input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
.form-input[type=number] { -moz-appearance: textfield; }

.form-input.invalid { border-color: var(--error) !important; box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 460px) { .form-row { grid-template-columns: 1fr; } }

/* ── Method Grid ── */
.method-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
@media (max-width: 400px) { .method-grid { grid-template-columns: repeat(2, 1fr); } }

.method-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.method-card:hover {
  background: var(--surface-hover);
  border-color: rgba(99,102,241,0.3);
  transform: translateY(-1px);
}
.method-card.selected {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.5);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15), 0 4px 12px rgba(99,102,241,0.15);
}
.method-icon { font-size: 1.4rem; line-height: 1; }
.method-name { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); text-align: center; }
.method-card.selected .method-name { color: #a5b4fc; }

/* ── Section Divider ── */
.section-divider {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.5rem 0 1.25rem;
  color: var(--text-subtle); font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em;
}
.section-divider::before, .section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Label hint ── */
.label-hint {
  font-weight: 400;
  color: var(--text-subtle);
  font-size: 0.72rem;
  margin-left: 0.3rem;
}

/* ── Toggle Switch ── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}
.toggle-label { display: flex; flex-direction: column; gap: 2px; }
.toggle-title  { font-size: 0.875rem; font-weight: 500; color: var(--text); }
.toggle-subtitle { font-size: 0.72rem; color: var(--text-subtle); }

.toggle-switch { position: relative; flex-shrink: 0; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track {
  display: block;
  width: 44px; height: 24px;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  border-radius: 99px;
  transition: background 0.25s, border-color 0.25s;
  position: relative;
}
.toggle-thumb {
  position: absolute;
  left: 3px; top: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), background 0.25s;
}
.toggle-switch input:checked ~ .toggle-track {
  background: linear-gradient(135deg, var(--primary), var(--primary-end));
  border-color: transparent;
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(20px);
  background: #fff;
}

/* ── Charge Breakdown ── */
.charge-breakdown {
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: -0.5rem;
  margin-bottom: 0.5rem;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity:0; transform: translateY(-4px); } to { opacity:1; transform: translateY(0); } }

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.2rem 0;
}
.breakdown-row:not(:last-child) { border-bottom: 1px dashed rgba(255,255,255,0.06); padding-bottom: 0.35rem; margin-bottom: 0.2rem; }
.breakdown-row span:last-child { font-weight: 500; font-variant-numeric: tabular-nums; }
.total-row { color: var(--text); font-size: 0.88rem; font-weight: 600; margin-top: 0.15rem; }
.total-row span:last-child { color: #a5b4fc; }

/* ── Error Box ── */
.error-box {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #fca5a5;
  margin-bottom: 1.25rem;
}
.hidden { display: none !important; }

/* ── Pay Button ── */
.pay-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-end));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 8px 24px rgba(99,102,241,0.35);
  position: relative;
  overflow: hidden;
}
.pay-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
}
.pay-btn:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 12px 32px rgba(99,102,241,0.45); }
.pay-btn:active:not(:disabled) { transform: translateY(0); }
.pay-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Spinner ── */
.spinner {
  width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Secure Note ── */
.secure-note {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-top: 1rem;
}

/* ── Status Card ── */
.status-card { text-align: center; }
.status-content { display: flex; flex-direction: column; align-items: center; gap: 1rem; }

.status-icon-wrap {
  position: relative;
  width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 0.5rem;
}
.status-icon { font-size: 3rem; line-height: 1; position: relative; z-index: 1; }

.pulse-ring {
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(99,102,241,0.4);
  animation: pulseRing 1.5s ease-out infinite;
}
.success-ring { border-color: rgba(34,197,94,0.4); }

@keyframes pulseRing {
  0%   { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.3); opacity: 0; }
}

.status-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.status-msg { color: var(--text-muted); font-size: 0.9rem; }

.progress-bar {
  width: 200px; height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-end));
  border-radius: 99px;
  animation: progressAnim 2s ease-in-out infinite;
}
@keyframes progressAnim {
  0%   { width: 5%;  margin-left: 0; }
  50%  { width: 60%; margin-left: 20%; }
  100% { width: 5%;  margin-left: 100%; }
}

.status-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.5rem;
  width: 100%;
  text-align: left;
}
.status-detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.4rem 0;
  font-size: 0.85rem;
}
.status-detail-row:not(:last-child) { border-bottom: 1px solid var(--border); }
.status-detail-label { color: var(--text-muted); }
.status-detail-value { font-weight: 500; color: var(--text); }
.badge-paid {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  padding: 0.2rem 0.6rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Mode Tabs (Pay Now / Create Link) ── */
.mode-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 1rem;
}
.mode-tab {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.55rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.mode-tab:hover { color: var(--text); background: var(--surface-hover); }
.mode-tab.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(168,85,247,0.25));
  color: #c4b5fd;
  border: 1px solid rgba(99,102,241,0.35);
}

/* ── Link Created Panel ── */
.link-created {
  margin-top: 1rem;
  background: rgba(99,102,241,0.06);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  animation: fadeIn 0.3s ease;
}
.link-created-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.link-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: #a5b4fc;
}
.link-expiry {
  font-size: 0.72rem;
  color: var(--text-subtle);
  background: rgba(255,255,255,0.05);
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
}
.link-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
.link-input {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  color: var(--text);
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  outline: none;
  min-width: 0;
}
.copy-btn {
  display: flex; align-items: center; gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-end));
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  flex-shrink: 0;
}
.copy-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.copy-btn.copied { background: linear-gradient(135deg, #22c55e, #16a34a); }
.link-note {
  font-size: 0.75rem;
  color: var(--text-subtle);
  margin-bottom: 0.6rem;
  line-height: 1.5;
}
.link-new-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-new-btn:hover { color: var(--text); }

/* ── Home / Landing Page ── */
.home-logo {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(99,102,241,0.2), rgba(168,85,247,0.2));
  border: 1px solid rgba(99,102,241,0.3);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
}
.home-title {
  font-size: 2rem; font-weight: 700; letter-spacing: -0.03em;
  background: linear-gradient(90deg, #fff 40%, #9090c0);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}
.home-sub {
  color: var(--text-muted); font-size: 0.95rem;
  max-width: 340px; margin: 0 auto 2rem; line-height: 1.6;
}
.home-cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  width: auto; padding: 0.85rem 2rem;
  text-decoration: none;
}

/* ── Method Checkboxes (link mode filter) ── */
.method-checks {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.method-check-item {
  display: flex; align-items: center; gap: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem; color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.method-check-item:hover { border-color: rgba(99,102,241,0.35); color: var(--text); }
.method-check-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 13px; height: 13px; cursor: pointer;
}
.method-check-item:has(input:checked) {
  border-color: rgba(99,102,241,0.45);
  background: rgba(99,102,241,0.1);
  color: #c4b5fd;
}

/* ── Two-column create order layout ── */
.container-wide { max-width: 820px; }

.card-wide {
  padding: 1.5rem 1.75rem;
}
.card-wide .card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* 2-col grid: left = payment details, right = customer + action */
.form-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2rem;
  align-items: start;
}
.form-col {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.form-col .form-group { margin-bottom: 0.9rem; }
.form-col .charge-breakdown { margin-bottom: 0.9rem; }

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Stack to single col on small screens */
@media (max-width: 640px) {
  .form-cols { grid-template-columns: 1fr; gap: 0; }
  .card-wide { padding: 1.25rem; }
  .container-wide { max-width: 100%; }
}
