/*! =============================================================================
 *  © 2026 Renzo Núñez · RonBStudio — "Perú Elige 2026 · Segunda Vuelta".
 *  Todos los derechos reservados. Código propietario: queda prohibida su copia,
 *  redistribución, ingeniería inversa o uso no autorizado, total o parcial.
 *  https://www.ronbstudio.com
 * ============================================================================= */
/* =============================================================================
 *  Proyecto      : Perú Elige 2026 — Segunda Vuelta
 *  Archivo       : donations.css
 *  Descripción   : Apoyo voluntario vía Yape — chip en el centro del header
 *                  sticky (permanentemente visible) + modal centrado (QR +
 *                  datos + copiar).
 *
 *                  Re-skin a la paleta del 2V (navy/slate + tarjetas con
 *                  degrade), NO el morado de 1V. El unico morado es el logo de
 *                  Yape (marca). Acento de UI = navy del sitio.
 *
 *  Convenciones BEM. Tokens del sitio + acentos locales.
 *  Autor         : Renzo Nunez · RonBStudio
 *  Versión       : 0.1.16
 * ===========================================================================*/

.donate-chip,
.donate-panel {
  --donate-accent:      #1e3a8a;   /* navy del sitio (chip pill / CTA) */
  --donate-accent-dark: #16306a;   /* navy hover */
  --donate-heart:       #88129a;   /* morado del fondo del logo Yape (corazón) */
}

/* ===========================================================================
 *  Chip del header (centro del header sticky)
 * =========================================================================*/

.donate-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--c-mv-ink, #1e293b);
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.10), rgba(30, 58, 95, 0.04));
  border: 1px solid rgba(30, 58, 95, 0.18);
  border-radius: 999px;
  padding: 4px 13px 4px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 180ms ease, border-color 180ms ease,
              transform 180ms ease, box-shadow 180ms ease;
}
.donate-chip:hover {
  background: linear-gradient(135deg, rgba(30, 58, 95, 0.16), rgba(30, 58, 95, 0.08));
  border-color: rgba(30, 58, 95, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.14);
}
.donate-chip:active { transform: translateY(0) scale(0.98); }
.donate-chip:focus-visible { outline: 2px solid var(--donate-accent); outline-offset: 2px; }

