/* Paleta extraída do manual de marca CITmax */
:root {
  --cit-deep: #036271;
  --cit-teal: #008a86;
  --cit-mint: #00c896;
  --cit-ink: #211e1f;
  --cit-mist: #d9e0e9;
  --cit-white: #ffffff;
  --muted: #5d6b72;
  --border: #c9d3dc;
  --ok: #00a67e;
  --no: #c2412d;
  --shadow: 0 6px 24px rgba(3, 98, 113, 0.18);
  --radius: 14px;
  --font: 'Montserrat', 'Segoe UI', Roboto, Arial, sans-serif;
  /* cores da tecnologia ativa (atualizadas via JS) */
  --tech-indoor: #036271;
  --tech-outdoor: #7fb5bd;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  color: var(--cit-ink);
  background: var(--cit-mist);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
#map { position: fixed; inset: 0; background: var(--cit-mist); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.card {
  position: fixed;
  z-index: 1000;
  background: var(--cit-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Busca ---------- */
#search-card { top: 16px; left: 16px; width: 420px; padding: 16px 16px 12px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.logo { height: 30px; width: auto; }
.brand-title {
  font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--cit-teal); border-left: 2px solid var(--cit-mint); padding-left: 12px;
}
#search-form {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}
#search-form:focus-within { border-color: var(--cit-teal); box-shadow: 0 0 0 3px rgba(0, 200, 150, .2); }
#search-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: 500 16px var(--font); color: var(--cit-ink); padding: 13px 14px;
}
#search-input::placeholder { color: #8a979e; }
#search-button {
  border: 0; background: var(--cit-teal); color: #fff; cursor: pointer;
  width: 46px; height: 46px; margin: -1.5px; border-radius: 0 10px 10px 0;
  display: grid; place-items: center; transition: background .2s;
}
#search-button:hover { background: var(--cit-deep); }
#search-button svg { width: 20px; height: 20px; fill: currentColor; }

