/* Overlay translúcido */
#proposalModal.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

/* Caixa do modal */
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 30px 35px;
  width: 95%;
  max-width: 500px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
  position: relative;
  animation: fadeInModal 0.3s ease forwards;
}

/* Cabeçalho */
.modal-box h2 {
  text-align: center;
  margin-bottom: 20px;
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 600;
}
.modal-box .fa-close {
  font-size: 1.6rem;
  position: absolute;
  cursor: pointer;
  transition: transform .2s;
  color: var(--text);
}

.modal-box .fa-close:hover {
  transform: rotate(180deg);
}

/* Campos */
.modal-box .form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}
.modal-box .desc {
    font-size: .9rem;
    line-height: 22px;
    opacity: .7;
}
.modal-box label {
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.modal-box select,
.modal-box textarea,
.modal-box input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #dddddd47;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.light-theme .modal-box select,
.light-theme .modal-box textarea,
.light-theme .modal-box input {
  border-color: #ddddddd6;
}


.modal-box select option {
  color: var(--text);
  background-color: var(--bg-general);
}

.modal-box input:focus {
  border-color: #5b4ce1;
  outline: none;
}

/* Botão principal */
.modal-box .generate-btn {
  margin-top: 10px;
  background: linear-gradient(135deg, #5b4ce1, #2d208f);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 25px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.modal-box .generate-btn:hover {
  opacity: 0.9;
}

.modal-box.embase-box,
.modal-box.normative-box {
  width: 100%;
  max-width: 860px;
}

/* Fade-in do modal */
@keyframes fadeInModal {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade-in sequencial (apenas a animação e keyframes) */
.fade-field {
  opacity: 0;
  transform: translateY(10px);
  /* não definir animation aqui; o JS irá aplicar */
}

/* se quiser, um pequeno tempo padrão caso JS falhe */
.fade-field.faded {
  opacity: 1;
  transform: translateY(0);
}

/* keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media only screen and (max-width:768px) {
    .modal-box .generate-btn {
        width: 100%;
    }
}



/* Layout otimizado para contestação */
#contestModal .modal-box {
  max-width: 860px;
  width: 92%;
  max-height: 90vh;
  overflow-y: auto;
}

#contestForm.contest-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

#contestForm .span-2 {
  grid-column: 1 / -1;
}

#contestForm .generate-btn {
  grid-column: 1 / -1;
  width: 100%;
}

#contestForm .helper-inline {
  display: inline-block;
  margin-top: 6px;
  color: #666;
}

.contest-docs-block {
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.01);
}

.contest-docs-hint {
  display: block;
  color: #aaa;
  margin-top: 0;
  margin-bottom: 8px;
}

.contest-docs-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.contest-docs-attach-note {
  color: #aaa;
  margin-top: 0;
}

#contestForm .btn {
  width: auto;
  justify-self: flex-start;
  position: relative;
}
#contestModal .fa-close {
  position: absolute;
  font-size: 1.6rem;
  cursor: pointer;
  transition: transform .2s;
}

#contestModal .fa-close:hover {
  transform: rotateZ(360deg);
}

@media (max-width: 800px) {
  #contestForm.contest-form {
    grid-template-columns: 1fr;
  }

  #contestModal .modal-box {
    max-width: 95%;
  }
}