/* ================================
   STILE PRINCIPALE - MESHCORE ITALIA
   Tema dark neon tech - by GPT-5
=================================== */

:root {
  --color-bg: #0b0c10;
  --color-panel: rgba(15, 25, 35, 0.9);
  --color-border: rgba(0, 234, 255, 0.25);
  --color-accent: #00eaff;
  --color-accent2: #00ffa3;
  --color-text: #e0e0e0;
  --color-subtext: #a0eaff;
  --radius: 10px;
  --transition: 0.3s ease;
  --shadow: 0 0 18px rgba(0, 234, 255, 0.1);
  --font-main: 'Inter', sans-serif;
  --font-title: 'Orbitron', sans-serif;
}

body {
  margin: 0;
  background-color: var(--color-bg);
  font-family: var(--font-main);
  color: var(--color-text);
  overflow: hidden;
}

/* ======================================
   MAPPA
====================================== */
#map {
  height: 100vh;
  width: 100%;
  background: #0a0e14;
  z-index: 0;
  border-top: 1px solid var(--color-border);
}

/* ======================================
   HEADER
====================================== */
.header-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(10, 25, 47, 0.8);
  backdrop-filter: blur(10px);
  color: var(--color-accent);
  padding: 10px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 0 25px rgba(0, 234, 255, 0.15);
  z-index: 1000;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title img {
  height: 70px;
  filter: drop-shadow(0 0 6px rgba(0, 234, 255, 0.6));
}

.header-title h1 {
  font-family: var(--font-title);
  font-size: 1.6em;
  margin: 0;
  letter-spacing: 1px;
  color: var(--color-accent);
}

.header-stats {
  display: flex;
  gap: 18px;
  font-size: 0.9em;
}

.header-stats span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-subtext);
}

/* ======================================
   FOOTER
====================================== */
.footer-banner {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 25, 47, 0.8);
  backdrop-filter: blur(8px);
  color: var(--color-subtext);
  text-align: center;
  font-size: 0.85em;
  padding: 10px;
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -2px 20px rgba(0, 234, 255, 0.1);
}

.footer-banner a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition);
}

.footer-banner a:hover {
  color: var(--color-accent2);
}

.version-badge {
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent2));
  color: var(--color-bg);
  border-radius: 8px;
  padding: 2px 8px;
  margin-left: 6px;
  font-weight: 700;
}

/* ======================================
   CONTROLLI (FILTRI E RICERCA)
====================================== */
.controls-container {
  position: absolute;
  top: 90px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
  width: 320px;
}

.filters-container,
.search-container {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.filters-container:hover,
.search-container:hover {
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.25);
}

.filters-container select,
.search-input {
  width: 100%;
  background: #0d1824;
  color: var(--color-accent);
  border: 1px solid rgba(0, 234, 255, 0.3);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  outline: none;
  transition: var(--transition);
}

.filters-container select:focus,
.search-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.3);
}

.filter-btn {
  margin-top: 8px;
  width: 100%;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent2));
  color: var(--color-bg);
  border: none;
  border-radius: 6px;
  padding: 8px 0;
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.filter-btn:hover {
  background: linear-gradient(90deg, var(--color-accent2), var(--color-accent));
  transform: scale(1.03);
}

/* ======================================
   RICERCA
====================================== */
.search-results {
  margin-top: 5px;
  border: 1px solid rgba(0, 234, 255, 0.3);
  border-radius: 6px;
  background: rgba(15, 25, 35, 0.95);
  box-shadow: 0 0 10px rgba(0, 234, 255, 0.2);
  max-height: 250px;
  overflow-y: auto;
  display: none;
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  color: var(--color-subtext);
  transition: background 0.2s ease;
}

.search-result-item:hover {
  background: rgba(0, 234, 255, 0.15);
}

/* ======================================
   POPUP MAPPA
====================================== */
.map-popup {
  min-width: 220px;
  max-width: 320px;
  color: var(--color-text);
}

.map-popup b {
  display: block;
  margin-bottom: 6px;
  font-size: 1.1em;
  color: var(--color-accent);
}

.map-popup p {
  margin: 5px 0 !important;
  line-height: 1.4;
  color: #c5e8ff;
}

.map-popup a {
  color: var(--color-accent);
  text-decoration: none;
  transition: var(--transition);
}

.map-popup a:hover {
  color: var(--color-accent2);
  text-decoration: underline;
}

.map-popup .timestamp-info {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 234, 255, 0.2);
  font-size: 0.8em;
  color: #89bde7;
}

