/* Préstamos PA — Solicitud compacta para el hero del home ([ppa_solicitud_home]).
   Todo va bajo #ppah: el ID le gana a los estilos globales de Hello Elementor y del kit
   de Elementor (botones rosados, bordes de input, márgenes de h3/p). Si la caja blanca del
   hero ya tiene su propio padding, se puede quitar el de aquí con  #ppah{--ppah-pad:0}.

   MOBILE-FIRST: todo lo de aquí abajo son los estilos para celular (el caso más común
   de esta caja). Los `@container (min-width: …)` al final solo AGRANDAN cosas cuando la
   CAJA (no la ventana del navegador) tiene espacio de sobra — nunca al revés. Se usa
   @container y no @media porque el widget puede vivir en una columna angosta de Elementor
   dentro de una pantalla ancha; un @media de ventana lo tomaría por "escritorio" igual. */

#ppah-cq { container-type: inline-size; container-name: ppah; }

#ppah {
  --g:      #14432a;
  --g2:     #1a5c3a;
  --lime:   #c6dc3a;
  --lime-s: #f2f8cf;
  --ink:    #12291c;
  --mute:   #5b6b62;
  --line:   #e3eae5;
  --line2:  #c9d4cc;
  --err:    #b3261e;
  --err-s:  #fdecea;
  --ppah-pad: 18px;

  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden; /* Safari viejo no soporta overflow:clip en no-reemplazados */
  padding: var(--ppah-pad);
  text-align: left;
  /* "DM Sans" e Inter ya los carga Elementor globalmente en el sitio — no se piden aparte. */
  font-family: 'DM Sans', Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  /* Táctil: sin el flash gris de Android/iOS al tocar (los estados propios ya lo cubren)
     ni el iOS que agranda el texto solo al rotar a horizontal. */
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
#ppah *, #ppah *::before, #ppah *::after { box-sizing: border-box; }
/* El tema/kit fija font-family directo en h3, p, label…: sin esto el título salía con la tipografía del tema. */
#ppah * { font-family: inherit; }
#ppah p, #ppah h3, #ppah form, #ppah section { margin: 0; padding: 0; }
#ppah svg { display: block; flex: none; }
#ppah .ppah-hp { position: absolute; left: -9999px; top: -9999px; }

/* ── Progreso + volver ────────────────────────────────── */
#ppah .ppah-head { display: flex; align-items: center; gap: 10px; margin: 0 0 20px; }
#ppah button.ppah-hback {
  all: unset; box-sizing: border-box; flex: none; display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; margin-left: -8px; border-radius: 50%; color: var(--g); cursor: pointer;
  transition: background-color .12s, transform .1s; touch-action: manipulation;
}
#ppah button.ppah-hback[hidden] { display: none; }
#ppah button.ppah-hback:active { background: var(--lime-s); transform: scale(.9); }
@media (hover: hover) { #ppah button.ppah-hback:hover { background: var(--lime-s); } }
#ppah button.ppah-hback:focus-visible { outline: 2.5px solid var(--g); outline-offset: 1px; }
#ppah .ppah-hback svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
#ppah .ppah-track { flex: 1; height: 6px; border-radius: 99px; background: #e4ece6; overflow: hidden; }
#ppah .ppah-track i { display: block; height: 100%; width: 33.33%; border-radius: 99px; background: var(--g); transition: width .35s cubic-bezier(.2,.7,.2,1); }
#ppah .ppah-count { font-size: 12px; font-weight: 600; color: var(--mute); white-space: nowrap; }
#ppah.is-clean .ppah-head { display: none; }

/* ── Pasos (apilados en la misma celda: la altura es la del paso más alto, sin saltos) ── */
#ppah .ppah-stage { display: grid; }
#ppah .ppah-step {
  grid-area: 1 / 1; min-width: 0;
  display: flex; flex-direction: column;
  visibility: hidden; opacity: 0; transform: translateY(8px);
  transition: opacity .12s ease, transform .12s ease, visibility 0s linear .12s;
}
/* La saliente se apaga rápido y la entrante llega justo después: sin superposición visible. */
#ppah .ppah-step.is-active {
  visibility: visible; opacity: 1; transform: none;
  transition: opacity .22s ease .1s, transform .22s ease .1s, visibility 0s;
}
#ppah .ppah-center { align-items: center; justify-content: center; text-align: center; }

#ppah .ppah-title {
  margin: 0 0 6px; font-size: 26px; line-height: 1.2;
  font-weight: 800; letter-spacing: -.02em; color: var(--g);
  text-wrap: balance;
}
#ppah .ppah-title:focus { outline: none; }
#ppah .ppah-hl { background: var(--lime); color: var(--g); padding: 0 .2em; border-radius: 6px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
#ppah .ppah-sub { margin: 0 0 22px; font-size: 15px; color: var(--mute); }

