/* ==========================================================================
   MAPPA INTERATTIVA LEAFLET - CITTÀ DEL DELTA
   Stile Dark Matter con 7 Colori Neon Arcobaleno & Glassmorphism
   ========================================================================== */

:root {
  --po-blue: #0A2463;
  --delta-blue: #3E92CC;
  --wetland-green: #00e676;
  --heraldic-red: #ff0055;
  --delta-gold: #ffea00;
  --neon-cyan: #00e5ff;
  --neon-violet: #d500f9;
  --dark: #030712;
  --darker: #02040a;
  --text-light: #f8fafc;
  --text-muted: #94a3b8;
  --glass: rgba(8, 17, 34, 0.82);
  --glass-border: rgba(0, 229, 255, 0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { 
  height: 100%; 
  width: 100%;
  overflow: hidden; 
  font-family: 'Inter', sans-serif; 
  background: var(--dark); 
  color: var(--text-light); 
}

/* HEADER SOVRAPPOSTO */
.map-header {
  position: absolute; 
  top: 0; 
  left: 0; 
  right: 0; 
  z-index: 1000;
  background: linear-gradient(180deg, rgba(3,7,18,0.95) 0%, rgba(3,7,18,0.7) 70%, transparent 100%);
  padding: 1rem 1.8rem; 
  display: flex; 
  align-items: center; 
  gap: 1.5rem;
  pointer-events: none;
}
.map-header > * { pointer-events: auto; }

.logo {
  font-family: 'Cinzel', serif; 
  font-size: 1.35rem;
  color: #fff; 
  font-weight: 800; 
  text-decoration: none;
  display: flex; 
  align-items: center; 
  gap: 0.75rem;
}
.logo-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}
.logo span { 
  background: linear-gradient(90deg, #00e5ff, #ffea00, #ff0055);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.map-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 1rem;
}
.map-nav-link {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s ease;
}
.map-nav-link:hover, .map-nav-link.active {
  color: #fff;
  border-color: var(--neon-cyan);
  background: rgba(0, 229, 255, 0.15);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.search-bar {
  flex: 1; 
  max-width: 380px; 
  margin-left: auto;
  background: var(--glass); 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); 
  border-radius: 50px;
  padding: 0.55rem 1.2rem; 
  display: flex; 
  align-items: center; 
  gap: 0.6rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.search-bar input {
  flex: 1; 
  background: none; 
  border: none; 
  outline: none;
  color: var(--text-light); 
  font-family: inherit; 
  font-size: 0.88rem;
}
.search-bar input::placeholder { color: var(--text-muted); }

/* SIDEBAR INFORMATIVA */
.sidebar {
  position: absolute; 
  top: 0; 
  right: 0; 
  bottom: 0; 
  width: 380px; 
  z-index: 1001;
  background: rgba(3, 7, 18, 0.94); 
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-left: 1px solid var(--glass-border); 
  overflow-y: auto;
  transform: translateX(100%); 
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 5rem 1.8rem 2rem;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.7);
}
.sidebar.open { transform: translateX(0); }

.sidebar-close {
  position: absolute; 
  top: 1.5rem; 
  right: 1.5rem;
  width: 36px; 
  height: 36px; 
  border-radius: 50%;
  background: rgba(255, 0, 85, 0.15); 
  border: 1px solid rgba(255, 0, 85, 0.4);
  color: #fff; 
  cursor: pointer; 
  font-size: 1.1rem;
  display: flex; 
  align-items: center; 
  justify-content: center;
  transition: all 0.25s;
}
.sidebar-close:hover {
  background: rgba(255, 0, 85, 0.35);
  box-shadow: 0 0 15px rgba(255, 0, 85, 0.5);
}

.sidebar-stemma {
  width: 72px;
  height: 84px;
  object-fit: contain;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.7));
}

