.form {
  width: 100%;
  background-image: url(../assets/form/img-bg.webp?v=12);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  padding-top: 4.1875rem;
  padding-bottom: 5.9375rem;
  padding-left: 2rem;
  padding-right: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.form-title {
  font-size: 3.125rem;
  font-weight: bold;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: center;
  color: var(--blue-750);
  margin-bottom: 0.5rem;
}

.form-text {
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: center;
  color: var(--blue-900);
}

.form-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
  width: 100%;
  max-width: 26rem;
  background: var(--white);
  border-radius: 1.25rem;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.form-form label {
  display: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
}

.form-form input,
.form-form select {
  width: 100%;
  height: 3rem;
  border: 2px solid #e5e7eb;
  border-radius: 0.75rem;
  padding-left: 1rem;
  padding-right: 2.5rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  text-align: left;
  color: var(--blue-900);
  background-color: #fafafa;
  transition: all 0.25s ease;
}

.form-form input::placeholder {
  color: #9ca3af;
  opacity: 1;
}

.form-form input:hover {
  border-color: #d1d5db;
  background-color: #fff;
}

/* Estado de Sucesso */
.form-form input.is-valid {
  border-color: #22c55e;
  background-color: #f0fdf4;
  padding-right: 2.5rem;
}

.form-group:has(input.is-valid)::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  width: 1.25rem;
  height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2322c55e'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* Estado de Erro */
.form-form input.is-invalid {
  border-color: #ef4444;
  background-color: #fef2f2;
  animation: shake 0.4s ease-in-out;
}

.form-group:has(input.is-invalid)::after {
  content: "";
  position: absolute;
  right: 0.75rem;
  top: 0.75rem;
  width: 1.25rem;
  height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ef4444'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-6px);
  }
  40% {
    transform: translateX(6px);
  }
  60% {
    transform: translateX(-4px);
  }
  80% {
    transform: translateX(4px);
  }
}

.form-form input:focus {
  outline: none;
  border-color: var(--blue-750);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(15, 34, 52, 0.1);
}

/* Mensagens de erro inline */
.error-message {
  font-size: 0.8125rem;
  color: #dc2626;
  min-height: 1.125rem;
  padding-left: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.2s ease;
}

.error-message:not(:empty) {
  opacity: 1;
  transform: translateY(0);
}

/* Caixa de erro global (backend) */
.error-box {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #991b1b;
  border: 1px solid #fca5a5;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  display: none;
  align-items: center;
  gap: 0.625rem;
  animation: slideDown 0.3s ease-out;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

.error-box.is-visible {
  display: flex;
}

.error-box-icon {
  flex-shrink: 0;
  color: #dc2626;
}

.error-box-text {
  flex: 1;
  line-height: 1.4;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Botão de envio */
.form-form-button {
  width: 100%;
  margin-top: 0.75rem;
  height: 3.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-weight: 600;
  transition: all 0.25s ease;
}

.form-form-button .btn-text {
  transition: opacity 0.2s ease;
}

.form-form-button .btn-loader {
  position: absolute;
  width: 1.25rem;
  height: 1.25rem;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  opacity: 0;
  animation: none;
}

.form-form-button.is-ready {
  filter: brightness(1.1);
  animation: pulse 2s infinite;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.form-form-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(40%);
  background-color: #9ca3af !important;
  pointer-events: none;
}

.form-form-button.is-loading {
  pointer-events: none;
}

.form-form-button.is-loading .btn-text {
  opacity: 0;
}

.form-form-button.is-loading .btn-loader {
  opacity: 1;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsivo */
@media screen and (max-width: 768px) {
  .form {
    padding-top: 3rem;
    padding-bottom: 3rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .form-title {
    font-size: 1.75rem;
  }

  .form-text {
    font-size: 1rem;
    text-align: center;
    line-height: 1.4;
    margin-bottom: 0.5rem;
  }

  .form-form {
    max-width: 100%;
    padding: 1.5rem;
  }

  .form-form input {
    font-size: 16px; /* Previne zoom no iOS */
  }

  .error-message {
    font-size: 0.75rem;
  }
}
