/* ===== SISTEMA DE MARKERS APRIMORADO - CSS ===== */
/* Arquivo: /mapa-erderon/assets/css/markers.css */
/* Versão 2.0 - Visual Enhancement */

/* ===== 1. SISTEMA BASE DE MARKERS MODERNOS ===== */
.marker {
    position: absolute;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--marker-color, #3498db), var(--marker-color-dark, #2980b9));
    border: 3px solid rgba(255, 255, 255, 0.95);
    border-radius: 50% 50% 50% 0;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: rotate(-45deg);
    transform-origin: 00% 100%;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.2));
    /* IMPORTANTE: Permite que JavaScript controle a visibilidade */
    display: block !important;
}

/* Classe para markers ocultos */
.marker.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%);
    border-radius: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Efeito hover aprimorado */
.marker:hover {
    z-index: 200;
    transform: rotate(-45deg) scale(1.15);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.25),
        0 4px 10px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3)) brightness(1.1);
}

/* Animação de entrada */
@keyframes markerAppear {
    0% {
        opacity: 0;
        transform: rotate(-45deg) scale(0.3) translateY(-20px);
    }
    60% {
        opacity: 1;
        transform: rotate(-45deg) scale(1.1) translateY(0);
    }
    100% {
        opacity: 1;
        transform: rotate(-45deg) scale(1) translateY(0);
    }
}

.marker.animate-in {
    animation: markerAppear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Animação de pulse para destacar */
@keyframes markerPulse {
    0%, 100% {
        transform: rotate(-45deg) scale(1);
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.15),
            0 0 0 0 var(--marker-color);
    }
    50% {
        transform: rotate(-45deg) scale(1.05);
        box-shadow: 
            0 6px 20px rgba(0, 0, 0, 0.2),
            0 0 0 8px rgba(var(--marker-color-rgb), 0.3);
    }
}

.marker.highlighted {
    animation: markerPulse 2s ease-in-out infinite;
}

/* ===== 2. TIPOS DE MARKERS COM GRADIENTES ===== */
.marker.capital {
	--marker-color: #ffd700;
	--marker-color-dark: #daa520;
	--marker-color-rgb: 255, 215, 0;
}

.marker.castle {
	--marker-color: #4169e1;
	--marker-color-dark: #1e3a8a;
	--marker-color-rgb: 65, 105, 225;
}

.marker.region {
	--marker-color: #228b22;
	--marker-color-dark: #006400;
	--marker-color-rgb: 34, 139, 34;
}

.marker.adventure {
	--marker-color: #8b0000;
	--marker-color-dark: #5c0000;
	--marker-color-rgb: 139, 0, 0;
}

.marker.race {
	--marker-color: #27ae60;
	--marker-color-dark: #229954;
	--marker-color-rgb: 39, 174, 96;
}

.marker.service {
	--marker-color: #8e44ad;
	--marker-color-dark: #7d3c98;
	--marker-color-rgb: 142, 68, 173;
}

/* ===== 3. SISTEMA DE HOVER INFO IGUAL AO HTML ORIGINAL ===== */
.marker-info {
    position: absolute;
    left: 50px;
    top: -10px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 150;
}

.marker:hover .marker-info {
    opacity: 1;
}

.info-panel-hover {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid #666;
    border-radius: 3px;
    padding: 8px;
    min-width: 340px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    position: relative;
    /* backdrop-filter: blur(10px); */ /* COMENTAR ESTA LINHA */
}

.info-panel-hover::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 30px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 8px solid #666;
}

.info-panel-hover::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 32px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid rgba(30, 30, 30, 0.95);
}

/* Setinha invertida quando tooltip está à esquerda */
.info-panel-hover.tooltip-left::before {
    left: auto;
    right: -10px;
    border-right: none;
    border-left: 8px solid #666;
}

.info-panel-hover.tooltip-left::after {
    left: auto;
    right: -8px;
    border-right: none;
    border-left: 6px solid rgba(30, 30, 30, 0.95);
}

/* ===== 4. CONTEÚDO IGUAL AO HTML ORIGINAL (COM TAMANHOS AUMENTADOS) ===== */
.info-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1px;
}

.info-image {
    width: 78px;
    height: 78px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    border: 1px solid #444;
    flex-shrink: 0;
}

.info-text {
    flex: 1;
}

.info-title {
    color: #ffffff;
    font-family: 'Arial Black', Arial, sans-serif;
    font-size: 38px;
    font-weight: bold;
    margin-bottom: 1px;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.info-subtitle {
    color: #cccccc;
    font-family: Arial, sans-serif;
    font-size: 32px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-icons {
    display: flex;
    gap: 4px;
    margin-top: 2px;
    flex-wrap: wrap;
}

.info-icon {
    width: 46px;
    height: 46px;
    background-size: cover;
    background-position: center;
    border-radius: 4px;
    border: 1px solid #555;
    transition: transform 0.2s ease;
}

.info-icon:hover {
    transform: scale(1.1);
}

.info-icon.counter {
    background-color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 15px;
    font-weight: bold;
}

/* ===== 5. ESTADOS ESPECIAIS ===== */
.marker.loading {
    animation: markerPulse 1.5s ease-in-out infinite;
    opacity: 0.7;
}

.marker.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.7);
}

.marker.selected {
    transform: rotate(-45deg) scale(1.2);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 0 4px rgba(255, 255, 255, 0.8),
        0 0 0 8px rgba(var(--marker-color-rgb), 0.4);
}

