/* ==========================================================================
   ESTILOS CONFIGURAÇÃO DIRETAS DO MAIN.CSS (ORIGINAL)
   ========================================================================== */

#user-counter {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: auto;
    top: auto;
    font-size: 13px;
    white-space: nowrap;
}

.user-number {
    color: #1e7e34;
    font-weight: bold;
}

.community-number {
    color: #0d6efd;
    font-weight: bold;
}

/* Tutorial warning */
#warning-box {
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    background: rgba(255, 255, 255, 0.92);
    padding: 4px 8px;
    border-radius: 6px;
    box-shadow: 0 0 4px rgba(0,0,0,.2);
    font-size: 15px;
    line-height: 1.2;
    max-width: 85%;
    text-align: center;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: Arial, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
}

/*
 * IMPORTANT:
 * Adjust this value if osm_render_header()
 * is taller or shorter.
 */
#container {
    position: absolute;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;

    display: flex;
    overflow: hidden;
}

/* SIDEBAR */

#sidebar {
    width: 360px;
    padding: 10px;
    border-right: 1px solid #ccc;
    background: #fafafa;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    position: relative; /* Adicionado para a sobreposição interna do validador */
}

#loadData {
    width: 100%;
    padding: 8px;
    font-size: 15px;
    margin-bottom: 10px;
}

.filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.filter-box {
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 6px;
    background: #fff;
}

.filter-title {
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 6px;
}

/* MAP */

#map-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

/* OVERLAYS */

.map-box {
    position: absolute;
    z-index: 1000;
    background: #fff;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 0 6px rgba(0,0,0,.3);
    font-size: 14px;
}

#toggle-box {
    top: 10px;
    right: 10px;
}

#legend {
    bottom: 10px;
    right: 10px;
}

/* MESSAGE */

#message {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    display: none;
}

/* STATS */

#stats {
    margin-top: 6px;
    width: 100%;
    font-size: 13px;
    border-collapse: collapse;
}

#stats td {
    padding: 4px;
    border: 1px solid #ccc;
}

/* CITY SELECT */

#citySelect {
    width: 100%;
    box-sizing: border-box;
}

/* COLLAPSIBLE FILTER SECTION */

.filter-collapse-title {
    cursor: pointer;
    font-weight: bold;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    margin-bottom: 8px;
}

.filter-collapse-content {
    display: none;
    margin-bottom: 10px;
}

.filter-collapse-content.open {
    display: block;
}


/* ==========================================================================
   COMPONENTES DO VALIDADOR LATERAL (MIGRADO DO INDEX.PHP)
   ========================================================================== */

.validator-container { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: white; 
    padding: 20px 15px; 
    box-sizing: border-box;
    z-index: 999; 
    overflow-y: auto; 
    border-right: 1px solid #ccc;
    transition: border-left 0.2s ease, box-shadow 0.2s ease;
}

.close-validator {
    position: absolute; 
    top: 12px; 
    right: 15px; 
    font-size: 22px;
    font-weight: bold; 
    cursor: pointer; 
    color: #666; 
    user-select: none; 
    line-height: 1;
    z-index: 1000;
}
.close-validator:hover { 
    color: #ff0000; 
}

.decision-box { 
    margin-bottom: 20px; 
}

.option-group {
    margin-bottom: 8px; 
    display: flex; 
    align-items: flex-start; 
    cursor: pointer;
    padding: 6px; 
    border-radius: 6px; 
    transition: background 0.2s; 
    font-size: 0.9rem;
}
.option-group:hover { 
    background: #f5f5f5; 
}
.option-group input { 
    margin-top: 3px; 
    margin-right: 10px; 
}

.action-area { 
    border-top: 2px dashed #e0e0e0; 
    padding-top: 15px; 
    margin-top: 15px; 
}
.instruction { 
    font-size: 0.82rem; 
    color: #444; 
    margin-bottom: 12px; 
    line-height: 1.4; 
    background: #fdf6ec;
    padding: 10px;
    border-left: 3px solid #e67e22;
    border-radius: 4px;
}

.validator-container input[type="text"] { 
    width: 100%; 
    padding: 8px 10px; 
    border: 1px solid #ccc; 
    border-radius: 6px;
    box-sizing: border-box; 
    margin-bottom: 12px; 
    font-size: 0.95rem;
}
.validator-container input[type="text"]:focus { 
    border-color: #0076ff; 
    outline: none; 
}

