/* =============================================
   Segantia – Formulario Decesos Prima Única
   CSS v1.1.0
   ============================================= */

/* --- Variables de marca ------------------- */
:root {
  --sdf-blue:       #1a5fa8;
  --sdf-blue-light: #e8f0fb;
  --sdf-blue-mid:   #b5d0f0;
  --sdf-blue-dark:  #0d3d73;
  --sdf-gold-bg:    #fdf6e3;
  --sdf-gold-bdr:   #e8c96b;
  --sdf-gold-text:  #6b4c0a;
  --sdf-text:       #1a1a2e;
  --sdf-muted:      #5a6478;
  --sdf-border:     #d4dce8;
  --sdf-radius:     10px;
  --sdf-radius-sm:  7px;
  --sdf-trans:      0.18s ease;
  --sdf-nav-h:      72px;
}

/* =============================================
   DESKTOP — integrado, sin caja, full width
   ============================================= */
.sdf-outer {
  display: block;
  width: 100%;
  min-height: 100vh;
  background: #fff;
  box-sizing: border-box;
}

.sdf-wrap {
  background: #fff;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Sin borde ni sombra en desktop: integrado con el fondo */
  border: none;
  box-shadow: none;
  border-radius: 0;
}

/* --- Progress bar -------------------------- */
.sdf-progress-bar {
  height: 3px;
  background: var(--sdf-border);
  width: 100%;
  /* Ancho completo de pantalla aunque el contenido esté centrado */
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  width: 100vw;
}
.sdf-progress-fill {
  height: 100%;
  background: var(--sdf-blue);
  width: 0%;
  transition: width .4s ease;
}

/* --- Steps --------------------------------- */
.sdf-step {
  display: none;
  flex-direction: column;
  /* Espacio generoso en desktop, empieza desde arriba */
  padding: 3rem 0 1.5rem;
  flex: 1;
  animation: sdfFadeIn .28s ease;
}
.sdf-step.sdf-active {
  display: flex;
}
@keyframes sdfFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.sdf-step-num {
  font-size: 11px;
  color: var(--sdf-muted);
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: .5rem;
}

.sdf-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--sdf-text);
  line-height: 1.25;
  margin-bottom: 1.5rem;
}

.sdf-sub {
  font-size: 15px;
  color: var(--sdf-muted);
  line-height: 1.55;
  margin-top: -.75rem;
  margin-bottom: 1.25rem;
}

/* --- Promo cards --------------------------- */
.sdf-promos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 1.75rem;
}

.sdf-promo {
  border-radius: var(--sdf-radius-sm);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.45;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.sdf-promo--blue {
  background: var(--sdf-blue-light);
  border: 0.5px solid var(--sdf-blue-mid);
  color: var(--sdf-blue-dark);
}
.sdf-promo--gold {
  background: var(--sdf-gold-bg);
  border: 0.5px solid var(--sdf-gold-bdr);
  color: var(--sdf-gold-text);
}
.sdf-promo-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
}
.sdf-promo strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 3px;
}
.sdf-promo span { display: block; }

