/**
 * Frontend Styles for AF Marketo Forms Core
 *
 * @package AFMarketoFormsCore
 * @since 1.0.0
 */
/* Base Form Wrapper */
.af-marketo-form {
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
}

/* Form Error State */
.af-marketo-form-error {
  padding: 15px;
  margin: 15px 0;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  color: #721c24;
}

/* Loading State */
.af-marketo-form--loading {
  opacity: 0.6;
  pointer-events: none;
}

.af-marketo-form--loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: #667eea;
  border-radius: 50%;
  animation: af-form-spin 0.8s linear infinite;
  z-index: 10;
}

@keyframes af-form-spin {
  to {
    transform: rotate(360deg);
  }
}
/* Inline Form Type */
.af-marketo-form--inline {
  display: block;
}

/* Popup/Modal Overlay */
.af-marketo-form--popup,
.af-marketo-form--modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 99999999;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.af-marketo-form--popup.af-marketo-form--active,
.af-marketo-form--modal.af-marketo-form--active {
  display: flex;
}

.af-marketo-form--popup.af-marketo-form--visible,
.af-marketo-form--modal.af-marketo-form--visible {
  opacity: 1;
  transform: scale(1);
}

.af-marketo-form--popup.af-marketo-form--closing,
.af-marketo-form--modal.af-marketo-form--closing {
  pointer-events: none;
}

/* Request-demo overlay: keep visible but non-blocking (visual dim only) */
.af-marketo-form[data-form-id=request_demo] .af-marketo-form__overlay,
.af-marketo-form--popup[data-form-id=request_demo] .af-marketo-form__overlay,
.af-marketo-form--modal[data-form-id=request_demo] .af-marketo-form__overlay,
.af-marketo-form--fullscreen[data-form-id=request_demo] .af-marketo-form__overlay {
  /* Let request-demo form control its own background dimming and interactions */
  pointer-events: none;
}

.af-marketo-form__container {
  position: relative;
  z-index: 2;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.af-marketo-form--popup .af-marketo-form__container,
.af-marketo-form--modal .af-marketo-form__container {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.af-marketo-form--popup.af-marketo-form--visible .af-marketo-form__container,
.af-marketo-form--modal.af-marketo-form--visible .af-marketo-form__container {
  opacity: 1;
  transform: translateY(0);
}

.af-marketo-form--popup.af-marketo-form--closing .af-marketo-form__container,
.af-marketo-form--modal.af-marketo-form--closing .af-marketo-form__container {
  pointer-events: none;
}

.af-marketo-form--fullscreen .af-marketo-form__container {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.af-marketo-form--fullscreen.af-marketo-form--visible .af-marketo-form__container {
  opacity: 1;
}

.af-marketo-form--fullscreen.af-marketo-form--closing .af-marketo-form__container {
  pointer-events: none;
}

/* Fullscreen Form Type */
.af-marketo-form--fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2147483646;
  display: none;
  overflow-y: auto;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.af-marketo-form--fullscreen.af-marketo-form--active {
  display: block;
}

.af-marketo-form--fullscreen.af-marketo-form--visible {
  opacity: 1;
}

.af-marketo-form--fullscreen.af-marketo-form--closing {
  pointer-events: none;
}

.af-marketo-form--fullscreen .af-marketo-form__container {
  min-height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Close Button */
.af-marketo-form__close {
  position: absolute;
  top: 15px;
  right: 15px;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
  color: #333;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.af-marketo-form__close:hover {
  background: #fff;
  transform: rotate(90deg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.af-marketo-form__close:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Animations */
@keyframes af-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes af-scale-in {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes af-slide-up {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
/* Responsive Design */
@media (max-width: 768px) {
  .af-marketo-form__container {
    max-width: 95%;
  }
  .af-marketo-form--fullscreen .af-marketo-form__container {
    padding: 20px 15px;
  }
}
/* Accessibility */
.af-marketo-form:focus-within {
  outline: 2px solid transparent;
}

.af-marketo-form *:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .af-marketo-form--popup,
  .af-marketo-form--modal,
  .af-marketo-form--fullscreen {
    display: none !important;
  }
}
/* RTL Support */
[dir=rtl] .af-marketo-form__close {
  right: auto;
  left: 15px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .af-marketo-form__close {
    border: 2px solid currentColor;
  }
}
/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .af-marketo-form--popup,
  .af-marketo-form--modal,
  .af-marketo-form__container,
  .af-marketo-form__close {
    animation: none;
    transition: none;
  }
}
/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
  .af-marketo-form {
    color: #f0f0f0;
  }
  .af-marketo-form__close {
    color: #fff;
    background: rgba(0, 0, 0, 0.9);
  }
}
