/* ============================================================
   Lead Capture Modal & CF7 Form
   ============================================================ */

/* Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-overlay.active { display: flex; }

/* Modal box */
.modal-content {
  background: hsl(var(--card));
  border-radius: calc(var(--radius) + 12px);
  width: 100%;
  max-width: 680px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 32px 64px rgba(0,0,0,0.2);
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--border)) transparent;
}
.modal-content::-webkit-scrollbar { width: 4px; }
.modal-content::-webkit-scrollbar-thumb { background: hsl(var(--border)); border-radius: 4px; }

/* Gradient top bar */
.modal-content::before {
  content: '';
  display: block;
  height: 4px;
  background: var(--gradient-hero);
  border-radius: calc(var(--radius) + 12px) calc(var(--radius) + 12px) 0 0;
}

/* Close button */
.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: hsl(var(--secondary));
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: hsl(var(--muted-foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
  line-height: 1;
}
.modal-close:hover {
  background: hsl(var(--primary));
  color: #fff;
}

/* Modal header */
.modal-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 2rem 2rem 0;
}
.modal-header__icon {
  width: 3rem;
  height: 3rem;
  border-radius: calc(var(--radius));
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.modal-header h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  color: hsl(var(--foreground));
  margin: 0 0 0.25rem;
  line-height: 1.2;
}
.modal-header p {
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
  line-height: 1.5;
}

/* Trust badges row */
.modal-trust {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 1rem 2rem 0;
}
.modal-trust__item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.78rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}
.modal-trust__item svg {
  color: hsl(var(--primary));
  flex-shrink: 0;
}

/* Form wrapper */
.modal-content .wpcf7 {
  padding: 1.5rem 2rem 2rem;
}

/* CF7 grid layout */
.cf7-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.cf7-field--full {
  grid-column: 1 / -1;
}

/* Field wrapper */
.cf7-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.cf7-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  letter-spacing: 0.01em;
}

/* All inputs, selects, textareas */
.modal-content .wpcf7 input[type="text"],
.modal-content .wpcf7 input[type="email"],
.modal-content .wpcf7 select,
.modal-content .wpcf7 textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid hsl(var(--border));
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.modal-content .wpcf7 input[type="text"]:focus,
.modal-content .wpcf7 input[type="email"]:focus,
.modal-content .wpcf7 select:focus,
.modal-content .wpcf7 textarea:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.12);
}
.modal-content .wpcf7 input::placeholder,
.modal-content .wpcf7 textarea::placeholder {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

/* Select arrow */
.modal-content .wpcf7 select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Textarea */
.modal-content .wpcf7 textarea {
  min-height: 90px;
  resize: vertical;
}

/* Submit button */
.modal-content .wpcf7 input[type="submit"],
.modal-content .wpcf7 .wpcf7-submit {
  width: 100%;
  padding: 1rem;
  background: var(--gradient-hero);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
  margin-top: 0.5rem;
  letter-spacing: 0.01em;
}
.modal-content .wpcf7 input[type="submit"]:hover,
.modal-content .wpcf7 .wpcf7-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Validation errors */
.modal-content .wpcf7-not-valid-tip {
  font-size: 0.75rem;
  color: hsl(var(--destructive));
  margin-top: 0.25rem;
  display: block;
}
.modal-content .wpcf7-not-valid {
  border-color: hsl(var(--destructive)) !important;
}

/* Success / sending messages */
.modal-content .wpcf7-response-output {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: none !important;
}
.modal-content .wpcf7-mail-sent-ok {
  background: hsl(142 76% 36% / 0.1);
  color: hsl(142 76% 36%);
}
.modal-content .wpcf7-mail-sent-ng,
.modal-content .wpcf7-spam-blocked {
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

/* Spinner */
.modal-content .wpcf7-spinner {
  display: none;
}

/* Responsive */
@media (max-width: 640px) {
  .modal-content { max-width: 100%; border-radius: calc(var(--radius) + 4px); }
  .modal-header { padding: 1.5rem 1.5rem 0; }
  .modal-trust  { padding: 0.75rem 1.5rem 0; }
  .modal-content .wpcf7 { padding: 1.25rem 1.5rem 1.5rem; }
  .cf7-grid { grid-template-columns: 1fr; }
  .cf7-field--full { grid-column: 1; }
}

/* ── Required field validation messages — red ── */

/* CF7 inline error tip */
.wpcf7-not-valid-tip {
  color: #dc2626 !important;
  font-size: 0.78rem;
  font-weight: 500;
  margin-top: 0.25rem;
  display: block;
}

/* Red border on invalid fields */
.wpcf7-not-valid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1) !important;
}

