/* =========================================================
   PapiSteak — Page de paiement Solana
   Styles : page principale + modal de paiement (etats multiples)
   ========================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #07070b;
  --bg-elev: #11111a;
  --bg-elev-2: #181826;
  --text: #f4f4f7;
  --text-dim: #9aa0b4;
  --accent: #9945ff;
  --accent-2: #14f195;
  --accent-warm: #ffb547;
  --danger: #ff5970;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --radius: 18px;
}

html,
body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* ----- Fonds decoratifs ----- */
.bg-grid {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px
    );
  background-size: 28px 28px;
  z-index: 0;
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  inset: -10%;
  background: radial-gradient(
      40rem 40rem at 20% 10%,
      rgba(153, 69, 255, 0.18),
      transparent 60%
    ),
    radial-gradient(
      40rem 40rem at 80% 90%,
      rgba(20, 241, 149, 0.12),
      transparent 60%
    );
  z-index: 0;
  pointer-events: none;
  filter: blur(20px);
}

/* ----- Page ----- */
.page {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 64px 24px 48px;
}

.hero {
  text-align: center;
  margin-bottom: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 24px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
}

.brand-name {
  color: var(--text);
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-bottom: 16px;
}

.accent {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  color: var(--text-dim);
  font-size: 17px;
  max-width: 520px;
  margin: 0 auto;
}

/* ----- Warning ----- */
.warning {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  margin: 32px 0;
  border: 1px solid rgba(255, 181, 71, 0.35);
  background: linear-gradient(
    180deg,
    rgba(255, 181, 71, 0.08),
    rgba(255, 181, 71, 0.02)
  );
  border-radius: 14px;
  color: #f7e6c8;
  font-size: 14.5px;
  line-height: 1.55;
}

.warning-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-warm);
  color: #1c1200;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
}

.warning b {
  color: #fff;
}

/* ----- Carte de paiement ----- */
.pay-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-shadow: var(--shadow-lg);
}

.amount-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.amount-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.amount-value {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.amount-usd {
  color: var(--text-dim);
  font-size: 14px;
}

/* ----- Boutons ----- */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
  padding: 14px 22px;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease,
    opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #b46bff);
  color: #fff;
  box-shadow: 0 12px 24px rgba(153, 69, 255, 0.35);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 16px 32px rgba(153, 69, 255, 0.5);
}

.btn-pay {
  padding: 16px 30px;
  font-size: 16px;
}

.btn-phantom {
  width: 100%;
  background: linear-gradient(135deg, #534bb1, #551bf9);
  color: #fff;
  padding: 16px;
  font-size: 16px;
  box-shadow: 0 12px 24px rgba(85, 27, 249, 0.4);
}

.btn-phantom:hover:not(:disabled) {
  box-shadow: 0 16px 32px rgba(85, 27, 249, 0.55);
}

.phantom-logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
}

.btn-confirm {
  width: 100%;
  background: linear-gradient(135deg, #14f195, #00c374);
  color: #052b1a;
  margin-top: 20px;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(20, 241, 149, 0.3);
}

.btn-confirm:hover:not(:disabled) {
  box-shadow: 0 16px 32px rgba(20, 241, 149, 0.45);
}

.btn-secondary {
  background: var(--bg-elev-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  margin-top: 18px;
  width: 100%;
  padding: 14px;
}

.btn-secondary:hover {
  background: #1f1f30;
}

/* ----- Footer ----- */
.footer {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 13px;
}

/* =========================================================
   MODAL DE PAIEMENT
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 2, 6, 0.62);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  display: flex;
  opacity: 1;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, #16161f 0%, #0b0b12 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  padding: 28px 24px 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(153, 69, 255, 0.05);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.2s ease;
}

.modal-backdrop.open .modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  font-size: 24px;
  cursor: pointer;
  border-radius: 10px;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.modal-header {
  margin-bottom: 22px;
  text-align: center;
}

.modal-header h2 {
  font-size: 22px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.modal-sub {
  color: var(--text-dim);
  font-size: 14px;
}

.hint {
  margin-top: 12px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

/* ----- Details du paiement (etape 2) ----- */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.info-row:last-of-type {
  border-bottom: none;
}

.info-row.highlight {
  background: rgba(20, 241, 149, 0.06);
  border: 1px solid rgba(20, 241, 149, 0.18);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 10px;
}

.info-label {
  color: var(--text-dim);
}

.info-value {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.amount-usd-small {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-top: 2px;
}

.adaptive-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(255, 181, 71, 0.1);
  border: 1px solid rgba(255, 181, 71, 0.25);
  color: #ffd58a;
  font-size: 13px;
  line-height: 1.5;
}

/* ----- Chooser (desktop wallet selection) ----- */
.step[data-step="chooser"] {
  padding: 4px 0 2px;
}

.chooser-title {
  font-size: 18px;
  margin-bottom: 4px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chooser-sub {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-bottom: 16px;
}

.chooser-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  max-height: 55vh;
  overflow-y: auto;
}

.chooser-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elev-2);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.chooser-item:hover {
  background: rgba(153, 69, 255, 0.08);
  border-color: rgba(153, 69, 255, 0.35);
}

.chooser-item:active {
  transform: scale(0.99);
}

.chooser-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0b0b13;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}