/* ===== 6. RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .marker {
        width: 36px;
        height: 36px;
    }
    
    .marker::before {
        width: 14px;
        height: 14px;
    }
    
    .info-panel-hover {
        min-width: 200px;
        font-size: 12px;
        left: -5px;
        top: 50px;
    }
    
    .info-title {
        font-size: 21px;
    }
    
    .info-subtitle {
        font-size: 16px;
    }
    
    .info-icon {
        width: 39px;
        height: 39px;
    }
    
    .info-image {
        width: 65px;
        height: 65px;
    }
    
    .info-header {
        gap: 8px;
        margin-bottom: 1px;
    }
    
    .info-icons {
        gap: 3px;
        margin-top: 2px;
    }
    
    .info-icon.counter {
        font-size: 13px;
    }
}

/* ===== 7. ANIMAÇÕES DE LOADING ===== */
@keyframes markerSpin {
    0% { transform: rotate(-45deg); }
    100% { transform: rotate(315deg); }
}

.marker.loading {
    animation: markerSpin 2s linear infinite;
}

/* ===== 8. MODO ESCURO/CLARO ===== */
@media (prefers-color-scheme: light) {
    .info-panel-hover {
        background: linear-gradient(135deg, 
            rgba(255, 255, 255, 0.95) 0%, 
            rgba(248, 248, 250, 0.95) 100%);
        border-color: rgba(0, 0, 0, 0.1);
        color: #333;
    }
    
    .info-title {
        color: #333;
        text-shadow: none;
    }
    
    .info-subtitle {
        color: rgba(0, 0, 0, 0.6);
    }
}

/* ===== 9. REDUÇÃO DE MOVIMENTO ===== */
@media (prefers-reduced-motion: reduce) {
    .marker,
    .marker-info,
    .info-icon {
        transition: none;
    }
    
    .marker.animate-in,
    .marker.highlighted,
    .marker.loading {
        animation: none;
    }
}

/* ===== CORREÇÃO DE SOBREPOSIÇÃO DE MARKERS ===== */

/* Garante que markers não se sobreponham */
.marker {
    position: absolute;
    z-index: 100;
    pointer-events: auto;
}

/* Ajusta z-index baseado no tipo para evitar sobreposição */
.marker.capital {
	z-index: 110;
}

.marker.castle {
	z-index: 118;
}

.marker.adventure {
	z-index: 120;
}

.marker.region {
	z-index: 115;
}

.marker.race {
	z-index: 105;
}

.marker.service {
	z-index: 125;
}

/* Quando marker está ativo/visível, aumenta z-index */
.marker:not(.hidden) {
    z-index: 150;
}

/* Força ocultação completa quando hidden */
.marker.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* Força exibição quando visível */
.marker:not(.hidden) {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ===== ESTRELINHA DE FAVORITO ===== */
.marker-favorite-star {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, #ffd700 0%, #ffed4e 50%, #ffa500 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 2px 8px rgba(255, 215, 0, 0.6),
        0 0 12px rgba(255, 215, 0, 0.4),
        inset 0 1px 2px rgba(255, 255, 255, 0.5);
    z-index: 200;
    animation: starPulse 2s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.9);
    pointer-events: none;
    transform: rotate(45deg); /* Compensa a rotação do marker */
}

.marker-favorite-star::before {
    content: '★';
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transform: rotate(0deg); /* Mantém a estrela na posição correta */
}

/* Animação de pulse para a estrelinha */
@keyframes starPulse {
    0%, 100% {
        transform: rotate(45deg) scale(1);
        box-shadow:
            0 2px 8px rgba(255, 215, 0, 0.6),
            0 0 12px rgba(255, 215, 0, 0.4);
    }
    50% {
        transform: rotate(45deg) scale(1.15);
        box-shadow:
            0 3px 12px rgba(255, 215, 0, 0.8),
            0 0 20px rgba(255, 215, 0, 0.6);
    }
}

/* Hover no marker aumenta a estrelinha também */
.marker:hover .marker-favorite-star {
    transform: rotate(45deg) scale(1.2);
}

/* Estrelinha em Houses - não aceita zoom do mapa */
.house-element .marker-favorite-star {
    /* Remove a animação que sobrescreve o transform */
    animation: none !important;
}

/* Estrelinha em Races - mesmo tratamento que Houses */
.race-element .marker-favorite-star {
    /* Remove a animação que sobrescreve o transform */
    animation: none !important;
}

/* Estrelinhas em outros elementos customizados */
.input-element .marker-favorite-star,
.poi-element .marker-favorite-star,
.port-element .marker-favorite-star,
.service-element .marker-favorite-star,
.tower-element .marker-favorite-star {
    /* Remove a animação que sobrescreve o transform */
    animation: none !important;
}

/* ===== QUALIDADE DE RENDERIZAÇÃO DOS RACE E HOUSE ELEMENTS ===== */
.race-element img,
.house-element img,
.input-element img,
.poi-element img,
.port-element img,
.service-element img,
.tower-element img {
    image-rendering: auto;
    image-rendering: -webkit-optimize-contrast;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
    filter: contrast(1.05) brightness(1.02);
}

/* Mobile - Estrelinha menor */
@media (max-width: 768px) {
    .marker-favorite-star {
        width: 16px;
        height: 16px;
        top: -6px;
        right: -6px;
    }

    .marker-favorite-star::before {
        font-size: 10px;
    }
}
/* ===================================== */

/* Garante que markers ativos ficam por cima */
.marker:hover,
.marker:focus {