#form {
  display: flex;
  justify-content: center !important;
  align-items: center;
  padding: 1rem 0;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  color: #fff;

  /* Vars base */
  --accent: #00bfff;
  --error: #ff5b7e;
  --error-bg: rgba(255, 91, 126, 0.1);
  --error-br: rgba(255, 91, 126, 0.55);
  --neon: rgba(255, 91, 126, 0.65);
}

/* Selección legible dentro del formulario: fondo y color para texto seleccionado */
.form ::selection,
.form *::selection,
.form input::selection,
.form textarea::selection,
.form label .input::selection {
  background: rgba(0, 191, 255, 0.25);
  color: #ffffff;
}
.form ::-moz-selection,
.form *::-moz-selection,
.form input::-moz-selection,
.form textarea::-moz-selection,
.form label .input::-moz-selection {
  background: rgba(0, 191, 255, 0.25);
  color: #ffffff;
}

.title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -1px;
  position: relative;
  display: flex;
  align-items: center;
  padding-left: 30px;
  color: #00bfff;
  width: 310px;
}

.title::before,
.title::after {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  border-radius: 50%;
  left: 0px;
  background-color: #00bfff;
}

.title::before {
  width: 18px;
  height: 18px;
}

.title::after {
  width: 18px;
  height: 18px;
  animation: pulse 1s linear infinite;
}

.flex {
  display: flex;
  width: 100%;
  gap: 6px;
}

.form label {
  position: relative;
}

.form label .input {
  background-color: #333 !important;
  color: #fff !important;
  width: 100%;
  padding: 20px 5px 5px 10px;
  outline: 0;
  border: 1px solid rgba(105, 105, 105, 0.397);
  border-radius: 10px;
  caret-color: #ffffff; /* asegurar que el cursor sea visible */
}

/* Accesible: anillo/halo visible al hacer focus con teclado */
.form label .input:focus,
.form label .input:focus-visible {
  /* Mantener outline disabled visualmente pero añadir un halo claro */
  outline: none;
  border-color: #00bfff;
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.14),
    0 0 10px rgba(0, 191, 255, 0.18);
  -webkit-box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.14),
    0 0 10px rgba(0, 191, 255, 0.18);
  caret-color: #ffffff;
}

.form label .input + em + span,
.form label .input + span {
  color: rgba(255, 255, 255, 0.5);
  position: absolute;
  left: 10px;
  top: 0px;
  font-size: 1.5em;
  cursor: text;
  transition: 0.3s ease;
}

/* ======= ERROR STATE (Neón) ======= */
.is-invalid {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 2px rgba(255, 91, 126, 0.18), 0 0 18px var(--neon),
    0 10px 24px rgba(0, 0, 0, 0.35);
}
/* === Invalid feedback: legible sin cajas === */
.invalid-feedback {
  display: block; /* que siempre se lea debajo del input */
  margin-top: 0.35rem;
  font-size: 0.95rem; /* un poco más grande */
  line-height: 1.25;
  font-weight: 600; /* más presencia sin “gritar” */
  letter-spacing: 0.2px;

  /* Solo color + realce sutil, SIN fondo ni borde */
  color: #ff6b6b; /* puedes probar #ff5b7e si te gusta más vivo */
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.45),
    /* contorno oscuro para contraste en glass */ 0 0 8px
      rgba(255, 91, 126, 0.35); /* ligero glow rosado */
  /* Opcional (soporte parcial): contorno ultra fino para más legibilidad */
  -webkit-text-stroke: 0.3px rgba(0, 0, 0, 0.25);
  /* Inicia oculto y aparece mediante las clases .is-invalid / .was-validated */
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* === Feedback específico para CHECKBOX/RADIO === */
.terminos .invalid-feedback,
.invalid-feedback.error,
.invalid-feedback.show {
  margin-top: 0.4rem;
  margin-left: 0; /* centrado */
  text-align: center; /* centra debajo del bloque */
  font-size: 0.9rem;
  font-weight: 600;

  color: #ff4d6d; /* rojo más vivo */
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.75), 0 0 6px rgba(255, 77, 109, 0.45);

  opacity: 1; /* aquí siempre visible cuando hay error */
  transform: none;
}

