/* =========================================================
   style.css — Cajita de Pagos PayPhone
   ========================================================= */

/* ── Reset básico ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Variables ────────────────────────────────────────── */
:root {
  --color-primary:    #0057FF;
  --color-primary-dk: #0041CC;
  --color-success:    #1A9E5A;
  --color-success-bg: #E8F8EF;
  --color-error:      #D93025;
  --color-error-bg:   #FDE8E6;
  --color-bg:         #F4F6FB;
  --color-surface:    #FFFFFF;
  --color-text:       #1A1A2E;
  --color-muted:      #6B7280;
  --color-border:     #E2E8F0;
  --radius:           12px;
  --shadow:           0 2px 16px rgba(0, 0, 0, 0.08);
  --font:             'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Base ─────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* ── Header ───────────────────────────────────────────── */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding-block: 1rem;
}

.site-header .container {
  display: flex;
  align-items: center;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.02em;
}

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
  margin-top: auto;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding-block: 1rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.85rem;
}

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}

.card h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--color-text);
}

/* ── Checkout ─────────────────────────────────────────── */
.checkout-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-block: 2rem;
  flex: 1;
}

/* Resumen del pedido */
.order-items {
  list-style: none;
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  margin-bottom: 0.75rem;
}

.order-items li {
  display: flex;
  justify-content: space-between;
  padding-block: 0.4rem;
  font-size: 0.95rem;
}

.item-name { color: var(--color-text); }
.item-price { font-weight: 600; }

.order-totals {
  border-top: 1px solid var(--color-border);
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.total-row--grand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-top: 0.4rem;
  padding-top: 0.6rem;
  border-top: 2px solid var(--color-border);
}

/* Sección de pago */
.payment-section { flex: 1; }

.payment-hint {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 1.25rem;
}

/* Fuerza ancho completo al contenedor del botón PayPhone */
#pp-button {
  width: 100%;
}

/* ── Página de resultado ──────────────────────────────── */
.result-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: 3rem;
  flex: 1;
}

.result-card {
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.result-card h2 {
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.result-card p {
  color: var(--color-muted);
  margin-bottom: 1.5rem;
}

.result-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

/* Variantes de card */
.result-card--success {
  border-color: #A7E3C3;
  background: var(--color-success-bg);
}

.result-card--error {
  border-color: #F5BEBA;
  background: var(--color-error-bg);
}

/* Detalles de la transacción */
.tx-details {
  text-align: left;
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-surface);
}

.tx-details > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--color-border);
}

.tx-details > div:last-child { border-bottom: none; }

.tx-details dt {
  color: var(--color-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.tx-details dd {
  font-weight: 600;
  text-align: right;
  word-break: break-all;
}

/* ── Botones ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.btn--primary {
  background: var(--color-primary);
  color: #fff;
}
.btn--primary:hover { background: var(--color-primary-dk); }

.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--secondary:hover {
  background: var(--color-primary);
  color: #fff;
}

/* ── Spinner de carga ─────────────────────────────────── */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.25rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ───────────────────────────────────────── */
@media (min-width: 600px) {
  .checkout-wrapper {
    flex-direction: row;
    align-items: flex-start;
  }

  .order-summary  { flex: 1; }
  .payment-section { flex: 1; }
}