.chooser-name {
  flex: 1;
  text-align: left;
}

.chooser-arrow {
  color: var(--text-dim);
  display: flex;
  align-items: center;
}

.chooser-other {
  width: 100%;
  margin-top: 4px;
}

/* Touch targets plus grands sur mobile (chooser mobile-friendly). */
@media (max-width: 640px) {
  .chooser-item {
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 16px;
  }
  .chooser-icon {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  .chooser-title {
    font-size: 19px;
  }
  .chooser-sub {
    font-size: 14px;
  }
}

/* ----- Pending ----- */
.step[data-step="pending"] {
  text-align: center;
  padding: 20px 0;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.pending-text {
  color: var(--text-dim);
  font-size: 14.5px;
}

/* ----- Success ----- */
.step[data-step="success"] {
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(20, 241, 149, 0.15);
  color: var(--accent-2);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
}

.success-icon svg {
  width: 32px;
  height: 32px;
}

.step[data-step="success"] h3 {
  font-size: 20px;
  margin-bottom: 6px;
}

.success-text {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 18px;
}

.tx-hash {
  padding: 12px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.tx-link {
  color: var(--accent-2);
  font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  text-decoration: none;
  word-break: break-all;
  text-align: right;
}

.tx-link:hover {
  text-decoration: underline;
}

/* ----- Error ----- */
.step[data-step="error"] {
  text-align: center;
}

.error-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 89, 112, 0.15);
  color: var(--danger);
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  font-size: 28px;
  font-weight: 800;
}

.step[data-step="error"] h3 {
  font-size: 20px;
  margin-bottom: 6px;
}

.error-text {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 8px;
  word-break: break-word;
}

/* =========================================================
   Liste des wallets (style Reown AppKit)
   ========================================================= */
.wallet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 60vh;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}
.wallet-list::-webkit-scrollbar { width: 6px; }
.wallet-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.wallet-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 12px 6px 6px;
}

.wallet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease,
    transform 0.1s ease, box-shadow 0.18s ease;
  text-decoration: none;
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.wallet-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    140% 100% at 0% 0%,
    rgba(153, 69, 255, 0.08),
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.wallet-item:hover {
  background: rgba(255, 255, 255, 0.045);
  border-color: rgba(153, 69, 255, 0.32);
  box-shadow: 0 6px 22px rgba(85, 27, 249, 0.18);
}
.wallet-item:hover::before { opacity: 1; }
.wallet-item:active { transform: translateY(1px); }

.wallet-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: #0f0f18;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}
.wallet-icon-wrap img,
.wallet-icon-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wallet-label {
  flex: 1;
  color: var(--text);
  letter-spacing: -0.01em;
}

.wallet-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.wallet-tag-installe {
  background: rgba(20, 241, 149, 0.14);
  color: var(--accent-2);
}
.wallet-tag-mobile {
  background: rgba(153, 69, 255, 0.16);
  color: #b88bff;
}
.wallet-tag-installer {
  background: rgba(255, 181, 71, 0.16);
  color: var(--accent-warm);
}

.wallet-hint {
  color: var(--text-dim);
  font-size: 13.5px;
  text-align: center;
  margin: 4px 0 8px;
  line-height: 1.5;
}

/* ----- Responsive ----- */
@media (max-width: 520px) {
  .page {
    padding: 32px 18px;
  }
  .pay-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .btn-pay {
    width: 100%;
  }
  .footer {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }
}