.form .input.is-invalid ~ .invalid-feedback,
.form select.is-invalid ~ .invalid-feedback,
.was-validated .form-control:invalid ~ .invalid-feedback,
.was-validated select:invalid ~ .invalid-feedback {
  opacity: 1;
  transform: translateY(0);
}

/* Accesibilidad: respetar usuarios que prefieren menos animación */
@media (prefers-reduced-motion: reduce) {
  .invalid-feedback {
    transition: none;
  }
}

/* === Mensajes de éxito === */
.valid-feedback {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #00ffa6; /* verde aqua para encajar con tu glass theme */
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4), 0 0 6px rgba(0, 255, 166, 0.35);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.form .input.is-valid ~ .valid-feedback,
.form select.is-valid ~ .valid-feedback {
  opacity: 1;
  transform: translateY(0);
}

/* Borde con glow cuando es válido */
.is-valid {
  border-color: #00ffa6 !important;
  box-shadow: 0 0 0 2px rgba(0, 255, 166, 0.2), 0 0 10px rgba(0, 255, 166, 0.35);
}

/* ================================ */

input:-internal-autofill-selected,
input:-webkit-autofill,
input:-internal-autofill-previewed,
input:-moz-autofill {
  background-color: #333 !important;
  color: #fff !important;
  -webkit-box-shadow: 0 0 0 30px #333 inset !important;
  box-shadow: 0 0 0 30px #333 inset !important;
  -webkit-text-fill-color: #fff !important;
}
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #333 inset !important;
}
input:-webkit-autofill {
  -webkit-text-fill-color: white !important;
}

.form label .input + span {
  color: rgba(255, 255, 255, 0.5);
  position: absolute;
  left: 10px;
  top: 0px;
  font-size: 1.5em;
  cursor: text;
  transition: 0.3s ease;
}

select {
  background-color: #333;
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.5em;
  padding: 10px;
  outline: 0;
  border: 1px solid rgba(105, 105, 105, 0.397);
  border-radius: 10px;
  margin-bottom: 0.5rem !important;
}

/* Estilo de foco accesible para selects (navegación con Tab) */
.form select:focus,
.form select:focus-visible {
  outline: none;
  border-color: #00bfff;
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.14),
    0 0 10px rgba(0, 191, 255, 0.18);
  -webkit-box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.14),
    0 0 10px rgba(0, 191, 255, 0.18);
  color: #fff;
}

.form label .input:placeholder-shown + span {
  top: 12.5px;
  font-size: 1.5em;
}

.form label .input:focus + span,
.form label .input:focus + em + span {
  color: #ffffff; /* mayor contraste sobre fondo oscuro */
  top: 0px;
  font-size: 1em;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  z-index: 2; /* que esté por encima del input */
  -webkit-text-stroke: 0.2px rgba(0, 0, 0, 0.25);
}

.input {
  font-size: medium;
}

.submit {
  border: none;
  outline: none;
  padding: 10px;
  border-radius: 10px;
  color: #fff;
  font-size: 16px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  background-color: #00bfff;
}

.submit:hover {
  background-color: #00bfff96;
}

/* Mejora de accesibilidad: foco visible para el botón Enviar */
.submit,
#enviar {
  cursor: pointer;
}
.submit:focus,
.submit:focus-visible,
#enviar:focus,
#enviar:focus-visible {
  outline: none; /* mantenemos outline deshabilitado pero mostramos halo */
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45),
    0 0 20px rgba(255, 255, 255, 0.25), 0 6px 18px rgba(0, 191, 255, 0.2);
  -webkit-box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.45),
    0 0 20px rgba(255, 255, 255, 0.25), 0 6px 18px rgba(0, 191, 255, 0.2);
  transform: translateY(-1px);
}
.submit:active,
#enviar:active {
  transform: translateY(0);
}

@keyframes pulse {
  from {
    transform: scale(0.9);
    opacity: 1;
  }
  to {
    transform: scale(1.8);
    opacity: 0;
  }
}

