/* ========================================
   MODERNIZAÇÃO DO MAPA - Estilos Avançados
   ======================================== */

/* === ANIMAÇÕES GLOBAIS === */
@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 0.5;
        transform: translateY(0);
    }
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes rotate-icon {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* === MARCADORES CUSTOMIZADOS === */
.marker-cto {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.marker-cto:hover {
    transform: scale(1.2);
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.marker-cto.active {
    animation: pulse-glow 2s ease-in-out infinite;
}

.marker-cto.selected {
    transform: scale(1.3);
    filter: drop-shadow(0 8px 20px rgba(16, 185, 129, 0.6));
}

/* === CLUSTERS === */
.cluster-marker {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid white;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.cluster-marker:hover {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.cluster-marker.cluster-small {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.cluster-marker.cluster-medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.cluster-marker.cluster-large {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* === POPUPS MODERNOS === */
.mapboxgl-popup-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    min-width: 280px;
    animation: fade-in 0.3s ease;
}

.popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 16px 16px 0 0;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.popup-header svg {
    width: 24px;
    height: 24px;
}

.popup-body {
    padding: 16px 20px;
}

.popup-info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.popup-info-item:last-child {
    border-bottom: none;
}

.popup-info-icon {
    width: 20px;
    height: 20px;
    color: #667eea;
}

.popup-info-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-info-value {
    font-size: 14px;
    color: #1f2937;
    font-weight: 600;
}

.popup-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.popup-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.popup-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.popup-badge.danger {
    background: #fee2e2;
    color: #991b1b;
}

.popup-actions {
    display: flex;
    gap: 8px;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 0 0 16px 16px;
}

.popup-button {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.popup-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.popup-button.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.popup-button.secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.popup-button.secondary:hover {
    background: #667eea;
    color: white;
}

/* === CONTROLES FLUTUANTES === */
.map-control-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    min-width: 280px;
    animation: slide-in 0.4s ease;
    z-index: 1000;
}

.control-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.control-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.control-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-button {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    background: white;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.control-button:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateX(4px);
}

.control-button.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.control-button svg {
    width: 20px;
    height: 20px;
}

/* === TOGGLE SWITCHES === */
.toggle-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    margin-bottom: 8px;
}

.toggle-label {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.toggle-input {
    position: relative;
    width: 48px;
    height: 24px;
    cursor: pointer;
}

.toggle-input input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    border-radius: 24px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.toggle-input input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* === SLIDERS === */
.slider-control {
    margin-bottom: 16px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
    color: #6b7280;
}

.slider-value {
    font-weight: 600;
    color: #667eea;
}

.slider-input {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #667eea, #764ba2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.slider-input::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.5);
}

/* === TEMA DARK === */
.dark-theme .mapboxgl-popup-content {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(75, 85, 99, 0.5);
}

.dark-theme .popup-body {
    color: #f3f4f6;
}

.dark-theme .popup-info-label {
    color: #9ca3af;
}

.dark-theme .popup-info-value {
    color: #f9fafb;
}

.dark-theme .map-control-panel {
    background: rgba(31, 41, 55, 0.95);
    border-color: rgba(75, 85, 99, 0.5);
}

.dark-theme .control-title {
    color: #f3f4f6;
}

.dark-theme .control-button {
    background: rgba(55, 65, 81, 0.5);
    border-color: #4b5563;
    color: #f3f4f6;
}

.dark-theme .control-button:hover {
    background: rgba(102, 126, 234, 0.2);
}

/* === HEAT MAP LEGEND === */
.heatmap-legend {
    position: absolute;
    bottom: 40px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fade-in 0.3s ease;
}

.heatmap-legend-title {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.heatmap-gradient {
    height: 20px;
    width: 200px;
    border-radius: 10px;
    background: linear-gradient(to right, 
        rgba(0, 0, 255, 0) 0%,
        rgb(0, 255, 255) 25%,
        rgb(0, 255, 0) 50%,
        rgb(255, 255, 0) 75%,
        rgb(255, 0, 0) 100%
    );
}

.heatmap-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 11px;
    color: #6b7280;
}

/* === LOADING SPINNER === */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e5e7eb;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: rotate-icon 0.8s linear infinite;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .map-control-panel {
        right: 10px;
        top: 10px;
        min-width: 240px;
    }
    
    .mapboxgl-popup-content {
        min-width: 240px;
    }
}