/* --- Label + Inputs ------------------------ */
.sdf-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--sdf-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 6px;
  display: block;
}
.sdf-input {
  width: 100%;
  font-size: 20px;
  padding: 10px 0;
  border: none;
  border-bottom: 2px solid var(--sdf-border);
  background: transparent;
  color: var(--sdf-text);
  outline: none;
  transition: border-color var(--sdf-trans);
  font-family: inherit;
  box-sizing: border-box;
}
.sdf-input:focus { border-color: var(--sdf-blue); }
.sdf-input::placeholder { color: #b0b8c8; }

.sdf-input[type=number]::-webkit-inner-spin-button,
.sdf-input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.sdf-input[type=number] { -moz-appearance: textfield; }

/* --- Option buttons ------------------------ */
.sdf-opts { display: flex; flex-direction: column; gap: 10px; }
.sdf-opt {
  padding: 13px 16px;
  border: 0.5px solid var(--sdf-border);
  border-radius: var(--sdf-radius-sm);
  cursor: pointer;
  font-size: 15px;
  color: var(--sdf-text);
  background: #fff;
  transition: border-color var(--sdf-trans), background var(--sdf-trans);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  width: 100%;
}
.sdf-opt:hover {
  border-color: var(--sdf-blue);
  background: var(--sdf-blue-light);
}
.sdf-opt.sdf-selected {
  border-color: var(--sdf-blue);
  background: var(--sdf-blue-light);
  color: var(--sdf-blue-dark);
  font-weight: 600;
}
.sdf-opt-key {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 0.5px solid var(--sdf-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--sdf-muted);
  flex-shrink: 0;
  transition: background var(--sdf-trans), color var(--sdf-trans);
}
.sdf-opt.sdf-selected .sdf-opt-key {
  background: var(--sdf-blue);
  border-color: var(--sdf-blue);
  color: #fff;
}

/* --- Insight banners ----------------------- */
.sdf-insight {
  border-radius: var(--sdf-radius-sm);
  padding: 11px 13px;
  margin-bottom: 1rem;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  gap: 9px;
  align-items: flex-start;
}
.sdf-insight--blue  { background: var(--sdf-blue-light); border: 0.5px solid var(--sdf-blue-mid); color: var(--sdf-blue-dark); }
.sdf-insight--gold  { background: var(--sdf-gold-bg);    border: 0.5px solid var(--sdf-gold-bdr); color: var(--sdf-gold-text); }
.sdf-insight--info  { background: #f0f4fa; border: 0.5px solid var(--sdf-border); color: var(--sdf-muted); }
.sdf-insight-icon   { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* --- Ages list ----------------------------- */
.sdf-ages-list { display: flex; flex-direction: column; gap: 14px; }
.sdf-age-row   { display: flex; align-items: center; gap: 14px; }
.sdf-age-label { font-size: 13px; color: var(--sdf-muted); font-weight: 600; min-width: 100px; flex-shrink: 0; }
.sdf-age-row .sdf-input { font-size: 16px; }

/* --- RGPD ---------------------------------- */
.sdf-rgpd {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 1.25rem;
  font-size: 12px;
  line-height: 1.55;
  color: var(--sdf-muted);
}
.sdf-rgpd input[type=checkbox] {
  margin-top: 2px;
  accent-color: var(--sdf-blue);
  flex-shrink: 0;
  cursor: pointer;
  width: 15px; height: 15px;
}
.sdf-rgpd a { color: var(--sdf-blue); text-decoration: underline; }

/* --- Error --------------------------------- */
.sdf-error { font-size: 13px; color: #c0392b; margin-top: .75rem; min-height: 18px; }

/* --- Navigation (desktop) ------------------ */
.sdf-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 0 2.5rem;
  border-top: 0.5px solid var(--sdf-border);
  margin-top: auto;
}
.sdf-btn-back {
  font-size: 13px;
  color: var(--sdf-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  font-family: inherit;
  transition: color var(--sdf-trans);
}
.sdf-btn-back:hover { color: var(--sdf-text); }

.sdf-btn-next {
  padding: 13px 32px;
  border-radius: var(--sdf-radius-sm);
  background: var(--sdf-blue);
  color: #fff;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity var(--sdf-trans), transform var(--sdf-trans);
  letter-spacing: .01em;
}
.sdf-btn-next:hover:not(:disabled)  { opacity: .88; }
.sdf-btn-next:active:not(:disabled) { transform: scale(.98); }
.sdf-btn-next:disabled   { opacity: .35; cursor: not-allowed; }
.sdf-btn-next.sdf-loading { opacity: .6; cursor: wait; }

/* --- Thank you ----------------------------- */
.sdf-thankyou {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  flex: 1;
  animation: sdfFadeIn .3s ease;
}
.sdf-thankyou.sdf-active { display: flex; }
.sdf-thankyou .sdf-title { margin-bottom: .6rem; }
.sdf-thankyou p {
  font-size: 15px;
  color: var(--sdf-muted);
  max-width: 360px;
  line-height: 1.6;
}
.sdf-check-circle {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--sdf-blue-light);
  color: var(--sdf-blue);
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1.25rem;
}

/* =============================================
   MÓVIL — compacto, nav fijo abajo
   ============================================= */
@media (max-width: 680px) {

  .sdf-outer {
    background: #fff;
    min-height: 100vh;
    min-height: 100dvh; /* dynamic viewport en Safari iOS */
  }

  .sdf-wrap {
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
    /* Espacio inferior para el nav fijo */
    padding-bottom: var(--sdf-nav-h);
  }

  /* Progress bar normal en móvil (no necesita truco de full-width) */
  .sdf-progress-bar {
    position: static;
    left: auto; right: auto;
    margin-left: 0; margin-right: 0;
    width: 100%;
  }

  .sdf-step {
    /* Reducir padding vertical para que todo quepa sin scroll */
    padding: 1.25rem 1.25rem 1rem;
    flex: none; /* no estira: el contenido manda */
  }

  .sdf-title {
    font-size: 22px;
    margin-bottom: 1rem;
  }

  .sdf-sub {
    font-size: 13px;
    margin-bottom: .9rem;
  }

  /* Promos en columna en pantallas muy pequeñas */
  .sdf-promos {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 1.1rem;
  }

  .sdf-promo {
    padding: 9px 10px;
    font-size: 11.5px;
    gap: 7px;
  }
  .sdf-promo strong { font-size: 11.5px; margin-bottom: 2px; }
  .sdf-promo-icon   { font-size: 15px; }

  .sdf-input { font-size: 17px; }

  .sdf-opt { padding: 11px 13px; font-size: 14px; }

  .sdf-insight {
    font-size: 12.5px;
    padding: 9px 11px;
    margin-bottom: .75rem;
  }

  /* Nav FIJO en la parte inferior — siempre visible en móvil */
  .sdf-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border-top: 0.5px solid var(--sdf-border);
    padding: .75rem 1.25rem;
    height: var(--sdf-nav-h);
    box-sizing: border-box;
    /* Sombra suave para separar del contenido */
    box-shadow: 0 -2px 12px rgba(26,95,168,.06);
    margin-top: 0;
  }

  .sdf-btn-next {
    padding: 12px 24px;
    font-size: 15px;
  }

  .sdf-thankyou {
    padding: 2.5rem 1.5rem;
    /* Centrar verticalmente en el espacio disponible sobre el nav */
    min-height: calc(100vh - var(--sdf-nav-h));
    min-height: calc(100dvh - var(--sdf-nav-h));
    justify-content: center;
  }
}

/* Pantallas muy pequeñas (iPhone SE, etc.) */
@media (max-width: 380px) {
  .sdf-promos {
    grid-template-columns: 1fr;
  }
  .sdf-title { font-size: 20px; }
  .sdf-step  { padding: 1rem 1rem .75rem; }
}

/* Landscape móvil: compactar todavía más */
@media (max-height: 560px) and (orientation: landscape) {
  .sdf-step   { padding: .75rem 1.25rem .5rem; }
  .sdf-promos { margin-bottom: .6rem; }
  .sdf-title  { font-size: 18px; margin-bottom: .6rem; }
  .sdf-promo  { padding: 7px 9px; }
}
