
/* =========================
   Layout principal das áreas de tabelas
   ========================= */
table { border-collapse:collapse };

.tables-area {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;    
    height: 100%;
    width: 100%;    
}

.tables-area-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;    
    padding: 24px 12px;
}

@media (min-width: 768px) { 
  .tables-area-content {         
    gap: 24px;        
    padding: 24px;    
  }
}

.main-h1 {
    font-family: var(--font-family-sans-serif);
    font-size: var(--font-size-xl);
    font-weight: 600;
    text-align: center;
}
@media (min-width: 768px) { 
  .main-h1 {         
    font-size: var(--font-size-2xl);        
  }
}

.box-situacao-atual {
    padding-top: 12px;
    padding-left: 8px;
    padding-right: 8px;
}

@media (min-width: 768px) { 
  .box-situacao-atual {
    padding-top: var(--spacing-24);
    padding-left: var(--spacing-24);
    padding-right: var(--spacing-24);
  }
}

.box-situacao-atual h1 {
    font-size: var(--font-size-sm);  
    line-height: 1.25;    
    text-transform: uppercase;
}
@media (min-width: 768px) { 
  .box-situacao-atual h1 {         
    font-size: var(--font-size-base);        
  }
}

/* =========================
   Container e wrapper das tabelas
   ========================= */
.data-table-container {    
    display: flex; 
    justify-content: space-around;    
    flex-direction: column;       
    border: 1px solid var(--sisam-border-color);
    background-color: #fff;
    border-radius: var(--radius-lg);
    padding: 0 var(--spacing-12);
}

.col-posicao {
    display: none;
}

@media (min-width: 575px) { 
    .col-posicao {
        display: table-cell;
    } 
}

.data-table-container h2 {
    margin-bottom: 1rem;
    font-family: var(--font-family-sans-serif);
    font-size: var(--font-size-2xl);
    font-weight: 600;
}

.data-table-wrapper{
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;    
}

/* =========================
   Tabela principal
   ========================= */
.data-table {             
    width: 100%;
    color: var(--sisam-table-color);
    vertical-align: top;
    border-color: var(--sisam-border-color);    
}

/* Thead da tabela */
.data-table > thead {
  vertical-align: bottom;
}

/* Cabeçalhos das colunas */
.data-table > thead > tr > th {
  font-weight: 600;
  font-size: var(--font-size-xs);
  border-bottom: 2px solid var(--sisam-border-color, #dbdfe6);
}
@media (min-width: 768px) { 
  .data-table > thead > tr > th {
    font-size: var(--font-size-sm);
  } 
}

.data-table > thead > tr > th:nth-child(1),
.data-table > thead > tr > th:nth-child(2) {
  text-align: left;
}

.data-table > thead > tr > th:nth-child(3),
.data-table > thead > tr > th:nth-child(4) {
  text-align: right;
}

/* Borda superior da tabela */
.data-table > :not(:first-child) {
  border-top: 2px solid currentColor;
}

/* Células th */
.data-table th {
  font-weight: 500;
  color: var(--sisam-table-color);
}

/* Células td */
.data-table td {
  font-family: var(--font-family-sans-serif);
  font-size: var(--font-size-xs);
  font-weight: 400;
}
@media (min-width: 768px) { 
  .data-table td {
    font-size: var(--font-size-sm);
  }
}

/* Células da tabela */
.data-table > :not(caption) > * > * {
  padding: 0.2rem 0.5rem;  
  border-bottom-width: 1px;
}

/* =========================
   Responsividade e largura das tabelas
   ========================= */
@media (max-width: 991.98px) {
    .col-posicao {
        display: none;
    }
    .unidade-medida {
        display: none;
    }
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Layout fixo e largura máxima para tabelas principais */
#data-table-estados,
#data-table-municipios {
    max-width: 1200px;
    width: 100%;
    table-layout: fixed;
}

/* Definir larguras específicas para cada coluna */
#data-table-estados th:nth-child(1),
#data-table-estados td:nth-child(1),
#data-table-municipios th:nth-child(1),
#data-table-municipios td:nth-child(1) {
    width: 10%; /* Coluna de número/índice */
}

#data-table-estados th:nth-child(2),
#data-table-estados td:nth-child(2),
#data-table-municipios th:nth-child(2),
#data-table-municipios td:nth-child(2) {
    width: 40%; /* Coluna de nomes */
}

#data-table-estados th:nth-child(n+3),
#data-table-estados td:nth-child(n+3),
#data-table-municipios th:nth-child(n+3),
#data-table-municipios td:nth-child(n+3) {
    width: 15%; /* Colunas de valores numéricos */
}

/* Alinhamento das duas primeiras colunas à esquerda */
#data-table-estados th:nth-child(-n+2),
#data-table-estados td:nth-child(-n+2),
#data-table-municipios th:nth-child(-n+2),
#data-table-municipios td:nth-child(-n+2) {
    text-align: left;
}

/* Alinhamento das demais colunas (3ª em diante) à direita */
#data-table-estados th:nth-child(n+3),
#data-table-estados td:nth-child(n+3),
#data-table-municipios th:nth-child(n+3),
#data-table-municipios td:nth-child(n+3) {
    text-align: right;
}

/* =========================
   Estilo das linhas e células
   ========================= */

/* Alternância de cores entre linhas */
.data-table > tbody > tr:nth-child(odd) > td {
  background-color: #ffffff;
}

.data-table > tbody > tr:nth-child(even) > td {
  background-color: #f5f7fa;
}

/* Hover nas linhas */
.data-table > tbody > tr:hover > td {
  background-color: #dbe1ee;
}

/* =========================
   Estilo dos círculos coloridos (legendas)
   ========================= */
.color-dot {
    width: 100%;
    height: 3px;
    border-radius: 2px;
    display: inline-block;    
    margin-bottom: 8px;        
}

@media (min-width: 768px) { 
    .color-dot {
      width: 12px;
      height: 12px;
      border-radius: 50%;
      display: inline-block;
      margin-left: 6px;      
      margin-bottom: 2px;    
      vertical-align: middle;
  }
}

/* =========================
   Estilos para o botão de download
   ========================= */
.button-download {  
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  user-select: none;
  border: 2px solid #6b7785;
  border-radius: 0.375rem;
  background-color: #6b7785;  
  transition: background-color 0.15s ease-in-out;          
  align-self: center;      
  margin-top: 1rem;
}

.button-download-slim {    
  padding: 0.25rem 0.5rem;  
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

.button-download:hover {  
  background-color: #5b6571;  
  transform: translateY(1px);
}

.button-download:focus {
  outline: 0;
  box-shadow: var(--sisam-btn-focus-box-shadow);
}

.button-download:active {
  color: var(--sisam-btn-active-color);
  background-color: var(--sisam-btn-active-bg);
  border-color: var(--sisam-btn-active-border-color);
  box-shadow: var(--sisam-btn-active-shadow);
  transform: translateY(0);
}

.button-download:disabled {
  color: var(--sisam-btn-disabled-color);
  pointer-events: none;
  background-color: var(--sisam-btn-disabled-bg);
  border-color: var(--sisam-btn-disabled-border-color);
  opacity: var(--sisam-btn-disabled-opacity);
}

.footer-situacao-atual {
  position: absolute;
  left: 0;
  background-color: #fff;
  width: 100%;
  padding: 1rem;
  text-align: center;
}

/* Adiciona borda inferior apenas na última linha de cada tabela */
.data-table tbody tr:last-child td {
    border-bottom: 1px solid var(--sisam-border-color);
}