/* =============================================================================
   LUUPIGO - DONACIONES POST-RECUPERACIÓN | MODALES PWA + WEB (MÓVIL / PC)
   Adaptado completamente a responsive, gestos táctiles, scroll suave
   ============================================================================= */

/* MODAL PRINCIPAL - FONDO + ANIMACIÓN */
.modal-donaciones {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 18px !important;
  background: rgba(15, 23, 42, 0.72) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.25s ease, visibility 0.25s ease;
  visibility: visible;
  opacity: 1;
  box-sizing: border-box;
}

/* Modo cerrado (para JS) */
.modal-donaciones.closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* CONTENEDOR DEL MODAL - con scroll suave y límites seguros */
.modal-contenido-donaciones {
  width: min(94vw, 520px);
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  transform: scale(1);
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  position: relative;
  margin: auto;
}

/* Ajuste de padding interno en móvil para notch + home bar */
@supports (padding: max(0px)) {
  .modal-contenido-donaciones {
    padding-left: max(22px, env(safe-area-inset-left));
    padding-right: max(22px, env(safe-area-inset-right));
    padding-top: max(22px, env(safe-area-inset-top));
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
}

/* BOTÓN CERRAR - táctil y visible */
.cerrar-modal-donaciones {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(243, 244, 246, 0.95);
  font-size: 26px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s, transform 0.1s;
  color: #1f2937;
}

.cerrar-modal-donaciones:hover {
  background: #e5e7eb;
  transform: scale(1.02);
}

.cerrar-modal-donaciones:active {
  transform: scale(0.96);
}

/* ============================================================================
   BLOQUE DE DONACIONES (post-recuperación)
   ============================================================================ */

.seccion-donaciones {
  margin-top: 18px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fff7ed 0%, #fdf2f8 55%, #eef2ff 100%);
  border: 1px solid rgba(236, 72, 153, 0.18);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.header-donaciones {
  text-align: center;
  margin-bottom: 16px;
}

.header-donaciones h4 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 900;
  color: #111827;
}

.header-donaciones p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: #6b7280;
}

.opciones-donacion-rapida {
  margin-top: 14px;
}

