@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Space+Mono:wght@400;700&display=swap');
@import url('variables.css');

/* === GLOBAL === */
body {
  font-family: var(--font-main), sans-serif;
  margin: 0;
  padding: 0;
  color: var(--text-primary);
}

/* === CONTAINER PRINCIPAL === */
.conteudo {
  margin: 0 var(--spacing-container);
}

/* === TOPO === */
.topo-container {
  width: 100%;
  margin-top: var(--spacing-container-vertical);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topo-esquerda {
  width: var(--topo-esquerda-width);
}

.topo-direita {
  width: var(--topo-direita-width);
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
}

#logo {
  width: var(--logo-width);
  max-width: 100%;
  height: auto;
  vertical-align: bottom;
}

#logo-wave {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: var(--logo-wave-height);
  margin-top: -60px;
}

#titulo {
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-bold);
  color: var(--primary-color);
  margin-top: var(--spacing-md);
}

#meta {
  font-size: var(--font-size-large);
  color: var(--text-primary);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.5px;
  display: block;
  margin-top: var(--spacing-xs);
}

/* === ALERTA === */
#alert {
  display: none;
  background-color: var(--alert-color);
  color: var(--text-primary);
  padding: var(--spacing-lg);
  border-radius: var(--border-radius-sm);
  margin-bottom: var(--spacing-xl);
}

/* === SEÇÃO DE INFO === */
.info-bar {
  margin-top: var(--spacing-container-vertical);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-bold);
  color: var(--primary-color);
  margin-top: var(--spacing-xxxl);
  margin-bottom: var(--spacing-md);
}

/* === CONTROLES === */
#controles {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--spacing-sm);
}

#datasetSelect {
  padding: var(--spacing-md) var(--spacing-lg);
  font: inherit;
  color: var(--primary-color);
}

.control-button {
  padding: var(--spacing-md) var(--spacing-lg);
  font: inherit;
  color: var(--primary-color);
  background-color: var(--primary-light);
  border: var(--border-width) solid var(--primary-medium);
  border-radius: var(--border-radius-sm);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

/* === CUSTOM TOOLTIP (SOPHISTICATED LOOK) === */
.control-button[data-tooltip] {
  position: relative;
}

.control-button[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 140%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background-color: var(--dark-blue);
  color: #fff;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--border-radius-md);
  font-size: 0.8rem;
  font-weight: var(--font-weight-normal);
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease-out;
  z-index: 1000;
  pointer-events: none;
}

/* Pequena seta no fundo do balão */
.control-button[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  border: 6px solid transparent;
  border-top-color: var(--dark-blue);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease-out;
  z-index: 1000;
}

.control-button[data-tooltip]:hover::after,
.control-button[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

#info-button {
  /* Remove text-specific styles as it now contains an image */
  /* font-weight: var(--font-weight-bold); */
  /* font-style: italic; */
  width: 40px; /* Make button square */
  height: 40px;
  padding: 0; /* Remove padding, content will be centered */
  display: flex; /* Use flexbox to center the image */
  align-items: center;
  justify-content: center;
}
#info-button img {
  width: 24px; /* Size of the icon */
  height: 24px;
}

.control-button:hover {
  background-color: var(--primary-medium);
}
}

/* === TABELAS === */
#rankingTable,
#rankingTable2 {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
  box-shadow: var(--shadow);
  margin-bottom: var(--spacing-xxl);
}

th {
  background-color: var(--primary-light);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  position: relative;
  text-align: left;
  padding: var(--spacing-md) var(--spacing-lg);
  padding-left: 20px;
  border: none;
}

th.active {
  background-color: var(--primary-medium);
}

th .arrow {
  margin-left: var(--spacing-xs);
  font-size: 0.8em;
  color: var(--text-muted);
}

th.active .arrow {
  color: red;
}

.row-total-radio {
  background-color: var(--primary-light);
  font-weight: var(--font-weight-bold);
}

