/* Mapa de Local dos Ganhadores (Leaflet choropleth) — integrado ao design system de diadesorte-resultado.css */

.wmap-controls-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: nowrap;
  max-width: 100%;
}

#limit-input {
  flex: 0 0 140px;
  height: 44px;
  padding: 0 12px;
  margin: 0;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-size: 1rem;
  font-family: var(--font-outfit);
  box-sizing: border-box;
}

#limit-apply {
  flex: 0 0 auto;
  width: auto;
  height: 44px;
  padding: 0 24px;
  margin: 0;
  border: none;
  cursor: pointer;
  font-family: var(--font-outfit);
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#limit-apply:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .wmap-controls-row {
    flex-wrap: wrap;
  }
  #limit-input {
    flex: 1 1 auto;
  }
  #limit-apply {
    flex: 1 1 100%;
    justify-content: center;
  }
}

.wmap-error {
  display: block;
  color: #dc2626;
  font-size: 0.85rem;
  margin-top: 8px;
  min-height: 1em;
}

.wmap-grid {
  align-items: stretch;
  max-width: 100%;
}

/* Itens de grid têm min-width:auto por padrão, o que deixa o conteúdo (mapa)
   forçar a largura além do container disponível. Sem isso a página ganha
   scroll horizontal, principalmente no mobile. */
.wmap-grid > * {
  min-width: 0;
}

.wmap-map-card,
.wmap-panel {
  display: flex;
  flex-direction: column;
  max-width: 100%;
  box-sizing: border-box;
}

.wmap-map {
  width: 100%;
  max-width: 100%;
  height: 620px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-light);
  box-sizing: border-box;
}

.wmap-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.panel-tab {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-light);
  background: var(--bg-light);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-outfit);
  outline: none;
}

.panel-tab:hover {
  background: var(--bg-light);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.panel-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.panel-tab.active:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.wmap-panel-info {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.wmap-panel-info .info-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.wmap-panel-info .info-sub,
.wmap-panel-info .info-data {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.wmap-panel-info .info-state {
  font-weight: 700;
  color: var(--accent-dark);
  margin-top: 6px;
}

.legend-title {
  font-size: 0.9rem;
  margin: 0 0 10px;
  color: var(--text-main);
  font-weight: 700;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.legend-item .color-box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex: 0 0 14px;
  display: inline-block;
  border: 1px solid rgba(0,0,0,0.06);
}

.legend-range {
  color: #9ca3af;
}

.wmap-state-list {
  max-height: 320px;
  overflow-y: auto;
}

.state-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.85rem;
}

.state-item .state-name {
  color: var(--text-main);
  font-weight: 600;
}

.state-item .state-winners {
  color: var(--text-muted);
  white-space: nowrap;
}

.wmap-contest-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.wmap-contest-filter label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

#contest-sort {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: var(--font-outfit);
  color: var(--text-main);
  background: #ffffff;
  box-sizing: border-box;
}

#contest-sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wmap-contest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wmap-contest-list.scroll {
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.contest-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
  flex-wrap: wrap;
}

.contest-item:hover {
  border-color: var(--accent);
}

.contest-left {
  color: var(--text-main);
}

.contest-winners {
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.82rem;
  background: #fffbeb;
  border: 1px solid rgba(250, 204, 21, 0.5);
  padding: 3px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.contest-right {
  color: var(--primary-green);
  font-weight: 800;
  white-space: nowrap;
  margin-left: auto;
}

/* Leaflet controls customizados (info / legenda do canal eletrônico) */
.wmap-map .info {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  font-size: 0.82rem;
  color: var(--text-main);
  font-family: var(--font-outfit);
}

.wmap-map .channel-legend {
  margin-top: 8px;
}

.wmap-stats-summary {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.wmap-stats-note {
  margin: 16px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 14px;
}

@media (max-width: 960px) {
  .wmap-map {
    height: 80vw;
    min-height: 320px;
    max-height: 480px;
    aspect-ratio: 4 / 3;
  }
}

@media (max-width: 480px) {
  .wmap-map {
    height: 88vw;
    min-height: 300px;
    max-height: 420px;
  }
}
