/* Interphonet Networks Pagos — design tokens */
:root {
  --bg: #FFFFFF;
  --surface: #F7F8FB;
  --surface-2: #EEF1F6;
  --border: #E3E7EE;
  --border-strong: #CFD5DF;
  --ink: #0E121A;
  --ink-2: #353B47;
  --ink-3: #6B7280;
  --accent: #C8235E;
  --accent-hover: #A91B4D;
  --accent-soft: #FBE7EE;
  --secondary: #1E5FB3;
  --secondary-hover: #1A4F94;
  --secondary-soft: #E6EEF8;
  --success: #1F7A4D;
  --danger: #B23A2A;
  --warn: #B57F1B;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --shadow-xs: 0 1px 0 rgba(15,20,16,0.04), 0 1px 2px rgba(15,20,16,0.04);
  --shadow-sm: 0 1px 2px rgba(15,20,16,0.05), 0 4px 12px rgba(15,20,16,0.04);
  --shadow-md: 0 2px 4px rgba(15,20,16,0.05), 0 12px 28px -8px rgba(15,20,16,0.10);
  --shadow-lg: 0 8px 16px -4px rgba(15,20,16,0.06), 0 24px 48px -12px rgba(15,20,16,0.18);
  --font-sans: "Geist", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
  --font-display: "Geist", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body, html { margin: 0; padding: 0; }

.ipn-root {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

.ipn-root *::selection { background: var(--accent); color: white; }

/* Reset buttons */
.ipn-root button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: none;
  color: inherit;
  font-size: inherit;
  letter-spacing: inherit;
}

.ipn-root input, .ipn-root select, .ipn-root textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  letter-spacing: inherit;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.005em;
  transition: all .16s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); }
.btn-lg { height: 52px; padding: 0 26px; font-size: 15px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 8px; }

/* Inputs */
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s, background .15s;
  outline: none;
}
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: #C7BEA3; }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(11, 61, 46, 0.12);
}
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(178,58,42,0.12); }

.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}

.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.error-hint { font-size: 12px; color: var(--danger); margin-top: 6px; }

/* Card / surface */
.surface {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
/* When a modal is mounted, allow it to extend past the surface bounds
   (otherwise overflow:hidden on .surface clips the modal at narrow widths) */
.surface:has(> .scrim) { overflow: visible !important; }

/* Mono numerals */
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.tabnum { font-variant-numeric: tabular-nums; }

/* Subtle stripe placeholder */
.placeholder-stripes {
  background: repeating-linear-gradient(
    135deg,
    rgba(30,95,179,0.06) 0 1px,
    transparent 1px 8px
  ), var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.fade-up { animation: fadeUp .35s cubic-bezier(.2,.8,.2,1) both; }
.fade-in { animation: fadeIn .25s ease both; }
.scale-in { animation: scaleIn .22s cubic-bezier(.2,.8,.2,1) both; }

/* Modal scrim */
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(15,20,16,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 16px;
}
.scrim > * { margin: auto; }

/* 3D Card */
.cc-scene {
  perspective: 1200px;
  width: 270px;
  height: 168px;
}
/* Card text sizing — scales with card */
.cc-num { font-size: 15px; }
.cc-holder { font-size: 11px; }
.cc-exp { font-size: 11px; }
.cc-brand { font-size: 10px; }
.cc-bank { font-size: 11px; }
.cc-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2,.8,.2,1);
  border-radius: 16px;
}
.cc-card.flipped { transform: rotateY(180deg); }

.cc-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 16px;
  padding: 22px;
  color: #F4F7FC;
  background:
    radial-gradient(120% 80% at 0% 0%, #E04A82 0%, transparent 60%),
    radial-gradient(120% 80% at 100% 100%, #2A0A1A 0%, transparent 60%),
    linear-gradient(135deg, #C8235E 0%, #5A0E2C 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    0 30px 60px -20px rgba(200,35,94,0.40),
    0 18px 36px -18px rgba(0,0,0,0.40);
  overflow: hidden;
}
.cc-face::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 30% at 80% 10%, rgba(255,255,255,0.18), transparent 70%),
    radial-gradient(40% 80% at 10% 100%, rgba(255,255,255,0.05), transparent 60%);
  pointer-events: none;
}
.cc-face-back { transform: rotateY(180deg); }

