/* ── Map Widget — alinhado com o design da 42 Luanda ─────────────
   Usa as variáveis e fontes definidas em root.css
   Drop <div class="map-widget"> anywhere.
   Controla tamanho via CSS: .map-widget { height: 600px; }
──────────────────────────────────────────────────────────────── */

/* Variáveis locais do mapa (mapeadas para as cores do site) */
.map-widget {
  --map-bg:       #96a3eb;
  --map-surface:  rgba(255, 255, 255, 0.92);
  --map-border:   rgba(255,255,255,0.12);
  --map-accent:   #3AECDE;
  --map-text:     #030303;
  --map-muted:    #5a5a5a;
  --map-europe:   #00e5ff;
  --map-asia:     #ff9500;
  --map-africa:   #00e676;
  --map-america:  #ff3d71;
  --map-shadow:   3px 3px 1px #16f0e9;
}

/* ── Container ─────────────────────────────────────────────────── */
.map-widget {
  width: 100%;
  height: 600px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--map-text);
  font-family: "Space Mono", monospace;
  position: relative;
  background: var(--map-bg);
}

/* ── Header bar ────────────────────────────────────────────────── */
.map-widget .map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--map-border);
  background: var(--map-bg);
  z-index: 1000;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 10px;
  /* linha diagonal decorativa igual ao topbar */
  position: relative;
}

.map-widget .map-header::after {
  --cor: #16f0e9;
  --espessura: 3px;
  --passo: 16px;
  --ang: -63deg;
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 12px;
  background: repeating-linear-gradient(
    var(--ang),
    var(--cor) 0 calc(var(--espessura)),
    transparent calc(var(--espessura)) var(--passo)
  );
  pointer-events: none;
  z-index: 2;
}

/* ── Stats ─────────────────────────────────────────────────────── */
.map-widget .stats {
  display: flex;
  gap: 20px;
  font-size: 0.7rem;
  color: var(--map-muted);
  font-family: "Space Mono", monospace;
}

.map-widget .stat strong {
  display: block;
  font-size: 1.1rem;
  color: var(--map-accent);
  font-family: "Futura PT", sans-serif;
  font-weight: 900;
}