/* ======================================
   STATUS BAR
====================================== */
.status-bar {
  position: absolute;
  bottom: 40px;
  left: 20px;
  padding: 8px 14px;
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  color: var(--color-accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 14px;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 1000;
}

.status-updating {
  color: #ffb300;
}
.status-success {
  color: #00ffa3;
}
.status-error {
  color: #f44336;
}

/* ======================================
   MARKER CLUSTER
====================================== */
/*.cluster-icon {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent2));
  color: var(--color-bg);
  border-radius: 50%;
  text-align: center;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(0, 234, 255, 0.4);
}
*/

/* ======================================
   CLUSTER MARKERS - Effetto Neon Tech
====================================== */
/* ======================================
   CLUSTER MARKERS - Tema Blu Elettrico
====================================== */
.cluster-icon {
  background: radial-gradient(circle at 30% 30%, #0033cc, #0066ff, #0099ff);
  color: #ffffff;
  border-radius: 50%;
  font-weight: 700;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Orbitron', sans-serif;
  font-size: 15px;
  box-shadow:
    0 0 15px rgba(0, 102, 255, 0.8),
    0 0 25px rgba(0, 204, 255, 0.7),
    inset 0 0 12px rgba(0, 102, 255, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
  width: 48px !important;
  height: 48px !important;
  animation: clusterGlowBlue 3s ease-in-out infinite alternate;
}

/* Numeri centrali */
.cluster-icon span {
  text-shadow:
    0 0 8px rgba(0, 102, 255, 0.8),
    0 0 12px rgba(0, 204, 255, 0.8);
  color: #eaf6ff;
}

/* Hover interattivo */
.cluster-icon:hover {
  transform: scale(1.15);
  box-shadow:
    0 0 25px rgba(0, 102, 255, 1),
    0 0 40px rgba(0, 204, 255, 1),
    inset 0 0 15px rgba(0, 102, 255, 0.8);
  border: 2px solid rgba(0, 255, 255, 0.5);
}

/* Animazione di pulsazione blu elettrico */
@keyframes clusterGlowBlue {
  0% {
    box-shadow:
      0 0 10px rgba(0, 102, 255, 0.6),
      0 0 20px rgba(0, 204, 255, 0.5);
  }
  100% {
    box-shadow:
      0 0 25px rgba(0, 102, 255, 0.9),
      0 0 45px rgba(0, 204, 255, 0.8);
  }
}



/* Marker evidenziato */
.highlighted-marker {
  filter: drop-shadow(0 0 12px var(--color-accent2));
  transform: scale(1.15);
  transition: all 0.3s ease;
}

/* ======================================
   RESPONSIVE DESIGN
====================================== */
@media (max-width: 768px) {
  .controls-container {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .filters-container {
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }

  .filter-group {
    flex: 1;
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .controls-container {
    top: 70px;
  }

  .filters-container {
    flex-direction: column;
  }
}






/* ======================================
   MARKER ANIMATO LORA
====================================== */

/* ======================================
   MARKER LORA - versione più visibile (blu elettrico)
====================================== */
.lora-marker {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  filter: drop-shadow(0 0 10px rgba(0, 102, 255, 0.9))
          drop-shadow(0 0 18px rgba(160, 0, 255, 0.6));
  transition: transform 0.2s ease;
}

.lora-marker:hover {
  transform: scale(1.2);
  filter: drop-shadow(0 0 20px rgba(0, 102, 255, 1))
          drop-shadow(0 0 30px rgba(160, 0, 255, 0.9));
}

/* Simbolo LoRa */
.lora-symbol {
  width: 30px;
  height: 30px;
  fill: url(#loraGradient);
  stroke: none;
  animation: spin 8s linear infinite;
  filter: drop-shadow(0 0 8px rgba(0, 102, 255, 0.8));
}

/* Effetto di pulsazione */
.lora-pulse {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0,102,255,0.7) 0%, rgba(0,102,255,0.0) 70%);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% { transform: scale(0.8); opacity: 0.9; }
  70% { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(0.8); opacity: 0; }
}

/* Onda costante di segnale */
.signal-wave {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 102, 255, 0.6);
  animation: wavePulse 2.8s ease-out infinite;
  pointer-events: none;
  box-shadow: 0 0 14px rgba(0, 102, 255, 0.5);
}

@keyframes wavePulse {
  0% { transform: scale(1); opacity: 0.7; }
  70% { transform: scale(2.6); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* Onda istantanea al click */
.signal-click-wave {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #0044ff;
  background: radial-gradient(circle, rgba(0,102,255,0.4) 0%, rgba(0,102,255,0) 80%);
  animation: clickWave 1.2s ease-out forwards;
  pointer-events: none;
  z-index: -1;
  box-shadow: 0 0 20px rgba(0,102,255,0.6);
}

@keyframes clickWave {
  0% { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(3.2); opacity: 0; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}




/* ======================================
   POPUP TECNOLOGICO
====================================== */
.leaflet-popup-content-wrapper {
  background: rgba(15, 25, 35, 0.9);
  border: 1px solid rgba(0, 234, 255, 0.3);
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 234, 255, 0.25);
  backdrop-filter: blur(6px);
}

.leaflet-popup-tip {
  background: rgba(15, 25, 35, 0.9);
  border: 1px solid rgba(0, 234, 255, 0.2);
}

.map-popup {
  font-family: 'Inter', sans-serif;
  color: #aefaff;
}

.map-popup b {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.2em;
  color: #00eaff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

.map-popup p {
  font-size: 0.9em;
  line-height: 1.4;
  margin: 6px 0;
  color: #c5f8ff;
}

.map-popup a {
  color: #00ffa3;
  text-decoration: none;
  font-weight: 600;
}

.map-popup a:hover {
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.7);
}

/* ======================================
   ONDA DI SEGNALE LORA
====================================== */
.signal-wave {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 255, 0.4);
  animation: wavePulse 3s ease-out infinite;
  pointer-events: none;
}

@keyframes wavePulse {
  0% { transform: scale(1); opacity: 0.6; }
  70% { transform: scale(2.5); opacity: 0; }
  100% { transform: scale(1); opacity: 0; }
}

/* Onda singola al click */
.signal-click-wave {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #00ffa3;
  background: radial-gradient(circle, rgba(0,255,255,0.25) 0%, rgba(0,255,255,0) 80%);
  animation: clickWave 1.2s ease-out forwards;
  pointer-events: none;
  z-index: -1;
}

@keyframes clickWave {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(3); opacity: 0; }
}

/*------*/

.lora-marker {
  filter: drop-shadow(0 0 10px rgba(0, 255, 255, 0.4));
  transition: transform 0.2s ease;
}

.lora-marker:hover {
  transform: scale(1.15);
  filter: drop-shadow(0 0 18px rgba(0, 255, 255, 0.8));
}


/* ======================================
   BOTTONE "AGGIUNGI IL TUO NODO"
====================================== */
.add-node-btn {
  position: absolute;
  bottom: 100px;
  right: 20px;
  background: linear-gradient(135deg, #0044ff, #00aaff);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 102, 255, 0.6);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 1500;
  transition: all 0.3s ease;
}

.add-node-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(0, 204, 255, 0.8);
}

/* MOBILE ADAPT */
@media (max-width: 768px) {
  .add-node-btn {
    bottom: 90px;
    right: 50%;
    transform: translateX(50%);
    font-size: 14px;
    padding: 10px 16px;
  }
}

/* ======================================
   POPUP (MODALE) ISTRUZIONI
====================================== */
.add-node-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 10, 20, 0.8);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 15px;
  backdrop-filter: blur(8px);
}

.modal-content {
  background: rgba(15, 25, 45, 0.95);
  border: 1px solid rgba(0, 102, 255, 0.4);
  box-shadow: 0 0 30px rgba(0, 102, 255, 0.3);
  border-radius: 12px;
  padding: 20px;
  max-width: 420px;
  color: #e0f0ff;
  text-align: left;
  animation: fadeIn 0.4s ease;
}

.modal-content h2 {
  font-family: 'Orbitron', sans-serif;
  color: #00aaff;
  margin-top: 0;
  text-align: center;
  font-size: 1.3em;
}

.modal-content p {
  line-height: 1.5;
  font-size: 0.95em;
}

.modal-content ul {
  padding-left: 20px;
  margin: 10px 0;
}

.modal-content li {
  margin: 4px 0;
  color: #bfe8ff;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 20px;
  color: #aaa;
  font-size: 1.8em;
  cursor: pointer;
  transition: 0.3s;
}

.close-modal:hover {
  color: #fff;
}

/* Link al bot Telegram */
.bot-link {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, #0088ff, #00ccff);
  color: white;
  font-weight: 600;
  padding: 10px 15px;
  border-radius: 8px;
  text-decoration: none;
  margin: 10px auto;
  box-shadow: 0 0 15px rgba(0, 136, 255, 0.6);
  transition: all 0.3s ease;
}

.bot-link:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(0, 204, 255, 0.8);
}

/* Animazione di comparsa */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