.donate-chip__heart {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: var(--donate-heart);
  transform-origin: center;
}
.donate-chip__text { white-space: nowrap; }
.donate-chip__logo {
  height: 35px;   /* +30% mas grande (pedido de Renzo) */
  width: auto;
  flex-shrink: 0;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  user-select: none;
}
/* Ícono PayPal DENTRO del chip, junto al logo Yape. 28px = 35px × 0.8 (−20%, pedido de Renzo). */
.donate-chip__pp { width: auto; height: 28px; flex-shrink: 0; fill: #003087; }

/* Onboarding 1ª visita: fade-in + el corazón late 2 veces. Hover → late. */
.donate-chip--onboarding { animation: donate-fade-in 600ms ease-out both; }
.donate-chip--onboarding .donate-chip__heart { animation: donate-beat 900ms ease-in-out 2; }
.donate-chip:hover .donate-chip__heart { animation: donate-beat 900ms ease-in-out infinite; }

@keyframes donate-beat {
  0%, 100% { transform: scale(1); }
  30%      { transform: scale(1.25); }
  50%      { transform: scale(0.95); }
  70%      { transform: scale(1.12); }
}
@keyframes donate-fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Latido recurrente del chip ~cada 10s (se pausa en hover para no pisar el lift). */
.donate-chip:not(:hover) { animation: donate-heartbeat-10s 10s ease-in-out infinite; transform-origin: center; }
@keyframes donate-heartbeat-10s {
  0%   { transform: scale(1); }
  2%   { transform: scale(1.16); }
  4%   { transform: scale(0.97); }
  6%   { transform: scale(1.10); }
  9%   { transform: scale(1); }
  100% { transform: scale(1); }
}

/* Corazones que emanan del chip (partículas flotantes, generadas por JS). */
.donate-heart-particle {
  position: fixed;
  z-index: 9997;
  width: 16px;
  height: 16px;
  pointer-events: none;
  opacity: 0;
  fill: var(--donate-heart, #88129a);
  filter: drop-shadow(0 1px 2px rgba(136, 18, 154, 0.25));
  will-change: transform, opacity;
  animation: donate-heart-float 2.4s ease-out forwards;
}
@keyframes donate-heart-float {
  0%   { opacity: 0;    transform: translate(-50%, 4px)  scale(0.4) rotate(-8deg); }
  18%  { opacity: 0.95; transform: translate(-50%, -8px) scale(1)   rotate(4deg); }
  100% { opacity: 0;    transform: translate(calc(-50% + var(--dx, 0px)), -66px) scale(0.85) rotate(-6deg); }
}

/* ===========================================================================
 *  Overlay + modal
 * =========================================================================*/

body.donate-no-scroll { overflow: hidden; }

.donate-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.donate-overlay.is-open { opacity: 1; pointer-events: auto; }

.donate-panel {
  position: fixed;
  z-index: 9999;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.98);
  width: 340px;
  max-width: calc(100vw - 2 * var(--sp-4, 1rem));
  max-height: calc(100vh - 2 * var(--sp-4, 1rem));
  overflow-y: auto;
  padding: 22px 20px 18px;
  text-align: center;
  background:
    radial-gradient(
      ellipse at top left,
      var(--c-mv-mapa-radial-from) 0%,
      var(--c-mv-mapa-radial-mid)  55%,
      transparent 100%
    ),
    var(--c-mv-bg-card, #ffffff);
  border: 1px solid var(--c-mv-card-border, #e2e8f0);
  border-radius: var(--c-card-radius, 16px);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(.2, .8, .2, 1);
}
.donate-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

/* Handle de arrastre: oculto en desktop; visible en el bottom-sheet móvil. */
.donate-panel__grab { display: none; }

.donate-panel__close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  color: var(--c-mv-ink-muted, #64748b);
  transition: background 150ms ease, color 150ms ease;
}
.donate-panel__close:hover {
  background: rgba(15, 23, 42, 0.06);
  color: var(--c-mv-ink, #1e293b);
}

.donate-panel__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.donate-panel__heart { width: 26px; height: 26px; fill: var(--donate-heart); }
.donate-panel__lead {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--c-mv-ink, #1e293b);
}
.donate-panel__lead-logo {
  height: 22px;
  width: auto;
  vertical-align: middle;
  margin-left: 4px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.donate-panel__story {
  width: 100%;
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  text-align: left;     /* párrafo largo: se lee mejor alineado a la izquierda */
  color: var(--c-mv-ink-muted, #64748b);
}

/* El QR es una tarjeta VERTICAL con su propio fondo (morado Yape + nombre):
   la mostramos tal cual, sin marco blanco, con esquinas redondeadas + sombra. */
.donate-panel__qr {
  width: 210px;
  margin: 12px auto 16px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.22);
  line-height: 0;
}
.donate-panel__qr img { width: 100%; height: auto; display: block; }

.donate-panel__info {
  width: 100%;
  margin: 4px 0 14px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid var(--c-mv-border-soft, #e2e8f0);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.donate-panel__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.donate-panel__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--c-mv-ink-muted, #64748b);
}
.donate-panel__value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--c-mv-ink, #1e293b);
  font-variant-numeric: tabular-nums;
}

.donate-panel__cta {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--donate-accent);
  color: #ffffff;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  transition: background 160ms ease, transform 120ms ease;
}
.donate-panel__cta:hover { background: var(--donate-accent-dark); transform: translateY(-1px); }
.donate-panel__cta:active { transform: translateY(0); }

/* ===== PayPal: ícono al costado del chip + sección en el modal ===== */
.donate-pp {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 34px; height: 34px; margin-left: 8px;
  background: #ffffff; border: 1px solid rgba(15, 23, 42, 0.18); border-radius: 50%;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.donate-pp:hover { border-color: #003087; transform: translateY(-1px); box-shadow: 0 3px 12px rgba(0, 48, 135, 0.22); }
.donate-pp:active { transform: translateY(0) scale(0.96); }
.donate-pp:focus-visible { outline: 2px solid #0070ba; outline-offset: 2px; }
.donate-pp__ic { width: 17px; height: 17px; fill: #003087; }

.donate-panel__pp { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--c-mv-border-soft, #e2e8f0); }
.donate-panel__pp-head { display: flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 8px; font-size: 0.85rem; font-weight: 700; color: var(--c-mv-ink, #1e293b); }
.donate-panel__pp-logo { width: 16px; height: 16px; fill: #003087; }
.donate-panel__pp-cta {
  display: block; width: 100%; margin-top: 10px; padding: 11px; box-sizing: border-box;
  text-align: center; text-decoration: none; border-radius: 10px;
  background: #0070ba; color: #ffffff;
  font-family: 'Inter', system-ui, sans-serif; font-size: 0.9rem; font-weight: 700;
  transition: background 160ms ease;
}
.donate-panel__pp-cta:hover { background: #005a96; }

.donate-panel__disclaimer {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--c-mv-border-soft, #e2e8f0);
  font-size: 0.68rem;
  font-style: italic;
  line-height: 1.4;
  color: var(--c-mv-ink-muted, #64748b);
}

/* ===========================================================================
 *  Responsive — en móvil el chip se compacta (solo corazón + logo)
 * =========================================================================*/

@media (max-width: 560px) {
  /* --- Chip compacto (solo corazón + logo) --- */
  .donate-chip__text { display: none; }
  .donate-chip { padding: 4px 10px; gap: 6px; }
  .donate-chip__logo { height: 31px; }
  .donate-chip__pp { height: 25px; }   /* −20% del logo Yape movil (31px) */

  /* --- Modal → SHEET que baja DESDE ARRIBA (conecta con el chip del header) ---
     Se cierra deslizando hacia ARRIBA (vuelve por donde vino), con la X, o
     tocando afuera. top:0 + max-height en dvh: el sheet queda dentro del
     viewport visible (bajo la barra del navegador), así la X es alcanzable. */
  .donate-panel {
    top: 0;
    bottom: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 0 0 18px 18px;   /* esquinas inferiores: cuelga desde arriba */
    transform: translateY(-100%);
    /* padding-top holgado: deja la fila de la X libre, que el lead no se le cruce. */
    padding: calc(44px + env(safe-area-inset-top, 0px)) 16px 6px;
  }
  .donate-panel.is-open { transform: translateY(0); }

  /* Handle de arrastre: el "labio" inferior del sheet (se jala hacia arriba). */
  .donate-panel__grab {
    display: block;
    position: relative;
    width: 100%;
    height: 24px;
    margin-top: 6px;
    cursor: grab;
    touch-action: none;          /* el arrastre no dispara scroll */
  }
  .donate-panel__grab::before {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.22);
  }

  /* Compactar el contenido para que entre cómodo. */
  .donate-panel__close { top: calc(10px + env(safe-area-inset-top, 0px)); right: 12px; }
  .donate-panel__head { margin-bottom: 6px; }
  .donate-panel__heart { display: none; }            /* el handle + lead ya alcanzan */
  .donate-panel__lead { font-size: 0.92rem; line-height: 1.4; }
  .donate-panel__story { font-size: 0.74rem; line-height: 1.4; margin-top: 8px; }
  .donate-panel__qr { width: 158px; margin: 10px auto 12px; }
  .donate-panel__info { margin: 4px 0 10px; padding: 9px 14px; }
  .donate-panel__disclaimer { margin-top: 10px; padding-top: 10px; font-size: 0.66rem; }
}

/* ===========================================================================
 *  Accesibilidad
 * =========================================================================*/

@media (prefers-reduced-motion: reduce) {
  .donate-chip--onboarding,
  .donate-chip--onboarding .donate-chip__heart,
  .donate-chip:hover .donate-chip__heart,
  .donate-chip:not(:hover),
  .donate-heart-particle,
  .donate-overlay,
  .donate-panel { animation: none !important; transition: none !important; }
}