/* ── Campos ───────────────────────────────────────────── */
#ppah .ppah-field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 16px; min-width: 0; }
/* Apilado por defecto (mobile-first): dos campos angostos uno al lado del otro en un
   teléfono se sienten apretados. Se ponen en fila solo cuando ya sobra ancho de verdad. */
#ppah .ppah-row { display: grid; grid-template-columns: 1fr; gap: 16px; }
#ppah .ppah-label { display: block; margin: 0; font-size: 13px; font-weight: 600; line-height: 1.3; color: var(--ink); }
#ppah .ppah-label small { font-weight: 400; color: var(--mute); font-size: inherit; }

#ppah input.ppah-input, #ppah select.ppah-input {
  all: unset; box-sizing: border-box; display: block; width: 100%; height: 54px; padding: 0 14px;
  border: 1.5px solid var(--line2); border-radius: 12px; background: #fff; color: var(--ink);
  font: 500 16px/1.2 'DM Sans', system-ui, sans-serif;
  -webkit-appearance: none; appearance: none;
  transition: border-color .15s, box-shadow .15s;
}
#ppah input.ppah-input::placeholder { color: #7d8d84; opacity: 1; }
#ppah select.ppah-input {
  /* Altura por padding (no por height): así el texto queda centrado verticalmente igual que en los inputs. */
  height: auto; min-height: 54px; padding: 16.2px 40px 16.2px 14px; line-height: 20px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%235b6b62' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
@media (hover: hover) { #ppah .ppah-input:hover { border-color: #9fb0a5; } }
#ppah .ppah-input:focus { border-color: var(--g); box-shadow: 0 0 0 4px rgba(198, 220, 58, .5); }
#ppah .ppah-inputwrap { position: relative; }
#ppah .ppah-inputwrap > span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 15px; font-weight: 600; color: var(--mute); pointer-events: none; }
#ppah .ppah-inputwrap .ppah-input { padding-left: 44px; }

#ppah .ppah-field.has-err .ppah-input { border-color: var(--err); background-color: var(--err-s); }
#ppah .ppah-field.has-err .ppah-input:focus { box-shadow: 0 0 0 4px rgba(179, 38, 30, .18); }
#ppah .ppah-field.has-err .ppah-chip span,
#ppah .ppah-field.has-err .ppah-card span { border-color: var(--err); }
#ppah .ppah-err { margin: 0; font-size: 13px; line-height: 1.3; font-weight: 500; color: var(--err); }
#ppah .ppah-err:empty { display: none; }
#ppah .ppah-formerr { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--err-s); color: var(--err); font-size: 14px; font-weight: 500; }
#ppah .ppah-formerr:empty { display: none; }

/* ── Monto ────────────────────────────────────────────── */
#ppah .ppah-amount {
  display: flex; align-items: baseline; gap: 8px; padding: 12px 18px;
  background: var(--lime-s); border: 2px solid transparent; border-radius: 16px;
  transition: border-color .15s, box-shadow .15s;
}
#ppah .ppah-amount:focus-within { border-color: var(--g); box-shadow: 0 0 0 4px rgba(198, 220, 58, .5); }
#ppah .ppah-cur { font-size: 18px; font-weight: 700; color: var(--g); }
#ppah input.ppah-amount-input {
  all: unset; box-sizing: border-box; flex: 1; min-width: 0;
  font: 800 36px/1.1 'DM Sans', system-ui, sans-serif; letter-spacing: -.02em; color: var(--g);
  font-variant-numeric: tabular-nums;
}
#ppah .ppah-range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 44px; margin: 4px 0 0; padding: 0;
  background: transparent; cursor: pointer; --pct: 20%; touch-action: pan-x;
}
#ppah .ppah-range::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(to right, var(--g) var(--pct), #dbe5de var(--pct)); }
#ppah .ppah-range::-moz-range-track { height: 8px; border-radius: 99px; background: #dbe5de; }
#ppah .ppah-range::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--g); }
#ppah .ppah-range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: #fff; border: 4px solid var(--g); box-shadow: 0 2px 8px rgba(20, 67, 42, .3); }
#ppah .ppah-range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--g); box-shadow: 0 2px 8px rgba(20, 67, 42, .3); }
#ppah .ppah-range:focus-visible { outline: 3px solid var(--g); outline-offset: 2px; border-radius: 8px; }
#ppah .ppah-scale { display: flex; justify-content: space-between; margin-top: -4px; font-size: 12px; color: var(--mute); }