/* ── Filter buttons ────────────────────────────────────────────── */
.map-widget .filters {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.map-widget .filter-btn {
  background: transparent;
  border: 1px solid var(--map-border);
  color: var(--map-muted);
  font-family: "Space Mono", monospace;
  font-size: 0.6rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-widget .filter-btn:hover {
  border-color: var(--map-accent);
  color: var(--map-accent);
}

.map-widget .filter-btn.active {
  background: #6000BC;
  border-color: #6000BC;
  color: #fff;
  font-weight: bold;
  box-shadow: var(--map-shadow);
}

.map-widget .filter-btn.europe.active  { background: var(--map-europe);  border-color: var(--map-europe);  color: #000; box-shadow: 3px 3px 1px rgba(58,236,222,0.4); }
.map-widget .filter-btn.asia.active    { background: var(--map-asia);    border-color: var(--map-asia);    color: #fff; box-shadow: 3px 3px 1px rgba(122,77,255,0.4); }
.map-widget .filter-btn.africa.active  { background: var(--map-africa);  border-color: var(--map-africa);  color: #000; box-shadow: 3px 3px 1px rgba(50,239,219,0.4); }
.map-widget .filter-btn.america.active { background: var(--map-america); border-color: var(--map-america); color: #fff; box-shadow: 3px 3px 1px rgba(255,61,113,0.4); }

/* ── Map area ──────────────────────────────────────────────────── */
#map {
  flex: 1;
  width: 100%;
}

/* Leaflet — tema escuro alinhado com #1C1B20 */
.leaflet-container {
  background: #1C1B20 !important;
}

.leaflet-tile {
  filter: brightness(0.45) saturate(0.3) hue-rotate(200deg) invert(1) sepia(0.15);
}

/* Zoom controls */
.leaflet-control-zoom a {
  background: var(--map-bg) !important;
  color: var(--map-accent) !important;
  border-color: var(--map-border) !important;
  font-family: "Futura PT", sans-serif;
}

.leaflet-control-zoom a:hover {
  background: #6000BC !important;
  color: #fff !important;
}

/* Attribution */
.leaflet-control-attribution {
  background: rgba(28,27,32,0.85) !important;
  color: var(--map-muted) !important;
  font-size: 0.55rem !important;
}

.leaflet-control-attribution a {
  color: var(--map-accent) !important;
}

/* ── Popup ─────────────────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  background: var(--map-bg);
  border: 1px solid var(--map-border);
  border-radius: 0;
  box-shadow: 3px 3px 1px #16f0e9;
  padding: 0;
}

.leaflet-popup-tip-container { display: none; }
.leaflet-popup-content { margin: 0; }

.popup-inner {
  padding: 14px 18px;
  min-width: 200px;
}

.popup-region {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 5px;
  font-family: "Space Mono", monospace;
}

.popup-title {
  font-family: "Futura PT", sans-serif;
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--map-text);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.popup-address {
  font-size: 0.62rem;
  color: var(--map-muted);
  line-height: 1.6;
  margin-bottom: 12px;
  border-left: 2px solid var(--map-accent);
  padding-left: 8px;
  font-family: "Space Mono", monospace;
}

.popup-link {
  display: inline-block;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--map-accent);
  text-decoration: none;
  border-bottom: 1px solid var(--map-accent);
  padding-bottom: 1px;
  font-family: "Space Mono", monospace;
}

.popup-link:hover { opacity: 0.7; }

/* ── Legend ────────────────────────────────────────────────────── */
.map-widget .legend {
  position: absolute;
  bottom: 20px;
  left: 16px;
  background: var(--map-surface);
  border: 1px solid var(--map-border);
  padding: 10px 14px;
  z-index: 1000;
  font-size: 0.62rem;
  color: var(--map-muted);
  backdrop-filter: blur(4px);
}

.map-widget .legend-title {
  font-family: "Futura PT", sans-serif;
  font-weight: 900;
  color: var(--map-text);
  margin-bottom: 8px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.map-widget .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-family: "Space Mono", monospace;
}

.map-widget .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Search ────────────────────────────────────────────────────── */
.map-widget .search-container {
  position: absolute;
  top: 52px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: 280px;
}

@media(max-width: 540px) {
  .map-widget .search-container {
    top: 120px;
  }
}

.map-widget #search {
  width: 100%;
  background: var(--map-surface);
  border: 1px solid var(--map-border);
  color: var(--map-text);
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  padding: 9px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  backdrop-filter: blur(4px);
}

.map-widget #search::placeholder { color: var(--map-muted); }

.map-widget #search:focus {
  border-color: var(--map-accent);
  box-shadow: 0 0 0 2px rgba(58,236,222,0.15);
}

.map-widget .search-results {
  background: var(--map-bg);
  border: 1px solid var(--map-border);
  border-top: none;
  max-height: 200px;
  overflow-y: auto;
  display: none;
}

.map-widget .search-result-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.68rem;
  border-bottom: 1px solid var(--map-border);
  transition: background 0.15s;
  font-family: "Space Mono", monospace;
}

.map-widget .search-result-item:hover {
  background: rgba(58,236,222,0.08);
  color: var(--map-accent);
}

.map-widget .search-result-item .country {
  font-size: 0.58rem;
  color: var(--map-muted);
}

/* ── Counter badge ─────────────────────────────────────────────── */
.map-widget .counter {
  position: absolute;
  top: 52px;
  right: 16px;
  background: var(--map-surface);
  border: 1px solid var(--map-border);
  padding: 7px 12px;
  z-index: 1000;
  font-size: 0.6rem;
  color: var(--map-muted);
  font-family: "Space Mono", monospace;
  backdrop-filter: blur(4px);
}

.map-widget .counter strong {
  color: var(--map-accent);
  font-family: "Futura PT", sans-serif;
  font-weight: 900;
  font-size: 1rem;
}
