/**
 * Estilos personalizados para Cloudflare Turnstile
 */

/* Contenedor del widget de Turnstile */
.turnstile-container {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0 1rem 0;
  padding: 0.5rem 0;
}

/* Widget de Turnstile */
.cf-turnstile {
  display: flex;
  justify-content: center;
  transform: scale(1);
  transform-origin: center;
}

/* Para pantallas pequeñas, escalar el widget */
@media (max-width: 480px) {
  .cf-turnstile {
    transform: scale(0.9);
  }
}

@media (max-width: 360px) {
  .cf-turnstile {
    transform: scale(0.77);
  }
}

/* Mensaje de error para Turnstile */
.turnstile-error {
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: none;
  padding: 0.5rem;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 0.25rem;
  text-align: center;
}

.turnstile-error.show {
  display: block;
  animation: slideDown 0.3s ease-out;
}

/* Animación para mostrar el error */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Label para el widget (si es necesario) */
.turnstile-label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  color: #333;
}

/* Wrapper del formulario con Turnstile */
.form-with-turnstile {
  margin-bottom: 1rem;
}

/* Para formularios compactos */
.form-compact .turnstile-container {
  margin: 1rem 0 0.75rem 0;
}

/* Para formularios grandes */
.form-lg .turnstile-container {
  margin: 2rem 0 1.5rem 0;
}

/* Estados de interacción */
.cf-turnstile:hover {
  /* Opcional: agregar efecto hover si lo deseas */
}

.cf-turnstile:focus-within {
  /* Opcional: agregar efecto focus si lo deseas */
  outline: 2px solid #80bdff;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Compatibilidad con temas oscuros */
@media (prefers-color-scheme: dark) {
  .turnstile-label {
    color: #e9ecef;
  }

  .turnstile-error {
    color: #f8d7da;
    background-color: rgba(248, 215, 218, 0.1);
    border-color: rgba(245, 198, 203, 0.3);
  }
}

/* Estados de carga */
.turnstile-loading {
  opacity: 0.6;
  pointer-events: none;
}

.turnstile-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-radius: 50%;
  border-top: 2px solid #3498db;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Accesibilidad */
.cf-turnstile iframe {
  max-width: 100%;
  height: auto;
}

/* Responsive para diferentes tamaños de pantalla */
@media (min-width: 1200px) {
  .cf-turnstile {
    transform: scale(1);
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .cf-turnstile {
    transform: scale(1);
  }
}

/* Print styles */
@media print {
  .cf-turnstile,
  .turnstile-container,
  .turnstile-error {
    display: none;
  }
}
