/* ==========================================================================
   Gated PDF Download – Modal & Form Styles
   Matches ArcMosaico theme design system (Inter, purple, rounded, etc.)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Body Scroll Lock
   -------------------------------------------------------------------------- */

body.gated-download-open {
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Overlay
   -------------------------------------------------------------------------- */

.gated-download-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(15, 16, 53, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.gated-download-overlay.is-active {
  display: flex;
}

/* --------------------------------------------------------------------------
   Modal Container
   -------------------------------------------------------------------------- */

.gated-download-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 24px;
  padding: 48px 40px 40px;
  box-shadow: 0 24px 80px rgba(15, 16, 53, 0.25), 0 0 0 1px rgba(91, 79, 235, 0.05);
  animation: gated-modal-enter 0.25s ease-out;
}

@keyframes gated-modal-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --------------------------------------------------------------------------
   Close Button
   -------------------------------------------------------------------------- */

.gated-download-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-bg, #F7F8FC);
  border: none;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted, #555);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.gated-download-modal__close:hover,
.gated-download-modal__close:focus {
  background: var(--purple-tint, #F0EFFE);
  color: var(--navy, #0F1035);
  transform: scale(1.1);
  outline: none;
}

.gated-download-modal__close:focus-visible {
  box-shadow: 0 0 0 3px rgba(91, 79, 235, 0.3);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.gated-download-modal__icon {
  width: 48px;
  height: 48px;
  background: var(--purple-tint, #F0EFFE);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  font-size: 22px;
}

.gated-download-modal__heading {
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--navy, #0F1035);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.gated-download-modal__subheading {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-muted, #555);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* --------------------------------------------------------------------------
   Form
   -------------------------------------------------------------------------- */

.gated-download-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Form Group (label + input + error) */
.gated-download-form__field {
  display: flex;
  flex-direction: column;
}

.gated-download-form__field label {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy, #0F1035);
  margin-bottom: 6px;
}

.gated-download-form__input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border, #E8E8F0);
  border-radius: 12px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  color: var(--navy, #0F1035);
  background: var(--gray-bg, #F7F8FC);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}

.gated-download-form__input::placeholder {
  color: #999;
}

.gated-download-form__input:focus {
  border-color: var(--purple, #5B4FEB);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(91, 79, 235, 0.08);
}

.gated-download-form__input.is-invalid {
  border-color: #E53E3E;
  background: #FFF5F5;
}

.gated-download-form__input.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.08);
}

.gated-download-form__select {
  width: 100%;
  padding: 13px 16px;
  padding-right: 40px;
  border: 1.5px solid var(--border, #E8E8F0);
  border-radius: 12px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  color: var(--navy, #0F1035);
  background: var(--gray-bg, #F7F8FC);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' fill='none'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  outline: none;
}

.gated-download-form__select:focus {
  border-color: var(--purple, #5B4FEB);
  background-color: #fff;
  box-shadow: 0 0 0 4px rgba(91, 79, 235, 0.08);
}

.gated-download-form__select.is-invalid {
  border-color: #E53E3E;
  background-color: #FFF5F5;
}

.gated-download-form__select.is-invalid:focus {
  box-shadow: 0 0 0 4px rgba(229, 62, 62, 0.08);
}

/* --------------------------------------------------------------------------
   Inline Error Messages
   -------------------------------------------------------------------------- */

.gated-download-form__error {
  display: none;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #E53E3E;
  margin-top: 6px;
  padding-left: 2px;
  line-height: 1.4;
}

.gated-download-form__error.is-visible {
  display: block;
}

/* --------------------------------------------------------------------------
   Submit Button — matches .btn-primary / .btn style from theme
   -------------------------------------------------------------------------- */

.gated-download-form__submit {
  width: 100%;
  padding: 14px 28px;
  background: var(--purple, #5B4FEB);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: -0.2px;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 6px;
  position: relative;
}

.gated-download-form__submit:hover {
  background: var(--purple-dark, #4A3FD4);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(91, 79, 235, 0.35);
}

.gated-download-form__submit:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(91, 79, 235, 0.3);
}

/* Loading state */
.gated-download-form__submit.is-loading {
  opacity: 0.75;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
  box-shadow: none;
}

.gated-download-form__submit.is-loading::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: gated-download-spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes gated-download-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------------------------------------------------------
   General Form-Level Error
   -------------------------------------------------------------------------- */

.gated-download-form__message--error {
  display: none;
  padding: 12px 16px;
  background: #FFF5F5;
  border: 1.5px solid #FED7D7;
  border-radius: 12px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: #C53030;
  line-height: 1.5;
}

.gated-download-form__message--error.is-visible {
  display: block;
}

/* --------------------------------------------------------------------------
   Success Message
   -------------------------------------------------------------------------- */

.gated-download-modal__success {
  text-align: center;
  padding: 20px 0;
}

.gated-download-modal__success-icon {
  width: 56px;
  height: 56px;
  background: var(--teal-tint, #EDFCF9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
}

.gated-download-modal__success p {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy, #0F1035);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Fallback Link
   -------------------------------------------------------------------------- */

.gated-download-modal__fallback {
  text-align: center;
  padding: 16px 0;
}

.gated-download-modal__fallback p {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-muted, #555);
  margin-bottom: 8px;
}

.gated-download-fallback-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--purple, #5B4FEB);
  text-decoration: none;
  padding: 10px 20px;
  background: var(--purple-tint, #F0EFFE);
  border-radius: 100px;
  transition: background 0.2s, transform 0.2s;
}

.gated-download-fallback-link:hover {
  background: #E4E0FD;
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Privacy Note
   -------------------------------------------------------------------------- */

.gated-download-form__privacy {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #999;
  text-align: center;
  line-height: 1.5;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Two-Column Row in Download Form
   -------------------------------------------------------------------------- */

.gated-download-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 599px) {
  .gated-download-form__row {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Required Indicator
   -------------------------------------------------------------------------- */

.required-indicator {
  color: #E53E3E;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Email Confirmation Section
   -------------------------------------------------------------------------- */

.gated-download-modal__confirmation {
  text-align: center;
  padding: 32px 0 16px;
}

.gated-download-modal__confirmation-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, #F0EFFE 0%, #E4E0FD 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  font-size: 32px;
  box-shadow: 0 8px 24px rgba(91, 79, 235, 0.12);
}

.gated-download-modal__confirmation .gated-download-modal__heading {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy, #0F1035);
  margin-bottom: 16px;
}

.gated-download-modal__confirmation-text {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--navy, #0F1035);
  line-height: 1.5;
  margin-bottom: 8px;
}

.gated-download-modal__confirmation-text span {
  color: var(--purple, #5B4FEB);
}

.gated-download-modal__confirmation-secondary {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-muted, #555);
  line-height: 1.6;
  margin-bottom: 28px;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* --------------------------------------------------------------------------
   Close Button (Success State)
   -------------------------------------------------------------------------- */

.gated-download-modal__close-btn {
  display: inline-block;
  margin-top: 4px;
  padding: 14px 40px;
  background: var(--purple, #5B4FEB);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.2px;
}

.gated-download-modal__close-btn:hover {
  background: var(--purple-dark, #4A3FD4);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(91, 79, 235, 0.35);
}

.gated-download-modal__close-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px rgba(91, 79, 235, 0.3);
}

/* --------------------------------------------------------------------------
   Responsive – Mobile (< 600px)
   -------------------------------------------------------------------------- */

@media (max-width: 599px) {
  .gated-download-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .gated-download-modal {
    max-width: none;
    width: 100%;
    border-radius: 24px 24px 0 0;
    padding: 40px 24px 32px;
    max-height: 90vh;
    overflow-y: auto;
    animation: gated-modal-slide-up 0.3s ease-out;
  }

  @keyframes gated-modal-slide-up {
    from {
      opacity: 0;
      transform: translateY(100%);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .gated-download-modal__heading {
    font-size: 20px;
  }

  .gated-download-form__submit {
    padding: 16px 28px;
    font-size: 16px;
  }

  .gated-download-modal__close {
    top: 12px;
    right: 12px;
  }
}