#enviar {
  padding: 1rem;
}

.terminos {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.terminos p {
  margin: 0;
  text-align: center;
}

/* Mejorar foco visual para checkboxes: destacar toda la línea (label) cuando el input tiene foco */
.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.form-check-label {
  display: inline-block;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background-color 0.12s ease, box-shadow 0.12s ease,
    color 0.12s ease;
  color: rgba(255, 255, 255, 0.95);
}
.form-check-input:focus + .form-check-label,
.form-check-input:focus-visible + .form-check-label {
  background-color: rgba(0, 191, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.12), 0 0 8px rgba(0, 191, 255, 0.12);
  -webkit-box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.12),
    0 0 8px rgba(0, 191, 255, 0.12);
  color: #ffffff;
}

/* También aplicar cuando cualquier hijo dentro del bloque .form-check tenga foco
   (por ejemplo el enlace dentro de la etiqueta), usando focus-within */
.form-check:focus-within .form-check-label {
  background-color: rgba(0, 191, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.12), 0 0 8px rgba(0, 191, 255, 0.12);
  -webkit-box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.12),
    0 0 8px rgba(0, 191, 255, 0.12);
  color: #ffffff;
}

/* Asegurar que los enlaces dentro del label también cambien de color cuando el bloque esté enfocado */
.form-check:focus-within .form-check-label a,
.form-check-input:focus + .form-check-label a {
  color: #eaf9ff; /* tono claro para enlaces en foco */
}

/* Soporte cuando el label está antes del input (por si cambia el orden) */
.form-check-label:focus,
.form-check-label:focus-visible {
  outline: none;
  background-color: rgba(0, 191, 255, 0.12);
  color: #ffffff;
}

/* checkbox settings */
.ui-checkbox {
  --primary-color: #1677ff;
  --secondary-color: #fff;
  --primary-hover-color: #4096ff;
  --checkbox-diameter: 20px;
  --checkbox-border-radius: 5px;
  --checkbox-border-color: #d9d9d9;
  --checkbox-border-width: 1px;
  --checkbox-border-style: solid;
  --checkmark-size: 1.2;
}

.ui-checkbox,
.ui-checkbox *,
.ui-checkbox *::before,
.ui-checkbox *::after {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

.ui-checkbox {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: var(--checkbox-diameter);
  height: var(--checkbox-diameter);
  border-radius: var(--checkbox-border-radius);
  background: var(--secondary-color);
  border: var(--checkbox-border-width) var(--checkbox-border-style)
    var(--checkbox-border-color);
  transition: all 0.3s;
  cursor: pointer;
  position: relative;
}

.ui-checkbox::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  box-shadow: 0 0 0 calc(var(--checkbox-diameter) / 2.5) var(--primary-color);
  border-radius: inherit;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.12, 0.4, 0.29, 1.46);
}

.ui-checkbox::before {
  top: 40%;
  left: 50%;
  content: "";
  position: absolute;
  width: 4px;
  height: 7px;
  border-right: 2px solid var(--secondary-color);
  border-bottom: 2px solid var(--secondary-color);
  transform: translate(-50%, -50%) rotate(45deg) scale(0);
  opacity: 0;
  transition: all 0.1s cubic-bezier(0.71, -0.46, 0.88, 0.6), opacity 0.1s;
}

.ui-checkbox:hover {
  border-color: var(--primary-color);
}

.ui-checkbox:checked {
  background: var(--primary-color);
  border-color: transparent;
}

.ui-checkbox:checked::before {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(45deg) scale(var(--checkmark-size));
  transition: all 0.2s cubic-bezier(0.12, 0.4, 0.29, 1.46) 0.1s;
}

.ui-checkbox:active:not(:checked)::after {
  transition: none;
  box-shadow: none;
  opacity: 1;
}

#message {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Glass para el backdrop del modal */
.modal-backdrop.show {
  background: rgba(34, 40, 49, 0.25) !important;
  backdrop-filter: blur(3px);
}
