html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Roboto', sans-serif;
  background-color: #fafafa;
  overflow-x: hidden;
  min-height: 100vh;
  font-size: 15px;
}

/* body{
  display: flex;
  flex-direction: column;
  height: 100vh;
} */

body{
  display: block;      /* o quita el flex */
  min-height: 100vh;
}

header {
  background-color: #000;
  color: #fff;
  padding: 18px 30px;
  text-align: left;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

header h2 {
  margin: 0;
  font-size: 17px;
  font-weight: bold;
}

header p {
  color: #ccc;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500; /* medium */
}

.mobile-br {
  display: none;
}

/* ✅ Layout desktop estable (no invade el header con zoom) */
.main-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 60px 30px;
  box-sizing: border-box;

  flex: 1;                 /* ✅ ocupa SOLO el espacio restante debajo del header */
  min-height: 0;           /* ✅ evita overflow por min-height */
  overflow-y: auto;
  overflow-x: hidden;
}

/* Oculta SOLO la vista principal (la que tiene imagen) */
.main-content:not(.verificacion-wrapper) {
  visibility: hidden;
}

.image-area {
  flex: 0 0 45%;
  text-align: center;
}

.image-area img {
  max-height: 520px;                    /* ✅ evita que se “suba” por zoom */
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* ✅ Columna derecha: texto arriba + botones abajo */
.info-area {
  flex: 0 0 50%;
  padding-left: 40px;
  padding-bottom: 32px;          /* ⬅️ controla la altura final */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: calc(100vh - 96px);
  box-sizing: border-box;
}

h3 {
  margin-top: 0;
  color: #000;
  font-size: 17px;
  margin-bottom: 10px;
}

p {
  font-size: 14px;
  color: #333;
  line-height: 1.6;
  margin: 0;
}

strong {
  font-weight: bold;
}

/* ✅ Empuja botones al fondo de la columna derecha */
.buttons {
  margin-top: 22px;   /* vuelve a su comportamiento normal */
  display: flex;
  gap: 20px;
  justify-content: flex-end;
  padding-bottom: 80px;
  align-items: center;
  width: 100%;
}

.link {
  color: #f50057;
  text-decoration: underline;
  font-weight: 500;
  font-size: 14px;
}

.primary-button {
  background-color: #f50057;
  color: #fff;
  border: none;
  padding: 8px 28px;
  border-radius: 6px;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

/* Sección Verificación */
.verificacion-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 60px;
  box-sizing: border-box;

  margin-top: 100px;   /* ⬅️ ESTO la baja */
}

.form-wrapper {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

input[type="text"] {
  padding: 10px 14px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 10px;
  width: 420px;
  max-width: 90vw;
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mensaje-error {
  opacity: 0;
  transition: opacity 0.3s ease;
  min-height: 20px;
  margin-top: 14px;
  color: #fff;
  background-color: #e1002a;
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 6px;
  max-width: 500px;
  text-align: center;
  pointer-events: none;
}

.mensaje-error.visible {
  opacity: 1;
}

.primary-button.activo {
  opacity: 1 !important;
}


/* RESPONSIVE */
@media (max-width: 768px) {

  html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
  }

  /* ✅ CLAVE: anula el body height:100vh del CSS base en móviles */
  body{
    height: auto !important;
    min-height: 100vh;
  }

  header {
    padding: 18px 20px;
    text-align: left;
  }

  /* Layout en columna */
  .main-content {
    display: flex;
    flex-direction: column;
    padding: 20px;
    height: auto !important;
    align-items: center;
    text-align: center;

    /* ✅ CLAVE: en móvil deja fluir, evita que “corte” o empuje */
    overflow: visible !important;
  }

  /* Imagen ARRIBA */
  .image-area {
    display: block;
    width: 100%;
    order: -1;
    margin-bottom: 8px; /* menos espacio */
  }

  .image-area img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 240px;
    object-fit: contain;
    border-radius: 12px;
  }

  /* Texto debajo */
  .info-area {
    width: 100%;
    padding-left: 0;
    text-align: left;
    order: 0;

    /* ✅ CLAVE: anula el min-height del desktop que empuja en móvil */
    min-height: auto !important;
    justify-content: flex-start !important;

    /* 🔥 FIX: antes 190px (demasiado), ahora lo justo para la barra fija */
    padding-bottom: 120px;
  }

  /* Barra fija inferior */
  .buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    /* 🔥 un poco más compacto sin cambiar el diseño */
    gap: 14px;

    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;

    /* 🔥 más compacto sin romper */
    padding: 14px 18px 18px;

    box-sizing: border-box;
    background-color: #fafafa;
    text-align: center;
    z-index: 10;
  }

  .primary-button {
    width: 100%;
    box-sizing: border-box;
  }

  /* Sección verificación */
  .verificacion-wrapper {
    padding: 0 20px;
    margin-top: 28px;
    flex-direction: column;
    align-items: stretch;
    height: auto !important;
    width: 100%;
    box-sizing: border-box;
  }

  .form-wrapper {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 14px;
  }

  .form-wrapper label {
    font-weight: 500;
    margin-bottom: 6px;
    margin-left: 2px;
    text-align: left;
    padding-left: 8px;
  }

  input[type="text"] {
    width: 100%;
    max-width: none;
    padding: 14px 16px;
    font-size: 15px;
    border-radius: 10px;
    margin: 0 auto;
    display: block;
    box-sizing: border-box;
  }

  .mensaje-error {
    margin-top: 14px;
    font-size: 14px;
    text-align: center;
  }

  .mobile-br {
    display: inline;
  }
}

