/* Professional hCaptcha Integration Styles */

/* Main hCaptcha container styling */
.hcaptcha-container {
  margin: 1.5rem 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 78px !important;
  padding: 0.75rem !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.02) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  transition: all 0.3s ease !important;
  box-sizing: border-box !important;
}

/* Invisible variant used by programmatic hCaptcha execution */
.hcaptcha-container.hcaptcha-invisible,
.hcaptcha-container[data-invisible="true"] {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  min-height: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* Dark footer background compatibility */
.footer .hcaptcha-container,
.enterprise-footer .hcaptcha-container {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Light background compatibility */
.form-container .hcaptcha-container,
.progressive-form .hcaptcha-container,
.lead-capture .hcaptcha-container {
  background: rgba(0, 0, 0, 0.02) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

/* hCaptcha widget iframe styling */
.hcaptcha-container iframe {
  border-radius: 6px !important;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1) !important;
  transition: all 0.3s ease !important;
}

/* Hover effects for better UX */
.hcaptcha-container:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(0, 122, 255, 0.3) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
}

.footer .hcaptcha-container:hover,
.enterprise-footer .hcaptcha-container:hover {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(0, 122, 255, 0.4) !important;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
  .hcaptcha-container {
    margin: 1rem 0 !important;
    padding: 0.5rem !important;
    min-height: 78px !important;
  }
  
  .hcaptcha-container iframe {
    max-width: 100% !important;
    transform: scale(0.85) !important;
    transform-origin: center !important;
  }
}

@media (max-width: 480px) {
  .hcaptcha-container iframe {
    transform: scale(0.75) !important;
  }
}

/* Newsletter form specific styling */
.newsletter-form .hcaptcha-container {
  margin: 1rem 0 !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  min-height: 65px !important;
  padding: 0.5rem !important;
}

/* Free audit form specific styling */
.form-container .hcaptcha-container {
  margin: 1.5rem 0 !important;
  background: rgba(255, 255, 255, 0.8) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
}

/* Progressive form (index.html) specific styling */
.progressive-form .hcaptcha-container {
  margin: 1.5rem 0 !important;
  background: rgba(255, 255, 255, 0.9) !important;
  border: 2px solid rgba(0, 122, 255, 0.1) !important;
  box-shadow: 0 4px 20px rgba(0, 122, 255, 0.08) !important;
}

.progressive-form .hcaptcha-container:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(0, 122, 255, 0.2) !important;
  box-shadow: 0 6px 25px rgba(0, 122, 255, 0.15) !important;
}

/* Loading state for hCaptcha container */
.hcaptcha-container.loading {
  opacity: 0.7 !important;
  cursor: wait !important;
}

.hcaptcha-container.loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid rgba(0, 122, 255, 0.3);
  border-top: 2px solid #007aff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Success/Error message animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Form message styling improvements */
.form-success, .form-error {
  animation: slideIn 0.3s ease !important;
  margin-top: 1rem !important;
  padding: 1rem 1.5rem !important;
  border-radius: 8px !important;
  text-align: center !important;
  font-weight: 500 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: blur(10px) !important;
}

.form-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%) !important;
  color: white !important;
  border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.form-error {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%) !important;
  color: white !important;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

/* Ensure forms maintain their professional appearance */
.newsletter-form,
.form-container form,
.progressive-form {
  position: relative !important;
}

/* Footer optimization for hCaptcha integration */
.enterprise-footer .newsletter-form {
  min-height: auto !important;
}

.enterprise-footer .hcaptcha-container {
  margin: 0.75rem 0 !important;
  min-height: 65px !important;
}

/* Hide hCaptcha branding conflicts */
.hcaptcha-container .h-captcha {
  font-family: inherit !important;
}

/* Prevent layout shifts */
.hcaptcha-container * {
  box-sizing: border-box !important;
}

/* Professional focus states */
.hcaptcha-container iframe:focus {
  outline: 2px solid rgba(0, 122, 255, 0.5) !important;
  outline-offset: 2px !important;
}

/* Accessibility improvements */
.hcaptcha-container[aria-busy="true"] {
  opacity: 0.8 !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .hcaptcha-container {
    border: 2px solid currentColor !important;
    background: rgba(255, 255, 255, 0.9) !important;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .hcaptcha-container,
  .hcaptcha-container:hover,
  .form-success,
  .form-error {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
}