/* ==========================================================================
   1. RESET GLOBAL E CONFIGURAÇÕES BASE
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Poppins', sans-serif;
  background: #f4f6f9;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px 15px;
}

.container {
  width: 100%;
  max-width: 1400px;
  background: #fff;
  border-radius: 25px;
  padding: 35px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
  .container {
    padding: 25px;
  }
}

.logo {
  width: 180px;
  display: block;
  margin: 0 auto 20px;
}

.logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 20px;
}

.logo-icon {
  color: #4f46e5;
  width: 56px;
  height: 56px;
}

h1 {
  text-align: center;
  color: #4f46e5;
  margin-bottom: 8px;
  font-size: 30px;
}

@media (max-width: 768px) {
  h1 {
    font-size: 25px;
  }
}

.subtitulo {
  text-align: center;
  color: #666;
  margin-bottom: 25px;
}

/* ==========================================================================
   2. CONFIGURAÇÃO DOS FORMULÁRIOS
   ========================================================================== */

/* IMPORTANTE: Isolamos o comportamento do form antigo para não quebrar a index.html,
   mas removemos a interferência dele no formulário de passos (patrimônios) */
#formulario {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

#formularioPatrimonio {
  display: block !important;
  width: 100% !important;
}

.pagina-categoria {
  display: block;
  width: 100%;
}

/* ==========================================================================
   3. O SISTEMA GRID RESPONSIVO DA PÁGINA DE PATRIMÔNIOS
   ========================================================================== */
.grid-patrimonios {
  display: grid !important;
  grid-template-columns: 1fr !important; /* Padrão Mobile: 1 coluna */
  gap: 25px !important;                  /* Espaçamento perfeito entre cartões */
  width: 100% !important;
  margin-bottom: 30px !important;
}

.wizard-nav {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 25px;
}

.wizard-step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 58px;
  padding: 10px;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #d9dee8;
  font-size: 13px;
  line-height: 1.3;
}

.wizard-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #4f46e5;
  font-weight: 700;
}

.wizard-step.ativo {
  background: #4f46e5;
  color: #ffffff;
  border-color: #4f46e5;
}

.wizard-step.ativo span,
.wizard-step.concluido span {
  background: #ffffff;
  color: #4f46e5;
}

.wizard-step.concluido {
  background: #e7f4ea;
  color: #1e4620;
  border-color: #b7dfc2;
}

.categoria-header {
  border-left: 5px solid #4f46e5;
  padding: 4px 0 16px 16px;
  margin-bottom: 18px;
}

.categoria-header span {
  display: block;
  color: #64748b;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.categoria-header h2 {
  color: #4f46e5;
  font-size: 23px;
}