/* Botões de Ação */
.btn { 
    display: inline-block; 
    width: 100%; 
    padding: 10px 15px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    color: white; 
    font-weight: bold; 
    font-size: 0.95rem; 
    text-align: center;
    transition: background 0.2s; 
    margin-bottom: 8px;
}
.btn-osm { background-color: #7fc857; } 
.btn-osm:hover { background-color: #6bab4a; }
.btn-save { background-color: #0076ff; } 
.btn-save:hover { background-color: #0056cc; }
.btn-secondary { background-color: #6c757d; } 
.btn-secondary:hover { background-color: #5a6268; }
.btn-resolve { background-color: #e67e22; margin-top: 8px; border: 2px solid #d35400; color: white;}
.btn-resolve:hover { background-color: #d35400; }

.suggestion-link {
    display: inline-block;
    font-size: 0.8rem;
    color: #0076ff;
    text-decoration: underline;
    cursor: pointer;
    user-select: none;
}
.suggestion-link:hover {
    color: #0056cc;
}
.suggestion-link.current-link {
    color: #222;
    font-weight: bold;
    text-decoration: none;
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid #ddd;
}
.suggestion-link.current-link:hover {
    background: #e5e5e5;
}

.btn-compact {
    padding: 7px 10px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    margin-bottom: 4px !important;
    border-radius: 4px !important;
}

.editor-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: #555;
    font-size: 0.72rem;
    font-weight: 600;
    background: #fdfdfd;
    padding: 3px 6px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.editor-icon-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #222;
}
.editor-icon-img {
    width: 12px;
    height: 12px;
    object-fit: contain;
}

.hidden { display: none !important; }

/* --- Efeito de Cintilação --- */
.cintilar {
    animation: flash_lateral 0.8s ease-out;
}

@keyframes flash_lateral {
    0% { background-color: #ffffff; box-shadow: inset 0 0 0px #0076ff; }
    30% { background-color: #e3f2fd; box-shadow: inset 0 0 25px rgba(0, 118, 255, 0.4); }
    100% { background-color: #ffffff; box-shadow: inset 0 0 0px #0076ff; }
}

/* ==========================================================================
     ESTILIZAÇÃO DO LOADER CARTOGRÁFICO GLOBAL BÚSSOLA
     ========================================================================== */
#map-loader-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(30, 41, 59, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 2147483647 !important;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.2s ease;
}

.loader-card {
    background: #ffffff;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
    text-align: center;
    max-width: 320px;
    border: 1px solid #e2e8f0;
}

.loader-card h3 {
    margin: 15px 0 6px 0;
    color: #1e293b;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: system-ui, -apple-system, sans-serif;
}

.loader-card p {
    margin: 0;
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.4;
    font-family: system-ui, -apple-system, sans-serif;
}

.compass-loader {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto;
}

.compass-dial {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid #3388ff;
    border-radius: 50%;
    box-sizing: border-box;
}

.compass-dial::before {
    content: '';
    position: absolute;
    top: 2px; left: 50%;
    width: 2px; height: 6px;
    background: #3388ff;
    transform: translateX(-50%);
}

.compass-needle {
    position: absolute;
    top: 10%; left: 50%;
    width: 4px; height: 80%;
    background: linear-gradient(to bottom, #ef4444 50%, #cbd5e1 50%);
    transform-origin: 50% 50%;
    animation: rotateNeedle 1.6s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
    border-radius: 2px;
}

@keyframes rotateNeedle {
    0% { transform: translateX(-50%) rotate(0deg); }
    50% { transform: translateX(-50%) rotate(180deg); }
    100% { transform: translateX(-50%) rotate(360deg); }
}

/* ==========================================================================
   PAINEL FLUTUANTE DE EDIÇÕES RECENTES (VERDE TRANSLÚCIDO E DISCRETO)
   ========================================================================== */
#live-editions-panel {
    position: absolute;
    top: 120px; /* Movido mais para baixo */
    right: 10px;
    z-index: 1000;
    background: rgba(46, 204, 113, 0.65); /* Mais transparente/discreto (de 0.85 para 0.65) */
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.8rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(3px);
    pointer-events: none;
    max-width: 240px;
    line-height: 1.4;
    opacity: 0; /* Começa invisível para a transição funcionar */
    transition: opacity 0.5s ease, transform 0.5s ease;
    transform: translateY(-10px);
}

/* Classe de controle para exibir com transição suave */
#live-editions-panel.mostrar {
    opacity: 1;
    transform: translateY(0);
}

.pulse-green {
    animation: pulse-green-glow 2s infinite;
}

@keyframes pulse-green-glow {
    0% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

#live-editions-panel ul {
    margin: 4px 0 0 0;
    padding-left: 15px;
}
#live-editions-panel li {
    margin-bottom: 2px;
}

/* Definições essenciais para o funcionamento do Modal Avançado */
.modal-advanced {
    display: none; 
    position: fixed; 
    z-index: 10000; /* Deve ser maior que o z-index do Leaflet (geralmente 1000 ou 4000) */
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

/* Esta classe é injetada pelo JavaScript */
.modal-advanced.show {
    display: flex;
}

.modal-advanced-content {
    background: #ffffff; 
    padding: 25px; 
    border-radius: 8px; 
    width: 90%; 
    max-width: 600px; 
    max-height: 85vh; 
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    color: #333333;
}

.modal-advanced-close {
    position: absolute; 
    top: 15px; 
    right: 15px; 
    font-size: 24px; 
    cursor: pointer; 
    font-weight: bold;
    color: #666;
}

.advanced-city-row {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 0; 
    border-bottom: 1px solid #eeeeee;
}

/* ======================================================================
   DESTAQUE PARA O MANUAL DE USO
  ======================================================================= */
/* Container do link */
.vortex-container {
  position: relative;
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
}

/* O Vórtice de Luz */
.vortex-container::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  /* Tamanho inicial grande para o efeito de "recair" */
  width: 300px;
  height: 300px;
  margin-top: -150px;
  margin-left: -150px;
  
  /* Gradiente que simula feixes de luz em redemoinho */
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    rgba(0, 140, 255, 0.1) 15%,
    rgba(0, 191, 255, 0.7) 30%,
    rgba(255, 255, 255, 0.9) 45%,
    rgba(0, 191, 255, 0.7) 60%,
    transparent 70%,
    transparent 100%
  );
  
  /* Máscara radial para parecer um feixe circular/difuso */
  mask: radial-gradient(circle, white 10%, transparent 60%);
  -webkit-mask: radial-gradient(circle, white 10%, transparent 60%);
  
  border-radius: 50%;
  pointer-events: none; /* Não bloqueia o clique no link */
  opacity: 0;
  
  /* Executa a animação ao carregar */
  animation: vortex-animation 5.0s ease-out forwards;
}

/* Animação do Vórtice */
@keyframes vortex-animation {
  0% {
    transform: scale(2) rotate(0deg);
    opacity: 0;
    filter: blur(4px);
  }
  15% {
    opacity: 1;
  }
  /* O ápice do redemoinho girando e contraindo em direção ao texto */
  60% {
    transform: scale(0.4) rotate(720deg);
    opacity: 1;
    filter: blur(1px);
  }
  /* O feixe se consolida num brilho rápido e some */
  85% {
    transform: scale(0.2) rotate(1080deg);
    opacity: 0.8;
    background: white; /* Flash final de luz */
  }
  100% {
    transform: scale(0) rotate(1440deg);
    opacity: 0;
  }
}

/* Bônus: Um leve pulsar no próprio texto após o impacto do vórtice */
.vortex-container a {
  display: inline-block;
  animation: text-glow 2.5s ease-out;
}

@keyframes text-glow {
  0%, 50% {
    text-shadow: none;
  }
  60% {
    text-shadow: 0 0 15px #00bfff, 0 0 25px #00bfff;
    transform: scale(1.05);
  }
  100% {
    text-shadow: none;
    transform: scale(1);
  }
}

/* ==========================================================================
   FORÇAR VISIBILIDADE DE GEOMETRIAS À DISTÂNCIA (ZOOM OUT)
   ========================================================================== */

/* Aplica o efeito quando o container pai recebe a classe via JavaScript */
.forcar-visibilidade-remota .forcar-linha-persistente,
.forcar-visibilidade-remota .leaflet-interactive {
    stroke-width: 5px !important;                 /* Engrossa as linhas e bordas dos polígonos */
    stroke-opacity: 1 !important;                 /* Garante opacidade máxima para não sumirem */
    fill-opacity: 0.6 !important;                 /* Aumenta o preenchimento de áreas (se houver) */
    vector-effect: non-scaling-stroke !important; /* 🔥 O segredo: Impede que o navegador afine a linha ao tirar o zoom */
    filter: drop-shadow(0px 0px 1.5px #000000) !important; /* Cria um contorno preto nítido para dar contraste */
}