/* ── Plazo: fila deslizable, no una cuadrícula apretada ──
   Cuatro cajitas forzadas en 375px de ancho se ven "pobres". En vez de eso, cada chip
   tiene su ancho natural y la fila se desliza — el patrón que usan apps de verdad para
   listas cortas de opciones (filtros, fechas de vuelo, etc). Se ve completa igual porque
   siempre asoma el borde del siguiente chip como pista de que hay más. */
#ppah .ppah-chips {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity;
  margin: 0 calc(var(--ppah-pad) * -1); padding: 2px var(--ppah-pad) 6px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
#ppah .ppah-chips::-webkit-scrollbar { display: none; }
#ppah .ppah-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
#ppah .ppah-chip, #ppah .ppah-card, #ppah .ppah-seg label {
  position: relative; display: block; margin: 0; cursor: pointer; line-height: 1.2;
  touch-action: manipulation; /* sin el retraso de ~300ms del navegador antes de disparar el tap */
}
#ppah .ppah-chip { flex: 0 0 auto; scroll-snap-align: start; }
#ppah .ppah-chip input, #ppah .ppah-card input, #ppah .ppah-seg input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none;
}
#ppah .ppah-chip span, #ppah .ppah-card span, #ppah .ppah-seg span {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line2); border-radius: 12px; background: #fff;
  transition: border-color .15s, background-color .15s, box-shadow .15s, transform .1s;
}
/* Respuesta táctil inmediata al soltar el dedo — :hover no existe en pantallas táctiles. */
#ppah .ppah-chip:active span, #ppah .ppah-card:active span, #ppah .ppah-seg label:active span { transform: scale(.96); background: var(--lime-s); }
#ppah .ppah-chip span { flex-direction: column; gap: 1px; width: 72px; height: 60px; }
#ppah .ppah-chip b { font-size: 19px; font-weight: 800; line-height: 1.1; color: var(--ink); }
#ppah .ppah-chip small { font-size: 11px; line-height: 1.2; color: var(--mute); }
#ppah .ppah-card span { flex-direction: column; gap: 8px; min-height: 88px; padding: 12px 6px; }
#ppah .ppah-card i {
  display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  border-radius: 50%; background: var(--lime-s);
}
#ppah .ppah-card svg { width: 18px; height: 18px; fill: none; stroke: var(--g); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#ppah .ppah-card em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.25; }
#ppah .ppah-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 220px; }
#ppah .ppah-seg span { min-height: 48px; font-size: 15px; font-weight: 600; }

