/* Admin - Forms (SaaS clean, modern UI/UX)
   Estritamente para páginas admin e modais do admin_dashboard.php
*/

:root{
  --admin-bg: #0b1220;
  --admin-surface: #ffffff;
  --admin-border: rgba(15, 23, 42, 0.12);
  --admin-muted: rgba(15, 23, 42, 0.65);
  --admin-text: #0f172a;
  --admin-primary: #f97316; /* Laranja */
  --admin-primary-2: #3b82f6; /* Azul */
  --admin-danger: #dc3545;
  --admin-success: #22c55e;
  --admin-radius: 14px;
  --admin-radius-sm: 10px;
  --admin-focus: rgba(249, 115, 22, 0.35);
}

/* Only affect admin containers */
.admin-card,
.admin-modal .modal-content,
.admin-table,
.admin-wrapper{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--admin-text);
}

/* Layout helpers */
.admin-form-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 900px){
  .admin-form-grid{ grid-template-columns: 1fr; }
}

/* If an input group should span full width */
.admin-form-span-2{ grid-column: span 2; }
@media (max-width: 900px){
  .admin-form-span-2{ grid-column: auto; }
}

/* Form group */
.admin-form-group{
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin-bottom: 8px;
}

/* Labels above inputs */
.admin-form-label{
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  color: rgba(15, 23, 42, 0.86);
}

/* Inputs */
.admin-form-control,
.admin-form-select,
.admin-form-textarea{
  width: 100%;
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius-sm);
  background: #fff;
  padding: 10px 12px;
  font-size: 0.92rem;
  outline: none;
  transition: box-shadow 160ms ease, border-color 160ms ease, transform 160ms ease;
  box-sizing: border-box;
}

.admin-form-control::placeholder,
.admin-form-textarea::placeholder{
  color: rgba(15, 23, 42, 0.42);
}

.admin-form-textarea{ min-height: 110px; resize: vertical; }

.admin-form-select{
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(15, 23, 42, 0.55) 50%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.55) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(1em + 2px),
    calc(100% - 13px) calc(1em + 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

/* Focus */
.admin-form-control:focus,
.admin-form-select:focus,
.admin-form-textarea:focus{
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 0 0 4px var(--admin-focus);
}

/* Buttons */
.admin-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 900;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}

.admin-btn:active{ transform: translateY(1px); }

.admin-btn-primary{
  background: var(--admin-primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.25);
}

.admin-btn-primary:hover{ filter: brightness(0.98); }

.admin-btn-blue{
  background: var(--admin-primary-2);
  color: #fff;
}

.admin-btn-danger{
  background: var(--admin-danger);
  color: #fff;
}

.admin-btn-success{
  background: var(--admin-success);
  color: #fff;
}

/* Modal responsiveness (high specificity to avoid other admin css overriding) */
#detailModal .modal-content.admin-modal{
  max-width: 760px !important;
}
#detailModal .modal-content,
.admin-modal .modal-content{
  width: 95% !important;
  border-radius: 18px !important;
  padding: 25px !important;
  margin-top: 0 !important;
  max-height: calc(100vh - 40px) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow-y: auto !important;
  box-sizing: border-box;
}


/* O #modalBody deve ser o elemento que faz scroll */
#modalBody{ /* Este é o ID do div onde o conteúdo do formulário é injetado */
  flex-grow: 1; /* Permite que o #modalBody ocupe o espaço disponível */
  overflow-y: auto; /* Adiciona scroll vertical ao #modalBody */
  overflow-x: hidden;
  min-height: 0; /* evita cortar/overflow em flex */
  padding-right: 10px; /* Espaço para a scrollbar não sobrepor o conteúdo */
  margin-bottom: 20px; /* Espaço entre o body e o footer */
  max-height: 100%;
}


@media (max-width: 480px){
  .admin-modal .modal-content{
    max-width: 100% !important;
    padding: 14px !important;
    margin-top: 6px;
    max-height: calc(100vh - 20px);
  }
  /* Evitar overlays/espacamento em mobile */
  .admin-view-container{ padding: 10px !important; }
  .admin-form-grid{ gap: 12px !important; }
}

/* Seletores com melhor aparência */
.admin-form-select{
  font-weight: 800;
}

/* Upload de imagem (melhor aparência e consistência) */
.admin-form-control[type="file"]{
  padding: 10px 10px;
}

/* Garantir que o modal fique acima do layout e não bloqueie cliques quando fechado */
#detailModal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}
#detailModal[style*="display: flex"],
#detailModal[style*="display:flex"]{
  pointer-events: auto;
}
#detailModal .modal-content{
  position: relative;
}

/* Evitar que overlays/transforms criem stacking context */
.admin-wrapper{
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  z-index: 1;
}

/* Modern badge sizing */
.badge{
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
}

