/* =============================================
   FOUNDRY FORM MODALS
   ============================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15, 29, 58, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white, #FFFFFF);
  max-width: 520px;
  width: 100%;
  border-radius: 4px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal__header {
  padding: 28px 32px 0;
}

.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: #5F5D5A;
  font-size: 20px;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.modal__close:hover {
  background: #F5F3F0;
  color: #111;
}

.modal__title {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--navy, #0F1D3A);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.modal__subtitle {
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 14px;
  color: #5F5D5A;
  line-height: 1.5;
  margin: 0 0 4px;
}

.modal__body {
  padding: 24px 32px 32px;
}

/* Form Fields */
.form-group {
  margin-bottom: 18px;
}

.form-group--half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-label {
  display: block;
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5F5D5A;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 14px;
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 15px;
  color: #111;
  background: var(--gray-bg, #F5F3F0);
  border: 1.5px solid transparent;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%235F5D5A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--orange, #D96C3A);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(217, 108, 58, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: #B5302A;
  background: #fef5f5;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-error-text {
  font-size: 12px;
  color: #B5302A;
  margin-top: 4px;
  display: none;
}

.form-input.error + .form-error-text,
.form-select.error + .form-error-text,
.form-textarea.error + .form-error-text {
  display: block;
}

/* Submit Button */
.form-submit {
  width: 100%;
  padding: 13px 24px;
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--navy, #0F1D3A);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
}

.form-submit:hover {
  background: #1A2F55;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 29, 58, 0.18);
}

.form-submit:active {
  transform: translateY(0);
}

.form-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Success State */
.modal__success {
  text-align: center;
  padding: 40px 32px;
  display: none;
}

.modal__success.active {
  display: block;
}

.modal__success-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  background: var(--navy, #0F1D3A);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px;
}

.modal__success-title {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--navy, #0F1D3A);
  margin: 0 0 8px;
}

.modal__success-text {
  font-size: 14px;
  color: #5F5D5A;
  line-height: 1.6;
  margin: 0 0 20px;
}

.modal__success-link {
  display: inline-block;
  padding: 11px 28px;
  font-family: var(--font, 'Inter', sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: var(--orange, #D96C3A);
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}

.modal__success-link:hover {
  background: #c45c30;
}

.modal__success-close {
  display: block;
  margin: 16px auto 0;
  background: none;
  border: none;
  font-size: 13px;
  color: #979490;
  cursor: pointer;
  font-family: var(--font, 'Inter', sans-serif);
  transition: color 0.15s;
}

.modal__success-close:hover {
  color: #5F5D5A;
}

/* Loading spinner inside button */
.form-submit--loading {
  position: relative;
  color: transparent;
}

.form-submit--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin: auto;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: form-spin 0.6s linear infinite;
}

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

/* Form body hide on success */
.modal__body--hidden {
  display: none;
}

/* Responsive */
@media (max-width: 580px) {
  .modal-overlay {
    padding: 12px;
    align-items: flex-end;
  }

  .modal {
    border-radius: 4px 4px 0 0;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal__header {
    padding: 24px 20px 0;
  }

  .modal__body {
    padding: 20px;
  }

  .modal__title {
    font-size: 20px;
  }

  .form-group--half {
    grid-template-columns: 1fr;
  }

  .modal__success {
    padding: 32px 20px;
  }
}
