/* ==========================================================================
   ESTILOS GERAIS DA APLICAÇÃO (MOBILE-FIRST CENTRALIZADO)
   ========================================================================== */

/* 1. LAYOUT GERAL E CONTAINER CENTRALIZADO */
#app-container,
.app-container {
  width: 100%;
  max-width: 420px !important; /* Trava a largura mobile no centro da tela */
  margin: 0 auto !important;
  padding: 1rem !important;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-sizing: border-box;
}

/* Força cálculo de caixa previsível em todos os elementos */
#app-container *,
.app-container * {
  box-sizing: border-box;
}

/* Utilitário para ocultar elementos */
.hidden {
  display: none !important;
}

/* 2. NAVBAR E HEADER TOPO */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--cor-primaria, #1d3557);
  color: #ffffff;
  padding: 0.875rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  width: 100%;
}

.nav-btn-icon {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem;
}

.nav-title-container {
  text-align: center;
  flex: 1;
}

.nav-title {
  font-size: 1.063rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin: 0;
}

.btn-voltar {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #ffffff;
  padding: 0.4rem 0.875rem;
  border-radius: 0.5rem;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-voltar:active {
  background: rgba(255, 255, 255, 0.35);
}

/* 3. MENU LATERAL (SIDEBAR) */
.sidebar {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 1500;
  display: flex;
}

.sidebar-content {
  width: 280px;
  max-width: 80%;
  background-color: var(--cor-primaria, #1d3557);
  color: #ffffff;
  height: 100%;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
}

.side-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.side-header {
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.btn-close-side {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.25rem;
  cursor: pointer;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.side-item {
  background: transparent;
  border: none;
  color: #ffffff;
  text-align: left;
  padding: 0.875rem 1rem;
  border-radius: 0.625rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.side-item:active {
  background-color: rgba(255, 255, 255, 0.1);
}

.side-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lang-selector {
  display: flex;
  gap: 0.5rem;
}

.btn-idioma {
  flex: 1;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  padding: 0.5rem;
  border-radius: 0.375rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-sair {
  background-color: var(--cor-destaque, #e63946);
  color: #ffffff;
  border: none;
  padding: 0.75rem;
  border-radius: 0.625rem;
  font-weight: 700;
  cursor: pointer;
}

/* 4. TELA INICIAL (INDEX.HTML): HEADER DE USUÁRIO */
.header-user {
  background-color: var(--cor-card, #ffffff);
  padding: 1.25rem;
  border-radius: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.375rem;
  width: 100%;
}

.txt-user {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--cor-primaria, #1d3557);
  margin: 0;
}

.txt-sub {
  font-size: 0.813rem;
  color: #666666;
  margin: 0;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(131, 56, 236, 0.12);
  color: #8338ec;
  border: 1px solid #8338ec;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.688rem;
  font-weight: 800;
  margin-top: 0.25rem;
  align-self: flex-start; /* Impede que a badge estique a largura toda */
}

/* 5. GRID DE AÇÕES RÁPIDAS */
.grid-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.875rem;
  width: 100%;
}

.card-action {
  background-color: var(--cor-card, #ffffff);
  border: none;
  padding: 1.25rem 0.75rem;
  border-radius: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  min-height: 100px;
}

.card-action:active {
  transform: scale(0.96);
}

.card-emoji {
  font-size: 1.75rem;
  line-height: 1;
}

.card-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--cor-primaria, #1d3557);
}

/* BOTÃO DE EMERGÊNCIA */
.btn-emergencia {
  background-color: var(--cor-destaque, #e63946);
  color: #ffffff;
  border: none;
  padding: 1rem;
  border-radius: 1rem;
  font-weight: 800;
  font-size: 0.938rem;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
  cursor: pointer;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-emergencia:active {
  transform: scale(0.98);
}

/* 6. LOG DE REPORTES */
.theme-card {
  width: 100%;
  background-color: var(--cor-card, #ffffff);
  border-radius: 1.25rem;
  padding: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 0.625rem;
}

.log-titulo {
  font-size: 0.813rem;
  font-weight: 800;
  color: var(--cor-primaria, #1d3557);
  letter-spacing: 0.03em;
  margin: 0;
}

.log-ver-todos {
  background: transparent;
  border: none;
  color: var(--cor-secundaria, #457b9d);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.log-vazio {
  text-align: center;
  padding: 1.25rem 0;
  color: #888888;
}

.log-vazio-txt {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 0;
}

.log-vazio-subtxt {
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* 7. MODAIS SOBREPOSTOS */
.modal-sobreposto {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 1.25rem;
}

.modal-conteudo {
  width: 100%;
  max-width: 360px;
  background-color: #ffffff;
  border-radius: 1.25rem;
  padding: 1.5rem;
}

.modal-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cor-primaria, #1d3557);
  margin-bottom: 0.625rem;
  display: block;
}

.modal-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: 1rem;
}

.btn-theme-secondary {
  background-color: #e0e0e0;
  color: #333;
  border: none;
  width: 50%;
  padding: 0.75rem;
  border-radius: 0.625rem;
  font-weight: 700;
  cursor: pointer;
}

/* ==========================================================================
   ESTILOS DA TELA DE PERFIL (TELAN-PROFILE.HTML)
   ========================================================================== */

.perfil-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.avatar-secao {
  width: 100%;
  background-color: var(--cor-card, #ffffff);
  padding: 1.5rem 1rem;
  border-radius: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.avatar-wrapper {
  position: relative;
  width: 90px;
  height: 90px;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-img {
  width: 90px !important;
  height: 90px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--cor-primaria, #1d3557);
  background-color: #f0f4f8;
  display: block;
}

.btn-trocar-foto {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background-color: var(--cor-destaque, #e63946);
  border: 2px solid #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.813rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.perfil-nome {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cor-primaria, #1d3557);
  margin: 0 0 0.25rem 0;
}

.badge-status {
  background-color: var(--cor-secundaria, #457b9d);
  color: #ffffff;
  padding: 0.25rem 0.875rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  display: inline-block;
}

.stats-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.stats-card {
  background-color: var(--cor-card, #ffffff);
  padding: 1rem 0.5rem;
  border-radius: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100px;
}

.stats-emoji {
  font-size: 1.375rem;
  margin-bottom: 0.25rem;
  line-height: 1;
}

.stats-valor {
  font-size: 0.938rem;
  font-weight: 800;
  color: var(--cor-primaria, #1d3557);
  line-height: 1.1;
}

.stats-label {
  font-size: 0.75rem;
  color: #666666;
  margin-top: 0.25rem;
  font-weight: 600;
  line-height: 1.1;
}

.resumo-box {
  width: 100%;
  background-color: var(--cor-card, #ffffff);
  padding: 1.25rem;
  border-radius: 1.25rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.resumo-titulo {
  font-size: 0.813rem;
  font-weight: 800;
  color: var(--cor-primaria, #1d3557);
  letter-spacing: 0.05em;
  border-bottom: 1px solid #eeeeee;
  padding-bottom: 0.5rem;
  margin: 0;
}

.resumo-linha {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #444444;
}

.btn-sair-perfil {
  width: 100%;
  min-height: 3rem;
  background-color: transparent;
  color: var(--cor-destaque, #e63946);
  border: 2px solid var(--cor-destaque, #e63946);
  border-radius: 0.875rem;
  font-weight: 700;
  font-size: 0.938rem;
  cursor: pointer;
}

/* ==========================================================================
   ESTILOS DA TELA RELATAR (TELAN-RELATAR.HTML) - MOBILE-FIRST SIMÉTRICO
   ========================================================================== */

.form-relato-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.section-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--cor-primaria, #1d3557);
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Barra de GPS e Data */
.barra-identificacao {
  background-color: var(--cor-card, #ffffff);
  padding: 0.875rem 1rem;
  border-radius: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  font-size: 0.813rem;
  color: #444444;
  font-weight: 600;
}

.info-badge {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* Grid Dinâmico de Categorias */
.seletor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  width: 100%;
}

.cat-btn {
  background-color: var(--cor-card, #ffffff);
  border: 2px solid transparent;
  padding: 0.875rem 0.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.1s ease;
}

.cat-btn.selected {
  border-color: var(--cor-primaria, #1d3557);
  background-color: rgba(29, 53, 87, 0.05);
}

.cat-btn:active {
  transform: scale(0.97);
}

/* Caixa Tracejada de Captura de Mídia */
.box-evidencia-tracejada {
  width: 100%;
  border: 2px dashed var(--cor-secundaria, #457b9d);
  border-radius: 1.25rem;
  padding: 1.5rem 1rem;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box;
}

.placeholder-evidencia {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.camera-icon {
  font-size: 2.25rem;
  line-height: 1;
}

.txt-capturar {
  font-weight: 800;
  font-size: 0.875rem;
  color: var(--cor-primaria, #1d3557);
}

.txt-ia-status {
  font-size: 0.75rem;
  color: #666666;
}

.preview-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 0.875rem;
}

/* Card do Resultado de Identificação da IA */
.card-ia {
  background-color: var(--cor-card, #ffffff);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-ia-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-ia-titulo {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--cor-primaria, #1d3557);
}

.badge-confianca {
  background-color: var(--cor-sucesso, #2a9d8f);
  color: #ffffff;
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.688rem;
  font-weight: 700;
}

.ia-especie-txt {
  font-size: 1.125rem;
  color: var(--cor-primaria, #1d3557);
  margin: 0;
}

.btn-link-theme {
  background: transparent;
  border: none;
  color: var(--cor-secundaria, #457b9d);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-start;
  padding: 0;
  margin-top: 0.25rem;
}

/* Campo de Texto da Descrição */
.input-area-theme {
  width: 100%;
  min-height: 100px;
  padding: 0.875rem 1rem;
  border-radius: 1.25rem;
  border: 1px solid #e0e0e0;
  outline: none;
  font-size: 0.875rem;
  font-family: inherit;
  resize: vertical;
  background-color: var(--cor-card, #ffffff);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.input-area-theme:focus {
  border-color: var(--cor-secundaria, #457b9d);
}

/* Botão Confirmar Registro */
.btn-theme-primary {
  width: 100%;
  min-height: 3.25rem;
  background-color: var(--cor-primaria, #1d3557);
  color: #ffffff;
  border: none;
  border-radius: 1rem;
  font-weight: 800;
  font-size: 0.938rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(29, 53, 87, 0.25);
  margin-top: 0.25rem;
}

.btn-theme-primary:active {
  transform: scale(0.98);
}

/* ==========================================================================
   ESTILOS DA TELA DE MAPA (TELAN-MAPA.HTML)
   ========================================================================== */

.map-container-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

/* Wrapper do Mapa com altura garantida */
.map-wrapper {
  width: 100%;
  height: 380px; /* Altura fixa garantida para o Leaflet renderizar */
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 1;
}

.leaflet-map {
  width: 100%;
  height: 100%;
  background-color: #e5e3df; /* Cor de fundo suave durante o carregamento */
}

/* Legenda de Prioridades sobreposta ou em card */
.legenda-heatmap {
  width: 100%;
  background-color: var(--cor-card, #ffffff);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.legenda-titulo {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--cor-primaria, #1d3557);
  letter-spacing: 0.05em;
}

.legenda-linha {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.legenda-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.813rem;
  font-weight: 600;
  color: #444444;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.prio-max { background-color: #e63946; }
.prio-alta { background-color: #f4a261; }


/* ==========================================================================
   ESTILOS DE CATÁLOGO, DASHBOARD E KANBAN
   ========================================================================== */

/* Catálogo de Fauna */
.catalogo-container {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  width: 100%;
}

.catalogo-card {
  background-color: var(--cor-card, #ffffff);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.catalogo-img {
  width: 70px;
  height: 70px;
  border-radius: 0.875rem;
  object-fit: cover;
}

/* Dashboard Container */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
}

/* Kanban Board */
.kanban-board-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

.kanban-coluna {
  flex: 0 0 280px;
  background-color: var(--cor-card, #ffffff);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ==========================================================================
   ESTILOS DO CATÁLOGO DE FAUNA
   ========================================================================== */

.catalogo-container {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  width: 100%;
}

.catalogo-card {
  background-color: var(--cor-card, #ffffff);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  gap: 0.875rem;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}

.catalogo-img {
  width: 75px;
  height: 75px;
  border-radius: 0.875rem;
  object-fit: cover;
  background-color: #f0f4f8;
  flex-shrink: 0;
}

/* ==========================================================================
   ESTILOS DO DASHBOARD OPERACIONAL
   ========================================================================== */

.dash-grafico-barra-container {
  width: 100%;
  height: 1.25rem;
  background-color: #e0e0e0;
  border-radius: 1rem;
  display: flex;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.barra-segmento {
  height: 100%;
  transition: width 0.4s ease;
}

.barra-segmento.prio-max { background-color: #e63946; }
.barra-segmento.prio-alta { background-color: #f4a261; }
.barra-segmento.prio-normal { background-color: #2a9d8f; }

/* ==========================================================================
   ESTILOS DO GRÁFICO DE ROSQUINHA NO DASHBOARD
   ========================================================================== */

.chart-wrapper {
  position: relative;
  width: 100%;
  max-width: 240px; /* Mantém o gráfico compacto e simétrico no mobile */
  height: 220px;
  margin: 0 auto;
}

/* ==========================================================================
   CORREÇÃO DE EXIBIÇÃO DA TELA DE COMANDO
   ========================================================================== */

#view-comando {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.kanban-board-scroll {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  width: 100%;
  min-height: 200px;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

.kanban-coluna {
  flex: 0 0 300px;
  background-color: var(--cor-card, #ffffff);
  border-radius: 1.25rem;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-sizing: border-box;
}

/* ==========================================================================
   ESTILOS DO MODAL DE DETALHES DO RELATO
   ========================================================================== */

   .capture-box {
      border: 2px dashed var(--cor-primaria, #1d3557);
      border-radius: 1rem;
      padding: 1.5rem;
      text-align: center;
      cursor: pointer;
      background: rgba(29, 53, 87, 0.03);
      margin-bottom: 1rem;
      transition: background 0.2s;
    }
    .capture-box:hover { background: rgba(29, 53, 87, 0.08); }
    .status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 1rem; }
    .status-option {
      padding: 0.75rem;
      border: 1px solid #ddd;
      border-radius: 0.5rem;
      text-align: center;
      font-size: 0.85rem;
      cursor: pointer;
      background: white;
    }
    .status-option.selected {
      background: var(--cor-primaria);
      color: white;
      border-color: var(--cor-primaria);
    }
    #preview-img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 0.5rem; display: none; margin-bottom: 1rem; }