/* TABLETS (Larguras maiores que 768px) -> 2 COLUNAS */
@media (min-width: 768px) {
  .grid-patrimonios {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* COMPUTADORES E NOTEBOOKS (Larguras maiores que 1024px) -> 3 COLUNAS PERFEITAS */
@media (min-width: 1024px) {
  .grid-patrimonios {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* ==========================================================================
   4. ESTILIZAÇÃO E ESTRUTURA DOS CARDS
   ========================================================================== */
.card {
  background: #ffffff;
  border: 1px solid #eef2f5;
  border-radius: 18px;
  padding: 25px !important; /* Respiro interno generoso para inputs e textos */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 0 25px 0; /* Margem inferior padrão para páginas que não usam grid */
}

/* Remove a margem inferior quando o card estiver dentro da grid dinâmica */
.grid-patrimonios .card {
  margin: 0 !important;
}

@media (max-width: 768px) {
  .card {
    padding: 20px !important;
  }

  .wizard-nav {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1024px) {
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
}

.card h2 {
  color: #4f46e5;
  font-size: 19px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

label {
  display: block;
  font-size: 15px;
  color: #1e293b;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
  background-color: #f8fafc;
  outline: none;
  transition: 0.3s;
}

input:focus, select:focus, textarea:focus {
  border-color: #4f46e5;
  background-color: #fff;
}

textarea {
  min-height: 100px;
  resize: none;
}

.campo-extra {
  display: none;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed #e2e8f0;
}

.descricao-campo {
  color: #777;
  font-size: 13px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.erro-input {
  border-color: #e53935 !important;
  background: #fff5f5;
}

small {
  color: red;
  display: block;
  margin-top: 5px;
}

/* ==========================================================================
   5. CONTROLES E COMPONENTES DO FORMULÁRIO EM PASSOS (WIZARD)
   ========================================================================== */
.progresso, #progresso-texto {
  background: #4f46e5 !important;
  color: #fff !important;
  text-align: center !important;
  padding: 12px !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  margin-bottom: 25px !important;
  font-size: 15px !important;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.15) !important;
  width: 100%;
}

.botoes {
  display: flex !important;
  justify-content: space-between !important;
  gap: 15px !important;
  width: 100% !important;
  margin-top: 20px !important;
}

button {
  width: 100%;
  background: #4f46e5;
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.3s;
  position: relative;
  z-index: 10;
}

button:hover {
  background: #4338ca;
}

.voltar {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.voltar:hover {
  background: #e2e8f0;
}

.botao-secundario {
  background: #0f766e;
}

.botao-secundario:hover {
  background: #115e59;
}

.painel-adicionar-item {
  margin-bottom: 25px;
}

.btn-remover-card {
  width: auto;
  align-self: flex-start;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 6px;
}

.btn-remover-card:hover {
  background: #fecaca;
}

.card-extra-item h2 input {
  margin: 0;
}

/* Elementos visuais de status e conclusão */
.check-icon {
  display: none;
  color: #2e7d32;
  font-weight: bold;
  margin-left: 8px;
}

.card-concluido {
  border-left: 6px solid #2e7d32 !important;
  background-color: #f9fbf9 !important;
}

.card-concluido .check-icon {
  display: inline-block;
}

.card-recolhido {
    padding-bottom: 15px !important;
    opacity: 0.8;
}

.card-recolhido label,
.card-recolhido .campo-extra,
.card-recolhido .descricao-campo,
.card-recolhido .btn-remover-card {
    display: none !important;
}

/* ==========================================================================
   6. CARD DE RESUMO, BOTÃO TOPO E MENSACHENS DE STATUS
   ========================================================================== */
.resumo-card {
  margin-bottom: 25px;
}

.resumo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 2fr));
  gap: 15px;
  margin-top: 20px;
}

.resumo-item {
  background: #f7f8fc;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #e4e7f2;
}

.resumo-item span {
  display: block;
  font-size: 13px;
  color: #777;
  margin-bottom: 8px;
}

.resumo-item strong {
  color: #4f46e5;
  font-size: 16px;
  line-height: 1.5;
}

.destaque {
  background: #4f46e5;
}
.destaque span, .destaque strong {
  color: #fff;
}

.mensagem-status {
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  width: 100%;
}
.mensagem-status.erro { background-color: #fde8e8; color: #e53e3e; border: 1px solid #f8b4b4; }
.mensagem-status.sucesso { background-color: #edf7ed; color: #1e4620; border: 1px solid #c3e6cb; }
.mensagem-status.aviso { background-color: #fff8e1; color: #b78103; border: 1px solid #ffe082; }

.painel-relatorio {
  margin-top: 28px;
  background: #f8fafc;
  border-color: #d9dee8;
}

.container-relatorio {
  max-width: 1400px;
}

.painel-relatorio-admin {
  margin-top: 0;
}

.painel-relatorio h2 {
  margin-bottom: 8px;
}

.relatorio-botoes {
  margin-top: 18px !important;
}

@media (max-width: 768px) {
  .relatorio-botoes {
    flex-direction: column;
  }
}

#btn-topo {
  display: none;
  position: fixed;
  bottom: 25px;
  right: 25px;
  z-index: 99;
  border: none;
  outline: none;
  background-color: #4f46e5;
  color: white;
  cursor: pointer;
  padding: 12px 18px;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: 0.3s;
  width: auto;
}
#btn-topo:hover {
  background-color: #4338ca;
  transform: translateY(-3px);
}

/* ==========================================================================
   7. RODAPÉ (FOOTER)
   ========================================================================== */
.footer {
  margin-top: 35px;
  padding-top: 25px;
  border-top: 1px solid #e4e4e4;
  text-align: center;
  width: 100%;
}

.footer p {
  color: #666;
  font-size: 14px;
  margin-bottom: 8px;
  line-height: 1.6;
}

.footer p:last-child {
  margin-bottom: 0;
}

.footer a {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
  transition: 0.3s;
}

.footer a:hover {
  text-decoration: underline;
}

/* Estilos para a Tabela de Relatórios */
.tabela-container {
    overflow-x: auto;
    margin-top: 15px;
}

.tabela-dinamica {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tabela-dinamica th, .tabela-dinamica td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eef2f5;
}

.tabela-dinamica th {
    background-color: #f8fafc;
    color: #4f46e5;
    font-weight: 600;
}

.tabela-dinamica tr:hover {
    background-color: #f9fbfd;
}

.btn-tabela {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
    width: auto;
}

.carregando {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* ==========================================================================
   8. COMPONENTES EXTRAS UI/UX ACESSÍVEIS (IDAS E VOLTAS MOBILE)
   ========================================================================== */

/* Grupo de botões grandes para Sim/Não (Toggle Group) */
.toggle-group {
  display: flex;
  gap: 12px;
  margin-top: 12px;
  width: 100%;
}

.btn-toggle {
  flex: 1;
  padding: 15px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  border: 2px solid #cbd5e1;
  background-color: #f8fafc;
  color: #475569;
  transition: all 0.2s ease;
  width: 100%;
}

.btn-toggle.btn-sim:hover {
  border-color: #1e3a2f;
  background-color: #f0fdf4;
  color: #1e3a2f;
}

.btn-toggle.btn-sim.ativo {
  background-color: #2e7d32 !important;
  color: white !important;
  border-color: #2e7d32 !important;
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.25);
}

.btn-toggle.btn-nao:hover {
  border-color: #7f1d1d;
  background-color: #fef2f2;
  color: #7f1d1d;
}

.btn-toggle.btn-nao.ativo {
  background-color: #d32f2f !important;
  color: white !important;
  border-color: #d32f2f !important;
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.25);
}

/* Container do Seletor Numérico de Quantidade (Stepper) */
.stepper-container {
  display: flex;
  align-items: center;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  overflow: hidden;
  background-color: #f8fafc;
  width: 160px;
  height: 52px;
  margin-top: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-stepper {
  width: 52px;
  height: 52px;
  background: none;
  border: none;
  color: #4f46e5;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  padding: 0;
  z-index: 1;
}

.btn-stepper:hover {
  background-color: #e2e8f0;
}

.stepper-container input[type="number"] {
  flex: 1;
  text-align: center;
  border: none !important;
  background: none !important;
  font-size: 18px;
  font-weight: 700;
  color: #4f46e5;
  padding: 0 !important;
  margin: 0;
  pointer-events: none; /* Evita que o teclado do mobile pule na tela */
}

/* Chrome, Safari, Edge, Opera: Esconder setas nativas */
.stepper-container input::-webkit-outer-spin-button,
.stepper-container input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox: Esconder setas nativas */
.stepper-container input[type=number] {
  -moz-appearance: textfield;
}

/* Animação e destaque de erro nos cartões */
.card-erro-destaque {
  border: 3px solid #d32f2f !important;
  box-shadow: 0 0 15px rgba(211, 47, 47, 0.3) !important;
  background-color: #fff5f5 !important;
  transform: scale(1.015);
  transition: all 0.3s ease;
}

/* Badges de estado de conservação no relatório administrativo */
.status-estado {
  padding: 5px 10px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  display: inline-block;
}
.status-estado.estado-bom {
  background-color: #e8f5e9;
  color: #2e7d32;
}
.status-estado.estado-otimo {
  background-color: #e3f2fd;
  color: #1565c0;
}
.status-estado.estado-regular {
  background-color: #fff3e0;
  color: #ef6c00;
}
.status-estado.estado-ruim {
  background-color: #ffebee;
  color: #c62828;
}

/* Adaptação móvel para as abas do wizard (visual de círculos horizontais) */
@media (max-width: 768px) {
  .wizard-nav {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 6px !important;
    margin-bottom: 25px !important;
  }

  .wizard-step {
    flex: 1 !important;
    min-height: 40px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1 !important;
    font-size: 0 !important;
    justify-content: center !important;
  }

  .wizard-step span {
    margin: 0 !important;
    font-size: 14px !important;
    width: 28px !important;
    height: 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .wizard-step .step-title {
    display: none !important;
  }
}
