/* Platty Maps v3.0 - Frontend Styles */

/* Leaflet overrides */
.leaflet-container {
    background: #f0f0f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.leaflet-tile-pane {
    filter: saturate(0.8);
}

/* Mapa container */
.platty-maps-container {
    position: relative;
    /* v3.1.5: z-index cria um stacking context próprio - confina os z-index
       internos do Leaflet (tiles 200 / marcadores 600 / controles 1000) para
       o mapa NUNCA passar por cima do menu/header do site ao rolar */
    z-index: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* v3.1.5: dentro do Elementor, quem manda é o painel Advanced do widget -
   o mapa herda o border-radius aplicado no wrapper e não impõe sombra própria */
.elementor-widget-platty_maps .platty-maps-container {
    border-radius: inherit;
    box-shadow: none;
}

.platty-maps-map {
    width: 100%;
    height: 100%;
}

/* Controles do mapa */
.platty-maps-controls {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    z-index: 400;
    display: flex;
    gap: 10px;
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.platty-maps-search {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
}

.platty-maps-search:focus {
    outline: none;
    border-color: #3B52CB;
    box-shadow: 0 0 0 3px rgba(59, 82, 203, 0.1);
}

.platty-maps-filter {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    min-width: 180px;
}

.platty-maps-filter:focus {
    outline: none;
    border-color: #3B52CB;
    box-shadow: 0 0 0 3px rgba(59, 82, 203, 0.1);
}

/* Marcadores customizados */
.platty-marker-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #3B52CB;
    color: white;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.platty-marker-icon:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.platty-marker-icon.active {
    background: #F4D03F;
    color: #333;
    box-shadow: 0 0 0 4px rgba(59, 82, 203, 0.3);
}

/* Formato de marcador - Quadrado */
.platty-marker-square {
    border-radius: 4px;
}

/* Formato de marcador - Hexágono */
.platty-marker-hexagon {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

/* Formato de marcador - Estrela */
.platty-marker-star {
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* Popup */
.platty-popup {
    background: white;
    border-radius: 6px;
    padding: 15px;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.platty-popup-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 10px;
    color: #333;
}

.platty-popup-content {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.platty-popup-button {
    background: #3B52CB;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
    display: inline-block;
}

.platty-popup-button:hover {
    background: #2d3e99;
}

/* Botão maximize (v3.1.6: topo-direito, estilo de controle do Leaflet,
   seletor reforçado + propriedades explícitas para o kit global do
   Elementor/tema não transformar o botão numa pílula colorida) */
.platty-maps-container button.platty-maps-maximize {
    position: absolute;
    top: 15px;
    right: 15px;
    bottom: auto;
    left: auto;
    z-index: 400;
    background: #ffffff;
    color: #333333;
    border: 2px solid rgba(0, 0, 0, 0.2);
    width: 34px;
    height: 34px;
    min-width: 0;
    min-height: 0;
    padding: 0;
    margin: 0;
    line-height: 1;
    box-shadow: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.platty-maps-container button.platty-maps-maximize:hover {
    background: #f4f4f4;
    color: #111111;
    border-color: rgba(0, 0, 0, 0.3);
}

.platty-maps-container button.platty-maps-maximize svg {
    width: 18px;
    height: 18px;
    display: block;
    margin: auto;
    fill: currentColor;
}

/* v3.1.10 - Maximize como modal: mapa centralizado com margem, sobre um
   fundo escuro. O container é movido para o <body> pelo JS, então nenhum
   transform de ancestral (Elementor) interfere no position: fixed. */
.platty-maps-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(15, 17, 21, 0.65);
    z-index: 99998;
    cursor: pointer;
}

body.platty-maps-noscroll {
    overflow: hidden;
}

/* !important necessário: o container carrega position/height INLINE
   (style="height:...; position: relative") vindos do PHP - estilo inline
   vence classes, então sem !important o modal nunca sai do lugar */
.platty-maps-fullscreen {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: translate(-50%, -50%) !important;
    width: min(92vw, 1400px) !important;
    max-width: none !important;
    height: min(86vh, 900px) !important;
    z-index: 99999 !important;
    border-radius: 12px !important;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

@media (max-width: 767px) {
    .platty-maps-fullscreen {
        width: 96vw !important;
        height: 90vh !important;
    }
}

.platty-maps-fullscreen .platty-maps-close {
    display: block;
}

.platty-maps-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10000;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
    transition: all 0.2s ease;
}

.platty-maps-close:hover {
    background: #f0f0f0;
}

/* Responsivo */
@media (max-width: 768px) {
    .platty-maps-controls {
        flex-direction: column;
        gap: 8px;
    }

    .platty-maps-search,
    .platty-maps-filter {
        min-width: auto;
        width: 100%;
    }

    .platty-marker-icon {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .platty-popup {
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .platty-maps-controls {
        padding: 10px;
        gap: 6px;
    }

    .platty-maps-search,
    .platty-maps-filter {
        padding: 8px 10px;
        font-size: 13px;
    }

    .platty-marker-icon {
        width: 32px;
        height: 32px;
    }
}

/* Loading state */
.platty-maps-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 15px;
}

.platty-maps-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #3B52CB;
    border-radius: 50%;
    animation: platty-spin 0.8s linear infinite;
}

@keyframes platty-spin {
    to { transform: rotate(360deg); }
}

/* v3.0.6 - Estilo de mapa "Turquesa" (visual do site IHTE):
   base CARTO Voyager com filtro que puxa a água para turquesa */
.platty-tiles-turquoise {
    /* Turquesa sobre a base Voyager lisa (o azul aprovado do site):
       hue-rotate leva a água azul-clara ao turquesa; base sem relevo/textura */
    filter: hue-rotate(-28deg) saturate(1.25) brightness(1.03);
}

/* ============================================
   v3.1.2 - POPUP: COLUNAS RESPONSIVAS + LARGURA POR DISPOSITIVO
   ============================================ */

.platty-pcols { display: flex; align-items: flex-start; }
.platty-pcols .platty-pcol { min-width: 0; overflow-wrap: break-word; }

/* Tablet (≤1024px): empilhar quando marcado + largura máxima do popup */
@media (max-width: 1024px) {
    .platty-pcols-stack-t { flex-direction: column; }
    .platty-pcols-stack-t > .platty-pcol { width: 100% !important; }
    .platty-popup-built { max-width: var(--pm-maxw-t, 300px) !important; }
}

/* Mobile (≤767px) */
@media (max-width: 767px) {
    .platty-pcols-stack-m { flex-direction: column; }
    .platty-pcols-stack-m > .platty-pcol { width: 100% !important; }
    .platty-popup-built { max-width: var(--pm-maxw-m, 300px) !important; }
}

/* v3.1.7 - status de boot (removido pelo JS quando o mapa monta) */
.platty-maps-boot-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: #757575;
    background: #f6f7f7;
    z-index: 1;
}

/* v3.1.15 - popups construídos no builder trazem a própria caixa: zerar a
   caixa padrão do Leaflet só para eles (evita "popup dentro de popup") */
.platty-built-popup .leaflet-popup-content-wrapper {
    background: transparent;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
}
.platty-built-popup .leaflet-popup-content {
    margin: 0;
}
.platty-built-popup .leaflet-popup-content .platty-popup-built {
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
}

/* ============================================
   v3.1.18 - NOMES EM INGLÊS (camada própria)
   Texto DOM real: nítido em qualquer tela, fonte simples,
   SEM sombra, SEM halo, SEM borda, SEM efeito
   ============================================ */
.platty-geo-label {
    background: none;
    border: none;
    box-shadow: none;
    text-shadow: none;
    white-space: nowrap;
    transform: translate(-50%, -50%);
    width: auto !important;
    height: auto !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
    pointer-events: none;
}

.platty-geo-label.platty-geo-label-water {
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 500;
    color: #5b93b8;
}

/* Cores dos nomes por tema do mapa */
.platty-maps-style-dark .platty-geo-label { color: #9ca3af; }
.platty-maps-style-dark .platty-geo-label-water { color: #6f9fc4; }
.platty-maps-style-turquoise .platty-geo-label { color: #4b5563; }
.platty-maps-style-turquoise .platty-geo-label-water { color: #ffffff; }

/* Continentes: presença de fundo, hierarquia acima dos países */
.platty-geo-label.platty-geo-label-continent {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.28em;
    color: #a8b0ba;
    text-transform: uppercase;
}

/* Nomes sobre foto de satélite: branco com contorno mínimo p/ legibilidade
   (única exceção ao "sem efeito" - texto sobre fotografia exige contraste) */
.platty-maps-style-satellite .platty-geo-label {
    color: #ffffff;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 0, 0, 0.5);
}
.platty-maps-style-satellite .platty-geo-label-water {
    color: #cfe6f5;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.85);
}
.platty-maps-style-topo .platty-geo-label {
    color: #3f4a55;
}