.grid-cantidades {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

/* BOTONES CANTIDAD - mejor adaptación táctil */
.btn-cantidad {
  min-height: 82px;
  padding: 12px 8px;
  border: 2px solid rgba(226, 232, 240, 0.95);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  color: #111827;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease,
    background 0.16s ease;
  touch-action: manipulation;
}

.btn-cantidad:hover,
.btn-cantidad.seleccionado {
  transform: translateY(-2px);
  border-color: #ec4899;
  background: #fff;
  box-shadow: 0 14px 28px rgba(236, 72, 153, 0.18);
}

.btn-cantidad.recomendado {
  border-color: rgba(236, 72, 153, 0.45);
  position: relative;
}

.btn-cantidad.recomendado::before {
  content: "Popular";
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 10px;
  border-radius: 999px;
  background: #ec4899;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

.btn-cantidad .emoji,
.btn-cantidad .cantidad,
.btn-cantidad .desc {
  display: block;
  text-align: center;
}

.btn-cantidad .emoji {
  font-size: 22px;
  margin-bottom: 4px;
}

.btn-cantidad .cantidad {
  font-size: 20px;
  font-weight: 900;
}

.btn-cantidad .desc {
  margin-top: 3px;
  font-size: 11px;
  color: #6b7280;
  font-weight: 700;
}

/* ACCIONES BOTONES */
.acciones-donacion {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.acciones-donacion button {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 850;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  touch-action: manipulation;
}

.acciones-donacion button:hover {
  transform: translateY(-1px);
}

.btn-donar-ahora {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  box-shadow: 0 14px 26px rgba(139, 92, 246, 0.22);
}

.btn-donar-mas-tarde {
  background: #f3f4f6;
  color: #374151;
}

.btn-sin-donacion {
  background: transparent;
  color: #6b7280;
  text-decoration: underline;
}

/* ============================================================================
   ADAPTACIONES PWA + MÓVIL PROFUNDO / PC ESCRITORIO
   ============================================================================ */

/* Móviles pequeños */
@media (max-width: 480px) {
  .modal-donaciones {
    padding: 12px !important;
    align-items: flex-start !important;
    /* Sube ligeramente el modal cerca del top en móvil */
  }

  .modal-contenido-donaciones {
    width: 100%;
    max-height: 85vh;
    border-radius: 24px;
    padding: 18px;
  }

  .cerrar-modal-donaciones {
    width: 42px;
    height: 42px;
    top: 12px;
    right: 12px;
  }

  .btn-cantidad {
    min-height: 72px;
    padding: 12px 6px;
  }

  .btn-cantidad .emoji {
    font-size: 20px;
  }

  .acciones-donacion button {
    min-height: 48px;
  }
}

/* Móviles muy pequeños o landscape */
@media (max-width: 380px) {
  .grid-cantidades {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .btn-cantidad {
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
  }

  .btn-cantidad .emoji,
  .btn-cantidad .cantidad,
  .btn-cantidad .desc {
    display: inline-block;
  }

  .btn-cantidad .cantidad {
    font-size: 18px;
    margin: 0 6px;
  }

  .btn-cantidad.recomendado::before {
    top: -8px;
    font-size: 9px;
  }
}

/* Móviles con gestos y notch (PWA + iOS) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .modal-contenido-donaciones {
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }

  .acciones-donacion {
    margin-bottom: env(safe-area-inset-bottom, 0);
  }
}

/* PC / Escritorio: mejoras hover y tamaño mínimo */
@media (min-width: 1024px) {
  .modal-contenido-donaciones {
    width: 520px;
    max-height: 85vh;
    border-radius: 32px;
    padding: 28px;
  }

  .cerrar-modal-donaciones {
    width: 40px;
    height: 40px;
    transition: all 0.16s ease;
  }

  .btn-cantidad {
    cursor: pointer;
  }

  .btn-cantidad:hover {
    transform: translateY(-3px);
  }

  .acciones-donacion button:hover {
    transform: translateY(-2px);
    filter: brightness(0.98);
  }

  .btn-donar-ahora:hover {
    box-shadow: 0 18px 32px rgba(139, 92, 246, 0.35);
  }
}

/* Prevenir scroll del body cuando modal abierto (usa JS opcional) */
body.modal-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* =============================================================================
   LUUPIGO - MODAL DONACIONES COMPLETO
============================================================================= */

.modal-header-donaciones {
  position: relative;
  padding-right: 48px;
  margin-bottom: 18px;
}

.modal-titulo-donaciones {
  margin: 0 0 8px;
  font-size: 26px;
  line-height: 1.1;
  font-weight: 950;
  color: #111827;
}

.modal-subtitulo-donaciones {
  margin: 0;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.45;
}

.contenido-principal-donaciones {
  display: grid;
  gap: 18px;
}

.seccion-estadisticas-donaciones,
.seccion-monto-donaciones,
.seccion-metodo-pago-donaciones,
.seccion-anonimato-donaciones,
.seccion-mensaje-donaciones,
.seccion-accion-donaciones,
.seccion-info-donaciones {
  padding: 16px;
  border-radius: 20px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
}

.seccion-monto-donaciones h3,
.seccion-metodo-pago-donaciones h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 900;
  color: #111827;
}

.montos-sugeridos-donaciones {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.btn-monto-donaciones {
  min-height: 48px;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.btn-monto-donaciones.seleccionado {
  border-color: #ec4899;
  background: #fdf2f8;
  color: #be185d;
}

.monto-personalizado-donaciones {
  margin-top: 14px;
}

.input-monto-container {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 0 12px;
}

.input-monto-personalizado {
  width: 100%;
  height: 46px;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 16px;
}

.metodos-pago-donaciones {
  display: grid;
  gap: 10px;
}

.metodo-pago-item {
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.metodo-radio {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metodo-radio label {
  cursor: pointer;
  font-weight: 900;
}

.descripcion-metodo {
  margin-left: 28px;
  margin-top: 4px;
  font-size: 13px;
  color: #6b7280;
}

.checkbox-anonimo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.texto-ayuda-anonimo {
  display: block;
  margin-top: 6px;
  color: #6b7280;
}

.textarea-mensaje-donacion {
  width: 100%;
  min-height: 82px;
  margin-top: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 12px;
  resize: vertical;
  font-family: inherit;
  box-sizing: border-box;
}

.contador-caracteres {
  margin-top: 6px;
  text-align: right;
  font-size: 12px;
  color: #6b7280;
}

.btn-confirmar-donacion {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  font-weight: 950;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(139, 92, 246, .25);
}

.btn-confirmar-donacion:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

.texto-seguridad-donaciones {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: #6b7280;
}

.info-item-donaciones {
  display: flex;
  gap: 12px;
}

.info-item-donaciones p {
  margin: 4px 0 0;
  color: #6b7280;
  font-size: 13px;
}

.grid-estadisticas-donaciones {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.estadistica-item-donaciones {
  text-align: center;
  padding: 10px;
  border-radius: 14px;
  background: #fff;
}

.estadistica-valor {
  display: block;
  font-weight: 950;
  color: #059669;
}

.estadistica-label {
  display: block;
  font-size: 11px;
  color: #6b7280;
}

@media (max-width: 480px) {
  .modal-titulo-donaciones {
    font-size: 22px;
  }

  .montos-sugeridos-donaciones {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-estadisticas-donaciones {
    grid-template-columns: 1fr;
  }
}