/* ============================================================
 * Alerta de Seguridad Anti-Estafa - CONCASAYA
 * Modal inescapable en carga inicial
 * v3: estilo bold tipo flyer (rojo/amarillo/negro/blanco)
 * Todo el detalle esta en /proteccion-contra-estafas.html
 * ============================================================ */

:root {
  --sa-z: 9999;
  --sa-radius: 14px;
  --sa-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  --sa-danger: #dc2626;
  --sa-danger-dark: #991b1b;
  --sa-amber: #fbbf24;
  --sa-amber-dark: #d97706;
  --sa-black: #0f172a;
  --sa-text: #1f2937;
  --sa-text-soft: #4b5563;
  --sa-success: #16a34a;
  --sa-line: #e5e7eb;
}

/* ---------- Backdrop ---------- */
#sa-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--sa-z);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
#sa-backdrop.sa-open {
  display: flex;
  opacity: 1;
  animation: saFadeIn 0.3s ease forwards;
}
@keyframes saFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Card ---------- */
#sa-card {
  position: relative;
  width: 100% !important;
  max-width: min(560px, calc(100vw - 20px)) !important;
  max-height: calc(100vh - 20px);
  max-height: calc(100dvh - 20px);
  background: #ffffff;
  border-radius: var(--sa-radius);
  box-shadow: var(--sa-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-sizing: border-box !important;
  min-width: 0;
}
#sa-card * { box-sizing: border-box; max-width: 100%; }
#sa-card img { max-width: 100%; }
#sa-backdrop.sa-open #sa-card { transform: translateY(0) scale(1); }

/* ---------- Header (blanco con sirena + logo + ATENCION) ---------- */
#sa-header {
  position: relative;
  background: #ffffff;
  color: var(--sa-black);
  padding: 14px 14px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.sa-header-top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.sa-siren {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15), 0 4px 10px rgba(220, 38, 38, 0.4);
  animation: saSirenPulse 1.4s ease-in-out infinite;
}
@keyframes saSirenPulse {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-10deg); }
  75%      { transform: rotate(10deg); }
}
.sa-logo {
  flex-shrink: 1;
  min-width: 0;
  max-width: 100%;
  height: 36px;
  width: auto;
  object-fit: contain;
}
.sa-header-title {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  overflow: hidden;
}
.sa-eyebrow {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--sa-danger);
  margin-bottom: 1px;
}
#sa-title {
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  margin: 0;
  color: var(--sa-danger);
  letter-spacing: -0.5px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Banner amarillo: "Estamos siendo suplantados" */
.sa-banner-yellow {
  background: var(--sa-amber);
  color: #000;
  font-weight: 900;
  font-size: 15px;
  text-align: center;
  padding: 9px 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 0 -14px;
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
}

/* Subhead: "No caiga en estafas" */
.sa-subhead {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--sa-black);
  padding-bottom: 12px;
  border-bottom: 3px solid #000;
}
.sa-subhead i {
  color: var(--sa-danger);
  font-size: 18px;
}
.sa-subhead::after {
  content: "";
  flex: 1;
  height: 3px;
  background: var(--sa-danger);
  max-width: 40px;
  border-radius: 2px;
}

/* ---------- Body ---------- */
#sa-body {
  padding: 12px 12px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  background: #f8fafc;
}

/* Grid de 3 tarjetas */
.sa-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin-bottom: 10px;
}
.sa-card-rule {
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 10px;
}
.sa-card-rule--bad { border-color: var(--sa-danger); background: #fef2f2; }
.sa-card-rule--ok  { border-color: var(--sa-success); background: #f0fdf4; }
.sa-card-rule strong {
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--sa-black);
  text-transform: uppercase;
  letter-spacing: 0.2px;
  display: block;
}
.sa-card-rule span {
  font-size: 11px;
  line-height: 1.3;
  color: var(--sa-text-soft);
  font-weight: 500;
  display: block;
  margin-top: 1px;
}
.sa-icon-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  flex-shrink: 0;
}
.sa-icon-circle--bad { background: var(--sa-danger); }
.sa-icon-circle--ok  { background: var(--sa-success); }