@media (hover: hover) { #ppah .ppah-chip:hover span, #ppah .ppah-card:hover span, #ppah .ppah-seg label:hover span { border-color: var(--g2); } }
#ppah .ppah-chip input:checked + span,
#ppah .ppah-card input:checked + span,
#ppah .ppah-seg input:checked + span { border-color: var(--g); background: var(--lime-s); box-shadow: inset 0 0 0 1px var(--g); }
#ppah .ppah-card input:checked + span i { background: #fff; }
#ppah .ppah-chip input:focus-visible + span,
#ppah .ppah-card input:focus-visible + span,
#ppah .ppah-seg input:focus-visible + span { outline: 3px solid var(--g); outline-offset: 2px; }

/* ── Acciones — un único botón a todo lo ancho; "volver" vive en el encabezado ── */
#ppah .ppah-actions { display: flex; gap: 10px; margin-top: auto; padding-top: 8px; }
#ppah .ppah-stack { flex-direction: column; align-items: stretch; margin-top: 4px; }
#ppah .ppah-stack .ppah-btn { flex: none; }

#ppah button.ppah-btn {
  all: unset; box-sizing: border-box; flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 24px; border-radius: 14px; background: var(--g); color: #fff; cursor: pointer;
  font: 700 16px/1 'DM Sans', system-ui, sans-serif; text-align: center; white-space: nowrap;
  box-shadow: 0 8px 18px -8px rgba(20, 67, 42, .6);
  transition: background-color .15s, transform .1s, box-shadow .15s;
  touch-action: manipulation;
}
@media (hover: hover) { #ppah button.ppah-btn:hover { background: var(--g2); } }
#ppah button.ppah-btn:active { background: var(--g2); transform: scale(.97); }
#ppah button.ppah-btn:focus-visible { outline: 3px solid var(--g); outline-offset: 3px; }
#ppah .ppah-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
@media (hover: hover) { #ppah .ppah-btn:hover svg { transform: translateX(3px); } }
#ppah button.ppah-btn[disabled] { opacity: .8; cursor: progress; }
#ppah .ppah-btn.is-loading svg { display: none; }
#ppah .ppah-btn.is-loading::after {
  content: ''; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: ppah-spin .7s linear infinite;
}
@keyframes ppah-spin { to { transform: rotate(360deg); } }

#ppah button.ppah-link {
  all: unset; box-sizing: border-box; padding: 12px; text-align: center; cursor: pointer;
  font: 600 14px/1.2 'DM Sans', system-ui, sans-serif; color: var(--mute); text-decoration: underline; text-underline-offset: 3px;
  touch-action: manipulation;
}
@media (hover: hover) { #ppah button.ppah-link:hover { color: var(--g); } }
#ppah button.ppah-link:active { color: var(--g); }
#ppah button.ppah-link:focus-visible { outline: 3px solid var(--g); outline-offset: 2px; border-radius: 6px; }

#ppah .ppah-note { display: flex; align-items: flex-start; gap: 8px; margin: 2px 0 16px; font-size: 13px; line-height: 1.4; color: var(--mute); }
#ppah .ppah-note svg { width: 16px; height: 16px; margin-top: 1px; fill: none; stroke: var(--g); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#ppah .ppah-badge { display: flex; align-items: center; justify-content: center; width: 60px; height: 60px; margin: 0 0 16px; border-radius: 50%; background: var(--lime); }
#ppah .ppah-badge svg { width: 28px; height: 28px; fill: none; stroke: var(--g); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
#ppah .ppah-center .ppah-sub { max-width: 380px; }

/* ══════════════════════════════════════════════════════
   A partir de aquí: SOLO mejoras para cuando la CAJA tiene espacio de sobra.
   Nada de lo de arriba depende de que esto cargue. Miden el contenedor
   #ppah-cq (ver arriba), no la ventana del navegador. ══════ */
@container ppah (min-width: 480px) {
  #ppah .ppah-row { grid-template-columns: 1fr 1fr; }
  /* La fila deslizable es un patrón de celular (arrastrar con el dedo). Con mouse,
     sin scrollbar visible, nadie descubre que hay más chips a la derecha — se ven
     cortados y punto. Con 480px ya sobra ancho de sobra para una cuadrícula fija de
     4 columnas (2 filas para los 8 plazos): todos visibles, nada de arrastrar. Este
     umbral (no 640) es a propósito bajo — cajas reales de Elementor de ~500-560px
     (como la de este sitio) ya deben verse como escritorio, no como celular. */
  #ppah .ppah-chips {
    display: grid; grid-template-columns: repeat(4, 1fr);
    overflow-x: visible; scroll-snap-type: none;
    margin: 0; padding: 0;
  }
  #ppah .ppah-chip { flex: initial; scroll-snap-align: none; }
  #ppah .ppah-chip span { width: 100%; height: 54px; }
}
@container ppah (min-width: 640px) {
  #ppah { --ppah-pad: clamp(24px, 3.2vw, 36px); }
  #ppah .ppah-title { font-size: 30px; }
  #ppah .ppah-cur { font-size: 20px; }
  #ppah input.ppah-amount-input { font-size: 40px; }
  #ppah .ppah-card span { min-height: 84px; }
  #ppah .ppah-card em { font-size: 14px; }
  #ppah .ppah-stack { max-width: 340px; }
}

/* Respaldo para navegadores sin soporte de container queries (Safari <16,
   Chrome/Edge <105, Firefox <110): usan el ancho de la ventana como antes lo
   hacía todo el archivo. No es tan preciso, pero nunca deja el widget sin
   ninguna mejora en pantallas grandes. */
@supports not (container-type: inline-size) {
  @media (min-width: 480px) {
    #ppah .ppah-row { grid-template-columns: 1fr 1fr; }
    #ppah .ppah-chips { display: grid; grid-template-columns: repeat(4, 1fr); overflow-x: visible; scroll-snap-type: none; margin: 0; padding: 0; }
    #ppah .ppah-chip { flex: initial; scroll-snap-align: none; }
    #ppah .ppah-chip span { width: 100%; height: 54px; }
  }
  @media (min-width: 640px) {
    #ppah { --ppah-pad: clamp(24px, 3.2vw, 36px); }
    #ppah .ppah-title { font-size: 30px; }
    #ppah .ppah-cur { font-size: 20px; }
    #ppah input.ppah-amount-input { font-size: 40px; }
    #ppah .ppah-card span { min-height: 84px; }
    #ppah .ppah-card em { font-size: 14px; }
    #ppah .ppah-stack { max-width: 340px; }
  }
}

@media (prefers-reduced-motion: reduce) {
  #ppah *, #ppah *::before, #ppah *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation-duration: 0s !important; }
}
