/* =====================================================================
   SIMURBAN v0.9.40 — Sistema de ícones SVG + polimento da interface
   Carregado POR ÚLTIMO de propósito: precisa vencer as regras
   `!important` herdados de uma versão anterior (font-family Arial e
   content:none) e que apagavam os ícones.
   ===================================================================== */

:root {
  --ico-size: 20px;
  --ico-stroke: 1.8;
  --ui-accent: #8fd36b;
  --ui-accent-soft: rgba(143, 211, 107, .18);
  --ui-danger: #e76d6d;
  --ui-radius: 11px;
}

/* ---------------------------------------------------------------------
   1. Base do ícone
   --------------------------------------------------------------------- */
.ui-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--ico-size);
  height: var(--ico-size);
  color: inherit;
  pointer-events: none;
  /* Neutraliza o Arial forçado herdado — SVG não usa fonte, mas o
     reset evita herdar métricas estranhas em textos irmãos. */
  font-family: inherit;
  line-height: 0;
}

.ui-ico svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
  fill: none;
  vector-effect: non-scaling-stroke;
  overflow: visible;
}

.ui-ico svg [fill="currentColor"] { fill: currentColor; }

/* ---------------------------------------------------------------------
   2. Desfaz conflitos de estilos legados
   --------------------------------------------------------------------- */
body.city-mode #bottombar .tool-ico,
body.city-mode #tnInfoDock .tn-info-tool span {
  font-family: inherit !important;
  font-weight: inherit !important;
  letter-spacing: normal !important;
  font-size: 0 !important;          /* esconde texto residual, o SVG tem tamanho próprio */
  color: inherit !important;
}

body.city-mode #tnInfoDock .tn-info-tool::before {
  content: none !important;          /* mantido: agora o ícone é SVG real, não pseudo-elemento */
}

/* ---------------------------------------------------------------------
   3. Barra inferior de ferramentas
   --------------------------------------------------------------------- */
.classic-bottombar .tool-cluster button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  position: relative;
  transition: background .14s ease, border-color .14s ease,
              transform .14s ease, box-shadow .14s ease;
}

body.city-mode #bottombar .tool-ico,
.classic-bottombar .tool-ico {
  width: 21px !important;
  height: 21px !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: #cfe6c2;
  transition: color .14s ease, transform .14s ease;
}

.classic-bottombar .tool-cluster button:hover .tool-ico { color: #eafbe0; transform: translateY(-1px); }
.classic-bottombar .tool-cluster button.active .tool-ico { color: #ffffff; }

.classic-bottombar .tool-cluster button.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 14px;
  height: 2px;
  border-radius: 2px;
  background: var(--ui-accent);
  transform: translateX(-50%);
  box-shadow: 0 0 8px rgba(143, 211, 107, .6);
}

.classic-bottombar .tool-cluster button[data-tool="demolish"]:hover .tool-ico { color: #ffb3b3; }
.classic-bottombar .tool-cluster button[data-tool="demolish"].active { border-color: rgba(231, 109, 109, .45) !important; }
.classic-bottombar .tool-cluster button[data-tool="demolish"].active::after { background: var(--ui-danger); box-shadow: 0 0 8px rgba(231, 109, 109, .6); }

/* Cluster de velocidade: ícones + rótulo curto */
.speed-cluster .compact-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.speed-cluster .ui-ico { width: 15px; height: 15px; }
#pauseGame .ui-ico { width: 14px; height: 14px; }
#dayNightToggle .ui-ico { width: 15px; height: 15px; color: #e8c574; }
#dayNightToggle:not(.active) .ui-ico { color: #93a7c9; }

/* ---------------------------------------------------------------------
   4. Dock lateral de relatórios
   --------------------------------------------------------------------- */
body.city-mode #tnInfoDock .tn-info-tool {
  color: #cfe0d6 !important;
  font-size: 0 !important;
  transition: background .14s ease, color .14s ease, transform .14s ease !important;
}
body.city-mode #tnInfoDock .tn-info-tool .ui-ico {
  width: 19px !important;
  height: 19px !important;
  font-size: 0 !important;
}
body.city-mode #tnInfoDock .tn-info-tool:hover { color: #f0fbea !important; }
body.city-mode #tnInfoDock .tn-info-tool.active { color: #ffffff !important; }

/* Tooltip própria: o title nativo demora ~1s e some no Linux */
.tn-info-tool { position: relative; }
.tn-info-tool::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 9px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(8, 14, 15, .96);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #e6f2ea;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .13s ease, transform .13s ease;
  z-index: 900;
}
.tn-info-tool:hover::after { opacity: 1; transform: translateY(-50%) translateX(0); }

/* ---------------------------------------------------------------------
   5. Botões utilitários (fechar, menu, minimapa, hamburger)
   --------------------------------------------------------------------- */
.tool-panel-close,
.info-panel-close,
#transitCloseFleet,
.hamb-top {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0 !important;
  color: #dce8e2;
  transition: background .13s ease, border-color .13s ease, color .13s ease;
}
.tool-panel-close .ui-ico,
.info-panel-close .ui-ico,
#transitCloseFleet .ui-ico { width: 14px; height: 14px; }
.hamb-top .ui-ico { width: 17px; height: 17px; }

