/* ==================== RESPONSIVIDADE DOS MODAIS ==================== */

/* Para telas de notebooks (altura menor que 900px) */
@media (max-height: 900px) {
  .modal-content {
    padding: 24px !important;
    /* Reduz o padding interno do modal */
    max-width: 400px !important;
    /* Reduz a largura máxima do modal */
  }

  .modal-content h2 {
    font-size: 20px !important;
    margin-bottom: 8px !important;
  }

  .modal-content p {
    font-size: 12px !important;
    margin-bottom: 16px !important;
  }

  /* Inputs, selects e labels do modal */
  .modal-content input,
  .modal-content select {
    padding: 10px 12px !important;
    margin-bottom: 10px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
  }

  .modal-content label {
    font-size: 10px !important;
    margin-bottom: 4px !important;
  }

  /* Botões do modal */
  .modal-actions {
    margin-top: 16px !important;
    gap: 8px !important;
  }

  .modal-actions button {
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
}

/* Para celulares (largura menor que 500px) */
@media (max-width: 500px) {
  .modal-content {
    max-width: 90% !important;
    padding: 20px !important;
  }
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);

  /* NOVAS REGRAS PARA NÃO ESTOURAR A TELA */
  max-height: 90vh;
  /* Ocupa no máximo 90% da altura da tela */
  overflow-y: auto;
  /* Cria barra de rolagem interna se o conteúdo for maior */
}

/* Barra de rolagem bonita dentro do modal */
.modal-content::-webkit-scrollbar {
  width: 6px;
}

.modal-content::-webkit-scrollbar-track {
  background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Ajuste para o "form-row" (duas colunas) não esmagar em telas pequenas */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .form-row {
    grid-template-columns: 1fr;
    /* Vira coluna única no celular */
  }
}

/* ==================== RESPONSIVIDADE DOS MODAIS (NOTEBOOKS) ==================== */
@media (max-height: 900px) {
  .modal-content {
    padding: 24px !important;
    max-width: 420px;
    /* Um pouco mais estreito */
    max-height: 85vh;
    /* Deixa um respiro nas bordas */
  }

  /* Deixa os inputs e selects mais finos */
  .modal-content input,
  .modal-content select {
    padding: 8px 12px !important;
    margin-bottom: 8px !important;
    font-size: 12px !important;
  }

  /* Diminui o espaçamento entre as linhas do formulário */
  .form-row {
    gap: 10px !important;
    margin-bottom: 8px !important;
  }

  /* Ajusta as labels */
  .modal-content label {
    font-size: 10px !important;
  }

  /* Diminui o botão de salvar e cancelar */
  .modal-actions {
    margin-top: 12px !important;
  }

  .modal-actions button {
    padding: 8px 16px !important;
    font-size: 12px !important;
  }
}