.sidebar h2 { 
  font-family: 'Cinzel', serif; 
  color: var(--neon-cyan); 
  font-size: 1.6rem; 
  margin-bottom: 0.4rem; 
}
.sidebar h3 { 
  font-family: 'Cinzel', serif; 
  color: var(--delta-gold); 
  font-size: 0.8rem; 
  margin: 1.6rem 0 0.8rem; 
  text-transform: uppercase; 
  letter-spacing: 1px; 
}
.sidebar p { 
  color: #cbd5e1; 
  font-size: 0.9rem; 
  line-height: 1.65; 
  margin-bottom: 1rem; 
}
.sidebar-stat { 
  display: flex; 
  justify-content: space-between; 
  padding: 0.65rem 0; 
  border-bottom: 1px solid rgba(255,255,255,0.06); 
  font-size: 0.9rem; 
}
.sidebar-stat .label { color: var(--text-muted); }
.sidebar-stat .value { color: var(--neon-cyan); font-weight: 600; }

.badge-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.8rem 0; }
.badge { 
  font-size: 0.72rem; 
  padding: 0.3rem 0.75rem; 
  border-radius: 50px; 
  font-weight: 600; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
}
.b-snai { background: rgba(0, 230, 118, 0.15); color: #00e676; border: 1px solid rgba(0, 230, 118, 0.4); }
.b-parco { background: rgba(0, 229, 255, 0.15); color: #00e5ff; border: 1px solid rgba(0, 229, 255, 0.4); }
.b-mab { background: rgba(255, 234, 0, 0.15); color: #ffea00; border: 1px solid rgba(255, 234, 0, 0.4); }
.b-gal { background: rgba(255, 119, 0, 0.15); color: #ff7700; border: 1px solid rgba(255, 119, 0, 0.4); }
.b-galpa { background: rgba(213, 0, 249, 0.15); color: #d500f9; border: 1px solid rgba(213, 0, 249, 0.4); }
.b-ogd { background: rgba(41, 121, 255, 0.15); color: #2979ff; border: 1px solid rgba(41, 121, 255, 0.4); }
.b-paesc { background: rgba(0, 230, 118, 0.15); color: #00e676; border: 1px solid rgba(0, 230, 118, 0.4); }

.sidebar-link {
  display: inline-flex; 
  align-items: center; 
  gap: 0.5rem;
  color: var(--neon-cyan); 
  text-decoration: none; 
  font-size: 0.86rem;
  padding: 0.65rem 1.1rem; 
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--glass-border); 
  border-radius: 8px;
  margin: 0.4rem 0.4rem 0.4rem 0; 
  transition: all 0.3s;
}
.sidebar-link:hover { 
  background: rgba(0, 229, 255, 0.2); 
  transform: translateX(4px);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

/* LEGENDA FILTRI */
.legend {
  position: absolute; 
  bottom: 1.8rem; 
  left: 1.8rem; 
  z-index: 998;
  background: var(--glass); 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); 
  border-radius: 14px;
  padding: 1.1rem 1.4rem; 
  max-width: 290px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}
.legend h4 {
  font-family: 'Cinzel', serif; 
  color: var(--delta-gold);
  font-size: 0.88rem; 
  margin-bottom: 0.85rem; 
  text-transform: uppercase; 
  letter-spacing: 1px;
}
.legend-item {
  display: flex; 
  align-items: center; 
  gap: 0.75rem;
  padding: 0.4rem 0; 
  font-size: 0.84rem; 
  cursor: pointer;
  user-select: none;
  transition: all 0.25s;
}
.legend-item:hover {
  transform: translateX(3px);
  color: #fff;
}
.legend-item.off { 
  opacity: 0.35; 
  filter: grayscale(80%);
}
.legend-dot { 
  width: 14px; 
  height: 14px; 
  border-radius: 50%; 
  flex-shrink: 0; 
  box-shadow: 0 0 10px currentColor; 
}

/* TOOLBAR AZIONI */
.toolbar {
  position: absolute; 
  bottom: 1.8rem; 
  right: 1.8rem; 
  z-index: 998;
  display: flex; 
  flex-direction: column; 
  gap: 0.6rem;
}
.tool-btn {
  width: 44px; 
  height: 44px; 
  border-radius: 50%;
  background: var(--glass); 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); 
  color: var(--text-light);
  cursor: pointer; 
  font-size: 1.15rem; 
  display: flex;
  align-items: center; 
  justify-content: center; 
  transition: all 0.3s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.tool-btn:hover { 
  background: var(--neon-cyan); 
  color: var(--dark);
  transform: scale(1.12); 
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.6);
}
.tool-btn.active { 
  background: var(--delta-gold); 
  color: var(--dark); 
}

/* MAPPA LEAFLET */
#map { 
  position: absolute; 
  inset: 0; 
  z-index: 1; 
  background: var(--darker); 
}
.leaflet-container { background: var(--darker); }

/* POPUP LEAFLET PERSONALIZZATI */
.leaflet-popup-content-wrapper {
  background: rgba(3, 7, 18, 0.92); 
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-light); 
  border: 1px solid var(--glass-border);
  border-radius: 14px; 
  box-shadow: 0 12px 40px rgba(0,0,0,0.7), 0 0 20px rgba(0, 229, 255, 0.2);
}
.leaflet-popup-tip { 
  background: rgba(3, 7, 18, 0.92); 
  border: 1px solid var(--glass-border); 
}
.leaflet-popup-content { 
  margin: 1.1rem 1.2rem; 
  font-family: 'Inter', sans-serif; 
}
.popup-title {
  font-family: 'Cinzel', serif; 
  font-size: 1.15rem;
  color: var(--neon-cyan); 
  font-weight: 700;
  margin-bottom: 0.3rem;
}
.popup-cat {
  font-size: 0.7rem; 
  text-transform: uppercase; 
  letter-spacing: 1px;
  color: var(--delta-gold); 
  margin-bottom: 0.65rem;
  font-weight: 600;
}
.popup-desc { 
  font-size: 0.85rem; 
  color: #cbd5e1; 
  line-height: 1.55; 
  margin-bottom: 0.85rem; 
}
.popup-meta { 
  font-size: 0.78rem; 
  color: #94a3b8; 
  margin-bottom: 0.45rem; 
}
.popup-btn {
  display: inline-block; 
  padding: 0.5rem 1.1rem;
  background: linear-gradient(90deg, #00e5ff, #2979ff); 
  color: #fff;
  border-radius: 50px; 
  text-decoration: none; 
  font-size: 0.8rem;
  font-weight: 600; 
  margin-top: 0.5rem;
  transition: all 0.3s;
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}
.popup-btn:hover { 
  transform: scale(1.05); 
  box-shadow: 0 0 25px rgba(0, 229, 255, 0.6); 
}

/* MARKER PERSONALIZZATI */
.custom-marker {
  display: flex; 
  align-items: center; 
  justify-content: center;
  width: 38px; 
  height: 38px; 
  border-radius: 50%;
  border: 2px solid #fff; 
  box-shadow: 0 0 14px currentColor;
  font-size: 1.1rem; 
  transition: transform 0.3s;
}
.custom-marker:hover { 
  transform: scale(1.25); 
  z-index: 1000 !important;
}

.marker-comune { background: #0A2463; color: #00e5ff; border-color: #00e5ff; }
.marker-ente { background: #1e1b4b; color: #ffea00; border-color: #ffea00; }
.marker-parco { background: #022c22; color: #00e676; border-color: #00e676; }
.marker-turismo { background: #082f49; color: #38bdf8; border-color: #38bdf8; }
.marker-progetto { 
  background: #4c0519; 
  color: #ff0055; 
  border-color: #ff0055; 
  animation: pulse-marker 1.8s infinite; 
}
.marker-metro { background: #3b0764; color: #d500f9; border-color: #d500f9; }

@keyframes pulse-marker {
  0%, 100% { box-shadow: 0 0 12px currentColor; transform: scale(1); }
  50% { box-shadow: 0 0 26px currentColor; transform: scale(1.12); }
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .map-nav-links { display: none; }
}
@media (max-width: 768px) {
  .sidebar { width: 100%; }
  .legend { max-width: 200px; padding: 0.8rem; bottom: 5rem; }
  .search-bar { max-width: 220px; }
  .map-header { padding: 0.8rem 1rem; }
}

/* ==========================================================================
   COOKIE BANNER PA 5.0 (GDPR & MOBILE TOUCH PROOF)
   ========================================================================== */
.cookie-consent-card {
  position: fixed !important;
  bottom: 24px !important;
  left: 24px !important;
  width: calc(100% - 48px) !important;
  max-width: 480px !important;
  background: rgba(6, 11, 24, 0.97) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(0, 229, 255, 0.35) !important;
  border-radius: 16px !important;
  padding: 16px 18px !important;
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.85), 0 0 25px rgba(0, 229, 255, 0.15) !important;
  z-index: 2000000 !important;
  display: flex;
  flex-direction: column !important;
  gap: 12px !important;
  color: #e2e8f0 !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s !important;
  pointer-events: auto !important;
  box-sizing: border-box !important;
}

.cookie-consent-card[hidden],
.cookie-consent-card.cookie-banner-hidden,
.cookie-consent-card.cookie-banner-hiding {
  display: none !important;
  opacity: 0 !important;
  transform: translateY(20px) scale(0.96) !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.cookie-card-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

.cookie-card-title-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.cookie-card-icon {
  font-size: 1.5rem !important;
  line-height: 1 !important;
}

.cookie-card-title {
  margin: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  letter-spacing: -0.01em !important;
}

.cookie-card-badge {
  display: inline-block !important;
  font-size: 0.68rem !important;
  color: #00e5ff !important;
  font-weight: 600 !important;
  background: rgba(0, 229, 255, 0.12) !important;
  border: 1px solid rgba(0, 229, 255, 0.25) !important;
  border-radius: 4px !important;
  padding: 1px 6px !important;
  margin-top: 2px !important;
}

.cookie-close-btn {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  color: #94a3b8 !important;
  font-size: 1.1rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
  pointer-events: auto !important;
}

.cookie-close-btn:hover,
.cookie-close-btn:active {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff !important;
  transform: scale(1.08) !important;
}

.cookie-card-text {
  margin: 0 !important;
  font-size: 0.8rem !important;
  line-height: 1.5 !important;
  color: #cbd5e1 !important;
}

.cookie-card-text strong {
  color: #f1f5f9 !important;
}

.cookie-card-actions {
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 8px !important;
  padding-top: 4px !important;
}

.btn-cookie-accept {
  flex: 1 1 120px !important;
  min-height: 40px !important;
  background: linear-gradient(135deg, #00e5ff 0%, #0077b6 100%) !important;
  border: none !important;
  border-radius: 8px !important;
  color: #020617 !important;
  font-weight: 700 !important;
  font-size: 0.84rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.35) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  pointer-events: auto !important;
}

.btn-cookie-accept:hover,
.btn-cookie-accept:active {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.6) !important;
}

.btn-cookie-reject {
  flex: 1 1 100px !important;
  min-height: 40px !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(0, 229, 255, 0.3) !important;
  border-radius: 8px !important;
  color: #00e5ff !important;
  font-weight: 600 !important;
  font-size: 0.82rem !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: background 0.15s ease, border-color 0.15s ease !important;
  pointer-events: auto !important;
}

.btn-cookie-reject:hover,
.btn-cookie-reject:active {
  background: rgba(0, 229, 255, 0.15) !important;
  border-color: #00e5ff !important;
}

.btn-cookie-link {
  font-size: 0.78rem !important;
  color: #94a3b8 !important;
  text-decoration: underline !important;
  padding: 6px 8px !important;
  cursor: pointer !important;
  touch-action: manipulation !important;
  transition: color 0.15s ease !important;
  white-space: nowrap !important;
  pointer-events: auto !important;
}

.btn-cookie-link:hover {
  color: #38bdf8 !important;
}

.cookie-banner-hiding {
  opacity: 0 !important;
  transform: translateY(20px) scale(0.96) !important;
  pointer-events: none !important;
}

@media (max-width: 768px) {
  .cookie-consent-card {
    bottom: 76px !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: none !important;
    padding: 14px 16px !important;
    gap: 10px !important;
    border-radius: 14px !important;
  }
  .cookie-card-title {
    font-size: 0.88rem !important;
  }
  .cookie-card-text {
    font-size: 0.76rem !important;
    line-height: 1.45 !important;
  }
  .btn-cookie-accept,
  .btn-cookie-reject {
    min-height: 42px !important;
    font-size: 0.82rem !important;
  }
}