.cc-chip {
  width: 38px;
  height: 28px;
  border-radius: 5px;
  background:
    linear-gradient(135deg, #D8C170 0%, #F2DD8E 50%, #B89844 100%);
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 1px 2px rgba(0,0,0,0.25);
}
.cc-chip::before, .cc-chip::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(60,40,10,0.35);
  border-radius: 2px;
}
.cc-chip::after {
  inset: 8px 14px;
  border-top: 1px solid rgba(60,40,10,0.35);
  border-bottom: 1px solid rgba(60,40,10,0.35);
  border-left: none;
  border-right: none;
}

.cc-stripe {
  position: absolute;
  left: 0; right: 0;
  top: 24px;
  height: 42px;
  background: #04140E;
}

.cc-cvv-strip {
  margin-top: 18px;
  height: 36px;
  background: repeating-linear-gradient(135deg, #F4F6FA 0 6px, #E6EAF2 6px 12px);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  color: #1F1F1F;
  font-family: var(--font-mono);
  letter-spacing: 0.3em;
  font-size: 14px;
}

/* Custom checkbox / toggle */
.toggle {
  position: relative;
  width: 40px;
  height: 24px;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background .18s;
  flex-shrink: 0;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  transition: transform .18s;
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(16px); }

/* Stripe-like grid backdrop */
.dot-grid {
  background-image: radial-gradient(rgba(15,20,16,0.08) 1px, transparent 1px);
  background-size: 20px 20px;
}

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

/* Card modal layout: stacks on narrow, side-by-side on wide */
.cc-modal { grid-template-columns: 1fr; }
@media (min-width: 640px) {
  .cc-modal:not([data-compact]) { grid-template-columns: 1fr 1fr; }
  .cc-modal:not([data-compact]) .cc-modal-preview { border-right: 1px solid var(--border); padding: 32px 28px !important; }
}
/* Compact (mobile artboard or narrow viewport): single column, form only */
.cc-modal[data-compact] { width: 420px !important; max-width: calc(100% - 12px) !important; grid-template-columns: 1fr !important; }
.cc-modal[data-compact] .cc-modal-form { padding: 22px 20px 20px !important; }
@media (max-width: 639px) {
  .cc-modal-preview { border-bottom: 1px solid var(--border); padding: 12px 12px !important; gap: 8px !important; }
  .cc-scene { width: 200px !important; height: 125px !important; }
  .cc-modal-preview .cc-chip { width: 28px !important; height: 20px !important; }
  .cc-modal-preview .cc-face { padding: 14px !important; }
  .cc-modal-preview .cc-num { font-size: 12px !important; letter-spacing: 0.05em !important; }
  .cc-modal-preview .cc-holder { font-size: 9px !important; }
  .cc-modal-preview .cc-exp { font-size: 9px !important; }
  .cc-modal-preview .cc-brand { font-size: 8px !important; }
  .cc-modal-preview .cc-bank { font-size: 9px !important; }
  .cc-modal-form { padding: 16px 14px 14px !important; }
}

/* Mobile-specific */
.mobile-frame {
  width: 390px;
  background: var(--bg);
  border-radius: 38px;
  border: 10px solid #1A1A1A;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.25);
  overflow: hidden;
  position: relative;
}
.mobile-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-scroll::-webkit-scrollbar { width: 4px; }
.mobile-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }
.mobile-frame::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 130px; height: 30px;
  background: #1A1A1A;
  border-radius: 0 0 18px 18px;
  z-index: 60;
}
