/* ==========================================================================
   Formulário de inscrição nativo (integração CRM Educacional)
   Usado em dois contextos:
   - .enroll-form--modal  -> dentro do modal [data-enroll-modal]
   - .enroll-form--inline -> embutido na sidebar das páginas de curso
   ========================================================================== */

.enroll-form {
  --enroll-field-border: var(--border-subtle, #e4e7ec);
  --enroll-accent: var(--brand-accent, #e4341c);
  --enroll-dark: var(--brand-dark, #19323c);
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin: 0;
  font-family: inherit;
  box-sizing: border-box;
}

.enroll-form *,
.enroll-form *::before,
.enroll-form *::after {
  box-sizing: border-box;
}

.enroll-form__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.enroll-form__label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--enroll-dark);
  line-height: 1.3;
}

.enroll-form__label .enroll-form__req {
  color: var(--enroll-accent);
  margin-left: 2px;
}

.enroll-form__control {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text-strong, #101828);
  background: #ffffff;
  border: 1px solid var(--enroll-field-border);
  border-radius: var(--radius-md, 12px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.enroll-form__control::placeholder {
  color: var(--text-muted, #667085);
  opacity: 1;
}

.enroll-form__control:focus {
  outline: none;
  border-color: var(--enroll-accent);
  box-shadow: 0 0 0 3px rgba(228, 52, 28, 0.15);
}

select.enroll-form__control {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2319323c' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

/* Campo de curso travado (vem da página/card; read-only, enviado ao CRM) */
.enroll-form__control--locked {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  font-weight: 600;
  color: var(--text-strong, #101828);
  background: #f2f4f7;
  border-style: dashed;
  cursor: default;
}

.enroll-form__control--locked::before {
  content: "🔒";
  font-size: 0.9em;
  line-height: 1;
}

/* Estado de erro de validação */
.enroll-form__control.is-invalid {
  border-color: #d92d20;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.enroll-form__error {
  font-size: 0.78rem;
  color: #d92d20;
  min-height: 0;
}

/* Consentimento LGPD */
.enroll-form__field--lgpd {
  gap: 4px;
}

.enroll-form__lgpd {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-muted, #667085);
  cursor: pointer;
}

.enroll-form__checkbox {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--enroll-accent);
  cursor: pointer;
}

/* Honeypot anti-bot — invisível para humanos */
.enroll-form__hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.enroll-form__submit {
  margin-top: 4px;
  width: 100%;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #ffffff;
  background: var(--enroll-accent);
  border: none;
  border-radius: var(--radius-md, 12px);
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}

.enroll-form__submit:hover {
  background: #c92d18;
}

.enroll-form__submit:active {
  transform: translateY(1px);
}

.enroll-form__submit:disabled {
  opacity: 0.7;
  cursor: progress;
}

/* Mensagem de feedback (status / erro geral) */
.enroll-form__feedback {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
}

.enroll-form__feedback:empty {
  display: none;
}

.enroll-form__feedback.is-error {
  color: #d92d20;
}

.enroll-form__feedback.is-success {
  color: #067647;
}

/* Spinner no botão durante envio */
.enroll-form__spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: 8px;
  vertical-align: -0.15em;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: enroll-spin 0.7s linear infinite;
}

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

/* --------------------------------------------------------------------------
   Variante MODAL
   -------------------------------------------------------------------------- */
.enroll-modal .enroll-form--modal {
  max-width: 460px;
  margin: 0 auto;
  padding: 4px;
}

.enroll-form--modal .enroll-form__title {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--enroll-dark);
  text-align: center;
}

.enroll-form--modal .enroll-form__subtitle {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--text-muted, #667085);
  text-align: center;
}

/* O dialog do modal precisa permitir rolagem quando há form nativo */
.enroll-modal__dialog:has(.enroll-form--modal) {
  width: min(480px, 92vw);
  height: auto;
  max-height: 92vh;
  overflow-y: auto;
  background: #ffffff;
  border-radius: var(--radius-lg, 18px);
  padding: 28px 26px;
}

/* --------------------------------------------------------------------------
   Variante INLINE (sidebar das páginas de curso)
   -------------------------------------------------------------------------- */
.enroll-form--inline {
  background: var(--surface-card, #ffffff);
  border: 1px solid var(--border-subtle, #e4e7ec);
  border-radius: var(--radius-lg, 18px);
  padding: 22px 20px;
  box-shadow: var(--shadow-card, 0 18px 45px rgba(16, 24, 40, 0.08));
}

.enroll-form--inline .enroll-form__title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--enroll-dark);
  text-align: center;
}

.enroll-form--inline .enroll-form__subtitle {
  margin: 0 0 10px;
  font-size: 0.85rem;
  color: var(--text-muted, #667085);
  text-align: center;
}

@media (max-width: 480px) {
  .enroll-modal__dialog:has(.enroll-form--modal) {
    padding: 22px 18px;
  }
  .enroll-form__control {
    font-size: 16px; /* evita zoom automático no iOS */
  }
}

/* --------------------------------------------------------------------------
   Tema PÓS-GRADUAÇÃO — usa o azul-petróleo da marca (--brand-dark) como
   cor de destaque, no lugar do vermelho da graduação.
   -------------------------------------------------------------------------- */
.enroll-form--pos {
  --enroll-accent: var(--brand-dark, #19323c);
}

.enroll-form--pos .enroll-form__control:focus {
  box-shadow: 0 0 0 3px rgba(25, 50, 60, 0.18);
}

.enroll-form--pos .enroll-form__submit:hover {
  background: #0f2129;
}