@media (max-width: 1100px) {

  .main-content {
    height: auto !important; /* evita que se corte el scroll */
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .image-area {
    order: -1;
    width: 100%;
    margin-bottom: 8px;
  }

  .info-area {
    width: 100%;
    padding-left: 0;
    text-align: left;

    /* 🔥 igual que móvil: baja el espacio extra */
    padding-bottom: 120px;
  }
}

@media (max-width: 768px) {

  /* Formulario en columna */
  .form-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .form-wrapper input[type="text"] {
    width: 100%;
  }

  /* Botón fijo pero separado del borde inferior */
  #btn-validar {
    position: fixed;
    bottom: 80px;               /* ✅ AQUÍ está lo que querías */
    left: 20px;
    right: 20px;
    width: calc(100% - 40px);
    margin: 0;
    padding: 14px;
    font-size: 15px;
    z-index: 20;
  }

  /* Deja espacio para que el botón no tape contenido */
  .verificacion-wrapper {
    padding-bottom: 140px;      /* 80px + alto del botón */
  }
}

/* ✅ Ocultar secciones sin romper su display original (flex/grid/etc) */
.is-hidden { 
  display: none !important; 
}

/* =========================
   AJUSTE FINAL MOBILE
   (sin scroll ni espacios fantasma)
   ========================= */
@media (max-width: 480px) {

  /* No “repartas” el alto: pega todo arriba */
  .main-content{
    justify-content: flex-start !important;
    align-items: center;
    gap: 8px !important;
    padding: 8px 12px !important;
  }

  /* Mata márgenes/paddings fantasmas del embebido */
  #contenedor-imagen,
  #contenedor-imagen *{
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Quita el “baseline gap” típico de imágenes inline */
  #contenedor-imagen{
    line-height: 0 !important;
  }

  /* ✅ CLAVE: limita el área visible y corta el “aire” si la imagen lo trae */
  #contenedor-imagen .image-area{
    max-height: 220px !important;
    overflow: hidden !important;
    width: 100%;
  }

  /* Si la imagen tiene aire abajo, esto lo “recorta” visualmente */
  #contenedor-imagen .image-area img{
    width: 100% !important;
    height: 220px !important;
    object-fit: cover !important;
    object-position: top center !important;
    display: block !important;
  }

  /* Texto más pegado */
  .resultado, .resultado p, .resultado h2, #link-verificar-otro{
    margin-top: 6px !important;
    margin-bottom: 6px !important;
  }
}


  /* Ultimo cambio, borrar si no funciona */

/* ===============================
   AJUSTES SOLO PARA VISTA MÓVIL
   No afecta web ni web angosta
   =============================== */
@media (max-width: 480px) {

  /* Más aire entre la barra y el borde inferior */
  .buttons {
    padding: 14px 18px 50px;
  }

  /* Reducir espacio entre el link y el botón */
  .buttons a {
    margin-bottom: 6px;
  }

}

/* Igualar altura real de "primary-button" sin importar si es <a> o <button> */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 15px 25px;        /* ajusta aquí si quieres */
  border-width: 1px;         /* evita que uno tenga borde más grueso */
  box-sizing: border-box;
  text-decoration: none;     /* para que el <a> parezca botón */
}