.tool-panel-close:hover,
.info-panel-close:hover,
#transitCloseFleet:hover { color: #ffd2d2; }
.hamb-top:hover { color: #eafbe0; }

.tool-empty-icon {
  display: grid !important;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto 10px !important;
  border-radius: 13px;
  border: 1px dashed rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .035);
  color: #8fa79b;
  font-size: 0 !important;
}
.tool-empty-icon .ui-ico { width: 20px; height: 20px; }

/* Minimapa: ícone + texto, alinhados */
.tn-minimap-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background .13s ease, color .13s ease;
}
.tn-minimap-actions .ui-ico { width: 13px; height: 13px; opacity: .92; }
.tn-minimap-actions button.active .ui-ico { color: var(--ui-accent); opacity: 1; }

/* Menu hamburger: ícone + rótulo */
.classic-menu > button {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
}
.classic-menu > button .ui-ico { width: 15px; height: 15px; opacity: .85; }
.classic-menu > button:hover .ui-ico { opacity: 1; color: var(--ui-accent); }
.classic-menu #clearCity:hover .ui-ico { color: var(--ui-danger); }
.menu-seed-row button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.menu-seed-row button .ui-ico { width: 13px; height: 13px; }

/* Badge de eventos na topbar */
#hudEvents { display: inline-flex; align-items: center; gap: 6px; }
#hudEvents .ui-ico { width: 13px; height: 13px; opacity: .9; }

/* ---------------------------------------------------------------------
   6. Botões de opção com ícone (zonas, terreno, transporte)
   --------------------------------------------------------------------- */
.zone-buttons button,
.terrain-mode-grid button,
.transit-mode-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.zone-buttons .ui-ico,
.terrain-mode-grid .ui-ico,
.transit-mode-row .ui-ico { width: 14px; height: 14px; opacity: .88; }
.zone-buttons button.active .ui-ico,
.terrain-mode-grid button.active .ui-ico,
.transit-mode-row button.active .ui-ico { opacity: 1; }

.zone-buttons button[data-zone-type="residential"] .ui-ico { color: #7fce80; }
.zone-buttons button[data-zone-type="mixed"] .ui-ico { color: #9b59c7; }
.zone-buttons button[data-zone-type="commercial"] .ui-ico { color: #6cb6e6; }
.zone-buttons button[data-zone-type="favela"] .ui-ico { color: #9a6336; }
.zone-buttons button[data-zone-type="industrial"] .ui-ico { color: #e2b160; }
.zone-buttons button[data-zone-type="erase"] .ui-ico { color: #dd8f8f; }
#zoneGridToggle { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#zoneGridToggle .ui-ico { width: 13px; height: 13px; }

.transit-actions-main button,
#transitOpenFleet,
#vehiclesOpenFleet,
#transitFinishLine,
#transitCancelLine {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.transit-actions-main .ui-ico,
#transitOpenFleet .ui-ico,
#vehiclesOpenFleet .ui-ico,
#transitFinishLine .ui-ico,
#transitCancelLine .ui-ico { width: 13px; height: 13px; opacity: .9; }
#transitDeleteLine:hover .ui-ico,
#transitCancelLine:hover .ui-ico { color: var(--ui-danger); }

/* Botão "Localizar" do inspetor (criado dinamicamente pelo Game.js) */
.sim-inspect-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sim-inspect-actions .ui-ico { width: 13px; height: 13px; }

/* ---------------------------------------------------------------------
   7. Acessibilidade e responsividade
   --------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .ui-ico,
  .classic-bottombar .tool-cluster button,
  .tn-info-tool::after { transition: none !important; }
}

/* Notebook 1366x768 */
@media (max-width: 1366px) {
  body.city-mode #bottombar .tool-ico,
  .classic-bottombar .tool-ico { width: 19px !important; height: 19px !important; }
  body.city-mode #tnInfoDock .tn-info-tool .ui-ico { width: 18px !important; height: 18px !important; }
}

/* Telas estreitas: some o rótulo, fica só o ícone (por isso o title/tooltip importa) */
@media (max-width: 980px) {
  .classic-bottombar .tool-label { display: none; }
  body.city-mode #bottombar .tool-ico,
  .classic-bottombar .tool-ico { width: 22px !important; height: 22px !important; }
  .classic-bottombar .tool-cluster button { min-width: 46px; }
}

@media (max-width: 720px) {
  .tn-info-tool::after { display: none; }  /* sem hover em touch */
  .tn-minimap-actions button { gap: 0; }
  .tn-minimap-actions .ui-ico { width: 14px; height: 14px; }
}

/* Toque: alvo mínimo confortável */
@media (pointer: coarse) {
  .classic-bottombar .tool-cluster button { min-height: 48px; }
  .tool-panel-close,
  .info-panel-close,
  #transitCloseFleet { min-width: 32px; min-height: 32px; }
}