.results { list-style: none; margin-top: 8px; max-height: 260px; overflow: auto; }
.results li button {
  width: 100%; text-align: left; border: 0; background: none; cursor: pointer;
  font: 500 14px/1.35 var(--font); color: var(--cit-ink);
  padding: 10px 8px; border-top: 1px solid #eef2f5;
}
.results li:first-child button { border-top: 0; }
.results li button:hover, .results li button:focus-visible { background: #eef8f5; outline: 0; color: var(--cit-deep); }
.search-message { margin-top: 8px; font-size: 14px; color: var(--no); }

.geo-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  border: 0; background: none; cursor: pointer; padding: 4px 2px;
  font: 600 14px var(--font); color: var(--cit-teal);
}
.geo-btn:hover { color: var(--cit-deep); }
.geo-btn:focus-visible { outline: 3px solid rgba(0, 200, 150, .45); outline-offset: 2px; border-radius: 6px; }
.geo-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ---------- Painel de cobertura ---------- */
#coverage-box { left: 16px; bottom: 24px; width: 420px; padding: 18px 18px 16px; }
#coverage-box h2 { font-size: 16px; font-weight: 700; color: var(--cit-deep); margin-bottom: 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.tech-btn {
  height: 44px; min-width: 60px; padding: 0 16px;
  border: 1.5px solid var(--border); border-radius: 10px; background: #fff;
  font: 800 18px var(--font); color: #7d8b92; cursor: pointer;
  transition: all .25s cubic-bezier(.6, 0, .1, 1);
}
.tech-btn:hover { border-color: var(--cit-teal); color: var(--cit-teal); }
.tech-btn:focus-visible { outline: 3px solid rgba(0, 200, 150, .45); outline-offset: 2px; }
.tech-btn.active { background: var(--cit-deep); border-color: var(--cit-deep); color: #fff; }
.more-btn { font-size: 14px; font-weight: 700; }
.general-btn { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.general-btn.active { background: var(--cit-teal); border-color: var(--cit-teal); }

.legend { display: flex; gap: 20px; margin-top: 16px; font-size: 15px; font-weight: 600; color: #3b4a50; }
.legend span { display: inline-flex; align-items: center; }
.legend i { width: 16px; height: 16px; border-radius: 4px; margin-right: 8px; display: inline-block; }
#legend-indoor { background: var(--tech-indoor); }
#legend-outdoor { background: var(--tech-outdoor); }

/* Escala de força do sinal (visão Geral) */
.legend-general { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.legend-scale-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend-scale { display: inline-flex; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.legend-scale i { width: 26px; height: 15px; margin: 0; border-radius: 0; display: block; }
.legend-scale-caption { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.legend-basic { display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: #3b4a50; }
.legend-basic i { width: 16px; height: 16px; border-radius: 4px; margin-right: 8px; display: inline-block; }

.zoom-hint { margin-top: 12px; font-size: 13px; color: var(--muted); }
.config-warning {
  margin-top: 12px; font-size: 13px; line-height: 1.4; color: #7a4a00;
  background: #fff6e0; border: 1px solid #f3d38a; border-radius: 8px; padding: 8px 10px;
}

/* ---------- Resultado ---------- */
.info-card { position: relative; border-bottom: 1px solid #e3e9ee; padding: 0 0 14px; margin-bottom: 14px; }
.info-close {
  position: absolute; top: -8px; right: -6px; width: 30px; height: 30px; border: 0; background: none;
  font-size: 22px; line-height: 1; color: #8a979e; cursor: pointer; border-radius: 50%;
}
.info-close:hover { background: #eef2f5; color: var(--cit-ink); }
.info-address { font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--cit-ink); padding-right: 26px; }
.info-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 8px 14px; align-items: center; margin-top: 12px; }
.info-grid .head { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.info-grid .head:first-child { text-align: left; }
.info-grid .tech { font-size: 17px; font-weight: 800; }
.info-grid .tech.is-active { text-decoration: underline; text-decoration-color: var(--cit-mint); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.status { justify-self: center; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; }
.status svg { width: 16px; height: 16px; }
.status.yes { background: #dff6ee; color: var(--ok); }
.status.no { background: #fbe7e3; color: var(--no); }
.status.na { color: #aab4ba; font-weight: 700; }
.info-summary { margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--cit-deep); }
.info-error { margin-top: 10px; font-size: 14px; color: var(--no); }
.info-share {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  border: 1.5px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer;
  padding: 8px 12px; font: 600 13px var(--font); color: var(--cit-teal); transition: all .2s;
}
.info-share:hover { border-color: var(--cit-teal); background: #eef8f5; color: var(--cit-deep); }
.info-share:focus-visible { outline: 3px solid rgba(0, 200, 150, .45); outline-offset: 2px; }
.info-share svg { width: 15px; height: 15px; fill: currentColor; }

/* ---------- Marcador ---------- */
.cit-pin-wrap { position: relative; width: 40px; height: 50px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.cit-pin-drop { display: block; }
.cit-pin-img { position: absolute; top: 8px; left: 8px; width: 24px; height: 24px; }

/* ---------- Loader ---------- */
.loader { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; background: rgba(255, 255, 255, .35); }
.loader span {
  width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--cit-mist); border-top-color: var(--cit-mint);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Leaflet */
.leaflet-control-zoom a { color: var(--cit-deep) !important; }
.leaflet-control-attribution { font-family: var(--font); }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  /* Busca ocupa a largura, respeitando o entalhe do topo */
  #search-card {
    top: calc(8px + env(safe-area-inset-top)); left: 10px; right: 10px; width: auto; padding: 12px 12px 10px;
  }
  .logo { height: 24px; }
  .brand { margin-bottom: 10px; }
  .results { max-height: 42vh; }

  /* Painel de cobertura vira uma folha inferior, com rolagem e área segura */
  #coverage-box {
    left: 0; right: 0; bottom: 0; width: auto;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
    max-height: 72vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  #coverage-box h2 { font-size: 15px; }
  .controls { gap: 7px; }
  .tech-btn { height: 44px; font-size: 16px; padding: 0 14px; min-width: 54px; }
  .more-btn, .general-btn { font-size: 14px; }
  .legend { gap: 14px; font-size: 14px; }
  .info-grid { column-gap: 10px; }
  .info-share { width: 100%; justify-content: center; padding: 11px 12px; }
  .geo-btn { padding: 8px 2px; } /* alvo de toque maior */

  /* Zoom por pinça no celular: esconde os botões +/- para sobrar mapa */
  .leaflet-control-zoom { display: none; }
  .leaflet-control-attribution { font-size: 10px; }
}

/* Telas muito estreitas: botões um pouco menores para não quebrar a linha */
@media (max-width: 360px) {
  .tech-btn { padding: 0 11px; min-width: 48px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation-duration: 2s !important; }
}