td {
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
}

tbody td {
  padding: 10px 16px;
}

td.bar-cell {
  position: relative;
  overflow: hidden;
  background-color: transparent;
  font-weight: var(--font-weight-bold);
}

td.bar-cell::before {
  content: '';
  position: absolute;
  inset: 0;
  width: var(--bar-width, 0%);
  background: rgba(0, 84, 148, 0.14);
  z-index: 0;
}

td.bar-cell {
  z-index: 1;
}

td.bar-cell > * {
  position: relative;
  z-index: 1;
}

td:first-child {
  color: var(--text-light);
  text-align: center;
  width: 60px;
}

th:first-child {
  text-align: center;
  width: 60px;
  padding-left: var(--spacing-lg);
}

.col-emissora {
  text-align: left;
  font-weight: var(--font-weight-bold);
  width: var(--col-emissora-width);
}

th:nth-child(2) {
  text-align: left;
}

th:nth-child(3),
th:nth-child(4),
th:nth-child(5),
th:nth-child(6),
th:nth-child(7),
th:nth-child(8),
th:nth-child(9),
td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9) {
  text-align: right;
  width: var(--col-data-width);
  font-family: var(--font-mono);
}

td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9) {
  padding-right: 24px;
}

/* Cores para colunas de Reach */
th:nth-child(4),
th:nth-child(6),
th:nth-child(8),
td:nth-child(4),
td:nth-child(6),
td:nth-child(8) {
  color: var(--primary-color);
}

tr:nth-child(even) {
  background-color: var(--bg-light);
}

#rankingTable tr:hover td,
#rankingTable tr:hover th {
  background-color: var(--primary-hover);
}

#rankingTable2 tr:hover td,
#rankingTable2 tr:hover th {
  background-color: var(--primary-hover);
}

/* === RODAPÉ - INFORMAÇÕES COMPLEMENTARES === */
.rodape-info-complementar {
  margin: 0.4rem 3rem 0 3rem;
  padding: var(--spacing-lg) 4rem var(--spacing-xl) 4rem; /* maior afastamento lateral */
  font-size: 0.9rem;
  color: var(--text-secondary);
  background-color: var(--bg-footer);
  border-top: var(--border-width) solid var(--border-color);
}

/* === RODAPÉ === */
#rodape {
  width: 100%;
  box-sizing: border-box;
  background: var(--dark-blue);
  color: #fff;
  margin: 0;
  padding: 0;
  margin-top: var(--spacing-xxl);
}

.rodape-conteudo {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xxxl) 15px;
  font-size: var(--font-size-base);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rodape-bloco-esquerda,
.rodape-bloco-direita {
  display: flex;
  align-items: center;
}

.rodape-bloco-esquerda span {
  vertical-align: top;
  position: relative;
  top: 7px;
  color: #fff;
}

.logo-rodape-marktest {
  width: 150px;
  margin-right: var(--spacing-sm);
}

.logo-rodape-minerva {
  width: 200px;
}

/* === COLLAPSIBLE NOTE === */
.collapsible-note h3 {
  font-weight: bold;
  font-size: 1em;
  color: var(--primary-color);
}

.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--spacing-md);
}

.toggle-icon {
  width: 20px;
  height: 20px;
}

.collapsible-content {
  display: none;
  margin-top: var(--spacing-sm);
}

.collapsible-content.show {
  display: block;
}

.collapsible-content p {
  margin: 0.3em 0;
  margin-left: 1em;
  text-indent: 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .conteudo {
    margin: 0 var(--spacing-lg);
  }
  
  .topo-container {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .topo-esquerda,
  .topo-direita {
    width: 100%;
  }
  
  .info-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-lg);
  }
  
  #controles {
    width: 100%;
    justify-content: flex-start;
  }
  
  .rodape-conteudo {
    flex-direction: column;
    gap: var(--spacing-xl);
  }
}
