@import url('variables.css');

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--ink);
  color: var(--text-primary);
  font-family: var(--font-sans);
  overflow-x: hidden;
  transition: background var(--dur-med) var(--ease-out), color var(--dur-med) var(--ease-out);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.011em;
}

.app-shell {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: env(safe-area-inset-top) var(--sp-4) env(safe-area-inset-bottom);
  background:
    var(--merchant-bg-image, none),
    radial-gradient(120% 80% at 50% -10%, var(--accent-soft) 0%, transparent 55%),
    var(--ink);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover, auto, auto;
}

/* Imagen de fondo por comercio (Utils.applyMerchantBackground): scrim
   semi-transparente encima de la foto para que el texto siga legible. */
:root { --merchant-bg-image: none; }
body.has-merchant-bg .app-shell::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(rgba(10, 25, 23, 0.55), rgba(10, 25, 23, 0.72));
  pointer-events: none;
}
.app-shell > * {
  position: relative;
  z-index: 1;
}

.glass {
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  color: inherit;
  background: none;
}
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
a { color: inherit; text-decoration: none; }

input {
  font-family: inherit;
  color: inherit;
  background: transparent;
  border: none;
}

::selection { background: var(--accent); color: var(--on-accent); }

.mono { font-family: var(--font-mono); letter-spacing: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Botón primario compartido */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 56px;
  padding: 0 var(--sp-6);
  border-radius: var(--r-full);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  box-shadow: 0 8px 24px var(--accent-glow);
  transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast) var(--ease-out), opacity var(--dur-fast);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px var(--accent-glow); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-primary:disabled { opacity: 0.35; box-shadow: none; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 44px;
  padding: 0 var(--sp-5);
  border-radius: var(--r-full);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--glass-border);
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--glass-fill); }

.toast-layer {
  position: fixed; bottom: var(--sp-6); left: 50%; transform: translateX(-50%);
  z-index: 999; display: flex; flex-direction: column; gap: var(--sp-2); align-items: center;
  pointer-events: none; width: 100%; padding: 0 var(--sp-4);
}
.toast {
  pointer-events: auto;
  max-width: 420px; width: 100%;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--ink-soft);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-float);
  display: flex; align-items: center; gap: var(--sp-3);
  animation: toast-in var(--dur-med) var(--ease-spring);
}
.toast.error { border-color: rgba(239, 68, 68, 0.4); }
.toast.success { border-color: rgba(var(--accent-rgb), 0.5); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.leaving { animation: toast-out var(--dur-fast) var(--ease-out) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