/* CTA amarillo */
.sa-cta-yellow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sa-amber);
  color: #000;
  padding: 11px 13px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
  border: 2px solid #000;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sa-cta-yellow:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  background: #fcd34d;
}
.sa-cta-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #000;
  color: var(--sa-amber);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.sa-cta-text {
  flex: 1;
  min-width: 0;
}
.sa-cta-text strong {
  display: block;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sa-cta-text span {
  display: block;
  font-size: 10.5px;
  font-weight: 500;
  color: #1f2937;
  margin-top: 1px;
}
.sa-cta-arrow {
  flex-shrink: 0;
  font-size: 14px;
}
.sa-cta-yellow:hover .sa-cta-arrow { transform: translateX(3px); }

/* ---------- Footer ---------- */
#sa-footer {
  padding: 11px 14px 13px;
  border-top: 1px solid var(--sa-line);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
#sa-acknowledge {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 11.5px;
  color: var(--sa-text-soft);
  cursor: pointer;
  user-select: none;
  line-height: 1.35;
}
#sa-acknowledge input { margin-top: 1px; cursor: pointer; flex-shrink: 0; }
#sa-btn-confirm {
  width: 100%;
  border: none;
  border-radius: 9px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}
#sa-btn-confirm:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
#sa-btn-confirm:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4); }
#sa-btn-confirm:not(:disabled):active { transform: scale(0.98); }

/* ---------- Floating reopen button ---------- */
#sa-reopen {
  position: fixed;
  left: 16px;
  bottom: 88px;
  z-index: 90;
  background: linear-gradient(135deg, var(--sa-danger) 0%, var(--sa-danger-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 14px 9px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.4);
  display: none;
  align-items: center;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: saReopenPulse 2.4s ease-in-out infinite;
}
#sa-reopen:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(220, 38, 38, 0.5); }
@keyframes saReopenPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(220, 38, 38, 0.4); }
  50%      { box-shadow: 0 6px 18px rgba(220, 38, 38, 0.75); }
}
#sa-reopen i { font-size: 13px; }

/* ---------- Desktop: tipografia un poco mas amplia ---------- */
@media (min-width: 640px) {
  #sa-backdrop { padding: 20px; }
  #sa-card { max-width: min(620px, calc(100vw - 40px)); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); }
  #sa-header { padding: 18px 20px 0; gap: 10px; }
  .sa-siren { width: 52px; height: 52px; font-size: 23px; }
  .sa-logo { height: 48px; }
  #sa-title { font-size: 36px; }
  .sa-eyebrow { font-size: 11px; }
  .sa-banner-yellow { font-size: 20px; padding: 12px 16px; margin: 0 -20px; }
  .sa-subhead { font-size: 22px; padding-bottom: 16px; }
  .sa-subhead i { font-size: 24px; }
  #sa-body { padding: 18px 20px 14px; }
  .sa-grid-3 { grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 14px; }
  .sa-card-rule { padding: 14px 12px; flex-direction: column; gap: 8px; text-align: center; }
  .sa-card-rule strong { font-size: 13px; }
  .sa-card-rule span { font-size: 11.5px; }
  .sa-icon-circle { width: 42px; height: 42px; font-size: 20px; }
  .sa-cta-yellow { padding: 14px 18px; }
  .sa-cta-icon { width: 42px; height: 42px; font-size: 19px; }
  .sa-cta-text strong { font-size: 16px; }
  .sa-cta-text span { font-size: 12px; }
  #sa-footer { padding: 14px 20px 16px; }
  #sa-acknowledge { font-size: 12.5px; }
  #sa-btn-confirm { padding: 13px 16px; font-size: 15px; }
  #sa-reopen { left: 18px; bottom: 96px; }
}

@media (max-width: 380px) {
  #sa-card { max-width: 100%; }
  #sa-backdrop { padding: 6px; }
  #sa-header { padding: 10px 10px 0; }
  .sa-siren { width: 36px; height: 36px; font-size: 16px; }
  .sa-logo { height: 30px; }
  #sa-title { font-size: 22px; }
  .sa-banner-yellow { font-size: 13px; padding: 7px 8px; margin: 0 -10px; }
  .sa-subhead { font-size: 14px; padding-bottom: 10px; }
  #sa-body { padding: 10px 10px 8px; }
  .sa-grid-3 { gap: 5px; }
  .sa-card-rule { padding: 7px 5px; }
  .sa-card-rule strong { font-size: 10px; }
  .sa-card-rule span { font-size: 9.5px; }
  .sa-icon-circle { width: 28px; height: 28px; font-size: 14px; }
  .sa-cta-yellow { padding: 9px 10px; gap: 8px; }
  .sa-cta-icon { width: 30px; height: 30px; font-size: 14px; }
  .sa-cta-text strong { font-size: 12px; }
  .sa-cta-text span { font-size: 10px; }
  #sa-footer { padding: 10px 12px 12px; }
  #sa-reopen { left: 10px; bottom: 84px; font-size: 11px; padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .sa-siren, #sa-reopen { animation: none; }
  #sa-backdrop, #sa-card, #sa-cta-yellow, #sa-btn-confirm { transition: none; }
}