/* CF7 response output error */
.wpcf7-response-output {
  color: #dc2626 !important;
  border-color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.05) !important;
  border-radius: var(--radius) !important;
  padding: 0.75rem 1rem !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
}

/* Browser native "Please fill out this field" tooltip — force red via outline trick */
input:invalid,
select:invalid,
textarea:invalid {
  box-shadow: none;
}

/* ============================================================
   Thank You Modal
   ============================================================ */

.thankyou-modal {
  text-align: center;
  padding: 2.5rem 2rem 2rem;
}

/* Animated checkmark */
.thankyou-check {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
}
.thankyou-check__svg {
  width: 80px;
  height: 80px;
}
.thankyou-check__circle {
  stroke: hsl(var(--primary));
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: thankyou-circle 0.6s cubic-bezier(0.65, 0, 0.45, 1) 0.2s forwards;
}
.thankyou-check__tick {
  stroke: hsl(var(--primary));
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: thankyou-tick 0.4s cubic-bezier(0.65, 0, 0.45, 1) 0.7s forwards;
}
@keyframes thankyou-circle {
  to { stroke-dashoffset: 0; }
}
@keyframes thankyou-tick {
  to { stroke-dashoffset: 0; }
}

/* Heading */
.thankyou-modal__h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.75rem;
  font-weight: 800;
  color: hsl(var(--foreground));
  margin: 0 0 0.375rem;
  letter-spacing: -0.025em;
}
.thankyou-modal__sub {
  font-size: 0.9375rem;
  color: hsl(var(--muted-foreground));
  margin: 0;
}

/* Divider */
.thankyou-modal__divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 1.5rem 0;
}

/* Body text */
.thankyou-modal__body {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-bottom: 1.5rem;
}
.thankyou-modal__body p {
  font-size: 0.9rem;
  color: hsl(var(--foreground));
  line-height: 1.7;
  margin: 0;
}

/* What happens next */
.thankyou-modal__next {
  background: hsl(var(--secondary) / 0.5);
  border: 1px solid hsl(var(--border));
  border-radius: calc(var(--radius) + 4px);
  padding: 1.25rem 1.5rem;
  text-align: left;
  margin-bottom: 1.5rem;
}
.thankyou-modal__next-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: hsl(var(--muted-foreground));
  margin: 0 0 1rem;
}
.thankyou-modal__steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.thankyou-modal__steps li {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}
.thankyou-modal__step-icon {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  background: hsl(var(--primary-muted));
  color: hsl(var(--primary));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.thankyou-modal__steps li div:last-child {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.thankyou-modal__steps li strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}
.thankyou-modal__steps li span {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

/* CTA button */
.thankyou-modal__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: var(--gradient-hero);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.2s;
}
.thankyou-modal__btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

/* ── Submit button loading spinner ── */
.wpcf7-submit {
  position: relative;
  transition: all 0.3s ease;
}

.wpcf7-submit.is-submitting {
  pointer-events: none;
  opacity: 0.85;
  color: transparent !important;
}

.wpcf7-submit.is-submitting::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: cf7-spin 0.7s linear infinite;
}

@keyframes cf7-spin {
  to { transform: rotate(360deg); }
}

/* ── Submit spinner fix ── */
.modal-content .wpcf7-submit,
.modal-content .wpcf7 input[type="submit"] {
  position: relative !important;
  overflow: hidden;
  transition: color 0.2s ease, background 0.2s ease;
}

.modal-content .wpcf7-submit.enso-loading,
.modal-content .wpcf7 input[type="submit"].enso-loading {
  color: transparent !important;
  pointer-events: none !important;
  cursor: not-allowed !important;
}

.modal-content .wpcf7-submit.enso-loading::after,
.modal-content .wpcf7 input[type="submit"].enso-loading::after {
  content: '' !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  width: 22px !important;
  height: 22px !important;
  margin-top: -11px !important;
  margin-left: -11px !important;
  border: 3px solid rgba(255, 255, 255, 0.35) !important;
  border-top-color: #ffffff !important;
  border-radius: 50% !important;
  animation: enso-btn-spin 0.65s linear infinite !important;
  display: block !important;
}

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

/* ── Force submit button active when modal reopens ── */
.modal-overlay.active .wpcf7-submit,
.modal-overlay.active input[type="submit"] {
  pointer-events: auto !important;
  cursor: pointer !important;
  opacity: 1 !important;
}

/* Hide CF7 sent/failed message inside modal */
.modal-overlay .wpcf7.sent .wpcf7-response-output,
.modal-overlay .wpcf7.failed .wpcf7-response-output {
  display: none !important;
}
