/* ==============================
   VARIABLES & RESET
   ============================== */
:root {
  --bg:        #080c10;
  --bg2:       #0b1018;
  --bg3:       #0e1520;
  --surface:   #101828;
  --surface2:  #141f30;
  --border:    rgba(0,180,255,0.13);
  --border2:   rgba(0,180,255,0.28);
  --blue:      #00b4ff;
  --blue2:     #0091cc;
  --blue3:     #006a99;
  --blue-dim:  rgba(0,180,255,0.08);
  --text:      #d0e8f5;
  --muted:     #4d7a99;
  --success:   #00e5a0;
  --error:     #ff4d6a;
  --warn:      #ffb347;
  --radius:    12px;
  --radius-lg: 20px;
  --shadow:    0 4px 32px rgba(0,0,0,0.5);
  --glow:      0 0 24px rgba(0,180,255,0.18);
  --font:      'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* ==============================
   NAVBAR
   ============================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: rgba(8,12,16,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  /* niente più space-between: logo e link restano ancorati a sinistra,
     il gruppo di destra viene spinto all'estrema destra con margin-left:auto
     (vedi .navbar-right sotto), invece di "fluttuare" a metà spazio libero. */
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

/* Raggruppa link di navigazione + pulsante Telegram + hamburger sulla
   destra della navbar, così .navbar può restare a due soli blocchi
   (logo a sinistra, tutto il resto a destra) con justify-content:space-between. */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto; /* spinge questo gruppo all'estrema destra della navbar */
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--blue), var(--blue3));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: white;
  box-shadow: 0 0 16px rgba(0,180,255,0.3);
}

.logo-icon {
  width: 78px;
  height: 38px;
  border: 1.5px solid var(--blue3);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-dim);
}

.nav-logo span { color: var(--blue); }

.nav-telegram {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  line-height: 1;
  padding: 0 0.9rem;
  margin: 0;
  box-sizing: border-box;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  background: linear-gradient(135deg, #2aabee, #229ed9);
  box-shadow: 0 0 16px rgba(42,171,238,0.25);
  border: 1px solid rgba(42,171,238,0.4);
  transition: var(--transition);
}

.nav-telegram:hover {
  box-shadow: 0 0 22px rgba(42,171,238,0.45);
  transform: translateY(-1px);
}

.nav-telegram i {
  font-size: 1.05rem;
}

.nav-telegram-label {
  white-space: nowrap;
}

@media (max-width: 560px) {
  .nav-telegram-label { display: none; }
  .nav-telegram {
    padding: 0;
    width: 40px;
    height: 40px;
    justify-content: center;
    border-radius: 50%;
  }
  .nav-telegram i { font-size: 1.15rem; }
}

/* ==============================
   NAVBAR — Login / Badge Admin
   ============================== */
.nav-admin-login {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  line-height: 1;
  padding: 0 0.9rem;
  margin: 0;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border-radius: 999px;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  background: transparent;
  border: 1px solid var(--border2);
  transition: var(--transition);
}

.nav-admin-login:hover {
  color: var(--blue);
  border-color: var(--blue3);
  background: var(--blue-dim);
}

.nav-admin-login i { font-size: 1.05rem; }

.nav-admin-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  height: 38px;
  min-height: 38px;
  max-height: 38px;
  line-height: 1;
  padding: 0 0.4rem 0 0.9rem;
  margin: 0;
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(0,229,160,0.08);
  border: 1px solid rgba(0,229,160,0.35);
}

.nav-admin-badge-text {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
}

.nav-admin-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--success);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
}

.nav-admin-logout:hover {
  background: rgba(0,229,160,0.15);
  color: var(--text);
}

@media (max-width: 560px) {
  .nav-admin-login-label { display: none; }
  .nav-admin-login {
    padding: 0;
    width: 40px;
    height: 40px;
    justify-content: center;
    border-radius: 50%;
  }
  .nav-admin-login i { font-size: 1.15rem; }

  .nav-admin-badge { padding: 0 0.3rem 0 0.7rem; gap: 0.3rem; }
  .nav-admin-badge-text { font-size: 0.75rem; }
}

.nav-links {
  display: flex;
  gap: 0.25rem;
  list-style: none;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%); /* centrato sul centro esatto della navbar (= larghezza pagina),
                                        sia in orizzontale che in verticale, senza forzare l'altezza
                                        (così la pillola di selezione resta alta quanto il singolo link) */
}

/* Pillola scorrevole dietro ai link: segue l'hover e torna sulla voce
   attiva quando il mouse esce, con una transizione fluida di
   posizione/larghezza (stesso linguaggio visivo del filtro GPS). */
.nav-links-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 8px;
  background: var(--blue-dim);
  border: 1px solid var(--border);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease;
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  border: 1px solid transparent;
  position: relative;
  z-index: 1;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--blue);
  background: transparent;
  border-color: transparent;
}

.nav-links a .nav-icon {
  font-size: 0.95rem;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: var(--transition);
  background: none;
  border: none;
}

.hamburger:hover { background: var(--blue-dim); }

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
  transition: var(--transition);
}

.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: 64px; left: 0; right: 0;
  background: rgba(8,12,16,0.97);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  z-index: 999;
  flex-direction: column;
  gap: 0.25rem;
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.mobile-menu.open {
  display: flex;
  transform: translateY(0);
  opacity: 1;
  pointer-events: all;
}

.mobile-menu a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
  transition: var(--transition);
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--blue);
  background: var(--blue-dim);
}

/* Separatore tra i link di navigazione e le voci Telegram/Admin */
.mobile-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0.25rem;
}

.mobile-menu-telegram,
.mobile-menu-admin-login {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
}

.mobile-menu-telegram:hover,
.mobile-menu-admin-login:hover {
  color: var(--blue);
  background: var(--blue-dim);
}

.mobile-menu-telegram i { color: #2aabee; }

.mobile-menu-admin-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.7rem 0.7rem 0.7rem 1rem;
  border-radius: 10px;
  background: rgba(0,229,160,0.08);
  border: 1px solid rgba(0,229,160,0.35);
  color: var(--success);
  font-size: 0.95rem;
  font-weight: 600;
}

.mobile-menu-admin-badge span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mobile-menu-admin-logout {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--success);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.mobile-menu-admin-logout:hover {
  background: rgba(0,229,160,0.15);
  color: var(--text);
}

/* ==============================
   MAIN LAYOUT
   ============================== */
main {
  position: relative;
  z-index: 1;
  padding-top: 64px;
  min-height: 100vh;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.5rem 1.5rem;
}

/* ==============================
   PAGE HEADER
   ============================== */
.page-header {
  margin-bottom: 4rem;
  position: relative;
  padding-bottom: 0.75rem;
}

/* Sfondo degradante — specchio del footer, ma dall'alto verso il basso */
.page-header::before {
  content: '';
  position: absolute;
  top: -2.5rem;          /* risale fino al padding superiore di .page */
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  background: var(--bg2);
  z-index: -1;
  pointer-events: none;
}

/* Linea glow piena larghezza in fondo */
.page-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  box-shadow: 0 0 24px 2px rgba(0,180,255,0.35);
  margin-bottom: -20px;
}


.page-header h1 {
  font-size: 4rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.page-header p {
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
}

@media (max-width: 700px) {
  .page-header h1 { font-size: 2.6rem; }
  .page-header p { font-size: 0.9rem; padding: 0 0.5rem; }
}

@media (max-width: 400px) {
  .page-header h1 { font-size: 2.1rem; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--blue);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.eyebrow::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 8px var(--blue);
  animation: blink 2s ease-in-out infinite;
}

/* ==============================
   MAP SECTION
   ============================== */
.map-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

@media (max-width: 900px) {
  .map-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.panel-title .panel-icon {
  color: var(--blue);
}

#mapContainer {
  height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg3);
}

/* Leaflet dark theme */
.leaflet-container { background: var(--bg3) !important; font-family: var(--font) !important; }
.leaflet-control-zoom a { background: var(--surface2) !important; color: var(--blue) !important; border-color: var(--border) !important; }
.leaflet-control-zoom a:hover { background: var(--blue-dim) !important; }
.leaflet-popup-content-wrapper { background: var(--surface2) !important; color: var(--text) !important; border: 1px solid var(--border2) !important; border-radius: 10px !important; box-shadow: 0 8px 32px rgba(0,0,0,0.6) !important; }
.leaflet-popup-tip { background: var(--surface2) !important; border: 1px solid var(--border2) !important; }
.leaflet-popup-content { font-family: var(--font) !important; font-size: 0.82rem !important; margin: 0.6rem 0.75rem !important; }
.leaflet-popup-content b { color: var(--blue); }
.leaflet-control-attribution { background: rgba(8,12,16,0.7) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--blue3) !important; }

.leaflet-popup-close-button {
  width: 26px !important;
  height: 26px !important;
  top: 8px !important;
  right: 8px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: rgba(3,8,14,0.55) !important;
  border: 1px solid rgba(255,255,255,0.15) !important;
  border-radius: 50% !important;
  color: #fff !important;
  font: 0/0 sans-serif !important;
  backdrop-filter: blur(4px);
  transition: var(--transition) !important;
}
.leaflet-popup-close-button::before {
  content: '\2715';
  font: 700 12px/1 sans-serif;
}
.leaflet-popup-close-button:hover { background: var(--error) !important; border-color: var(--error) !important; }
/* Il popup con foto ha la X sopra l'immagine: sfondo più marcato per leggibilità */
.geo-popup .leaflet-popup-close-button { top: 10px !important; right: 10px !important; }

/* Custom map markers */
.geo-marker {
  background: var(--blue);
  border: 2px solid rgba(255,255,255,0.85);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(0,180,255,0.18), 0 0 12px rgba(0,180,255,0.5);
  transition: transform 0.2s ease;
}
.geo-marker:hover { transform: scale(1.3); }
.geo-marker.size-sm { width: 8px; height: 8px; }
.geo-marker.size-md { width: 14px; height: 14px; }
.geo-marker.size-lg { width: 20px; height: 20px; }

.geo-cluster-badge {
  background: var(--blue);
  color: #03141c;
  font-family: var(--font-mono);
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid rgba(255,255,255,0.9);
  box-shadow: 0 0 0 4px rgba(0,180,255,0.22), 0 0 16px rgba(0,180,255,0.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.geo-cluster-badge:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 6px rgba(0,180,255,0.3), 0 0 22px rgba(0,180,255,0.7);
}

/* Dimensioni cluster in base al numero di punti contenuti */
.geo-cluster-sm { width: 22px;  height: 22px;  font-size: 0.6rem; }
.geo-cluster-md { width: 30px;  height: 30px;  font-size: 0.7rem; }
.geo-cluster-lg { width: 38px;  height: 38px;  font-size: 0.78rem; }
.geo-cluster-xl { width: 48px;  height: 48px;  font-size: 0.88rem; }

/* Linee spiderfy (when a cluster expands into individual pins) */
.leaflet-cluster-spider-leg { stroke: var(--blue) !important; stroke-opacity: 0.4 !important; }

/* Override animazione cluster del plugin */
.leaflet-cluster-anim .leaflet-marker-icon,
.leaflet-cluster-anim .leaflet-marker-shadow {
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1),
              opacity   0.25s cubic-bezier(0.4,0,0.2,1);
}

/* Chart panel */
#regionChartWrap {
  height: 420px;
  position: relative;
}

#regionChartWrap canvas {
  display: block;
}

#regionChartEmpty {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  gap: 0.5rem;
}

/* ==============================
   GALLERY / CARDS
   ============================== */
.gallery-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 3.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

@media (max-width: 700px) {
  .gallery-controls { margin-top: 2.5rem; }
  .gallery-controls .date-filter { flex: 1 1 auto; min-width: 0; }
  .gallery-controls .gallery-count { flex: 1 1 100%; text-align: center; }
}

.search-box {
  flex: 1;
  min-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 1rem 0.6rem 2.5rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition);
}

.search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

/* FA magnifying glass via pseudo-element using FA Unicode */
.search-wrap::before {
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  content: '\f002';
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-box:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,180,255,0.08);
}

.gallery-count {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.gallery-count span {
  color: var(--blue);
  font-weight: 700;
}

/* Grid */
.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
}

/* 3 colonne: max = 1/3 container - quota gap (2 gap / 3 card = 0.834rem)
   → la card solitaria è identica a quelle in riga piena */
.gallery-grid .photo-card {
  flex: 1 1 300px;
  max-width: calc(33.333% - 0.834rem);
}

/* 2 colonne a larghezze medie */
@media (max-width: 960px) {
  .gallery-grid .photo-card {
    max-width: calc(50% - 0.625rem);
  }
}

/* 1 colonna su mobile */
@media (max-width: 480px) {
  .gallery-grid .photo-card {
    flex: 1 1 100%;
    max-width: 100%;
  }
}

/* Photo card */
.photo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  animation: cardIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(16px);
  position: relative;
}

@keyframes cardIn {
  to { opacity: 1; transform: translateY(0); }
}

.photo-card:hover {
  border-color: var(--border2);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), var(--glow);
}

.card-image-wrap {
  position: relative;
  overflow: hidden;
  height: 200px;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.photo-card:hover .card-image-wrap img { transform: scale(1.05); }

.card-image-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px);
  pointer-events: none;
}

.card-overlay {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  gap: 0.4rem;
}

.card-badge {
  background: rgba(8,12,16,0.85);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--blue);
  backdrop-filter: blur(8px);
}

.card-body {
  padding: 1.1rem 1.25rem 1.25rem;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 0.9rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Firma di chi ha scattato la foto (opt-in a fini statistici) */
.card-author {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: -0.5rem 0 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  font-family: var(--font-mono);
}
.card-author:hover { color: var(--text); text-shadow: 0 0 10px rgba(0,180,255,0.4); }
.card-author i { font-size: 0.7rem; opacity: 0.85; }

.card-author-empty {
  color: var(--muted);
  opacity: 0.85;
  font-style: italic;
  cursor: default;
}
.card-author-empty:hover { color: var(--muted); text-shadow: none; }

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.meta-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.meta-icon {
  flex-shrink: 0;
  font-size: 0.72rem;
  margin-top: 0.1em;
  color: var(--blue3);
  width: 14px;
  text-align: center;
}

.meta-row.coords {
  color: var(--blue);
  background: var(--blue-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  gap: 0.4rem;
}

.card-divider {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

.card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0 1.25rem 1.25rem;
}

.card-btn {
  flex: 1;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
}

.card-btn:hover {
  color: var(--blue);
  border-color: var(--border2);
  background: var(--blue-dim);
}

.card-btn.danger:hover {
  color: var(--error);
  border-color: rgba(255,77,106,0.3);
  background: rgba(255,77,106,0.06);
}

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 2rem;
  color: var(--muted);
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.4;
  color: var(--blue3);
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
  opacity: 0.6;
}

.empty-state p { font-size: 0.85rem; }

/* Stats bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  transition: var(--transition);
  text-align: center;
}

.stat-card:hover {
  border-color: var(--border2);
  background: var(--surface2);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--blue);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Loader */
.loader {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 4rem;
  grid-column: 1 / -1;
}

.loader span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  animation: dot-bounce 1.2s ease-in-out infinite;
}

.loader span:nth-child(2) { animation-delay: 0.15s; }
.loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 32px 80px rgba(0,0,0,0.8), 0 0 40px rgba(0,180,255,0.1);
  position: relative;
}

.modal-overlay.open .modal-box { transform: scale(1); }

.modal-img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-content { padding: 1.5rem; }

.modal-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(8,12,16,0.8);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--error);
  border-color: var(--error);
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  max-width: 320px;
  pointer-events: all;
}

.toast.success { border-color: rgba(0,229,160,0.3); }
.toast.error   { border-color: rgba(255,77,106,0.3); }

@keyframes toastIn  { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(32px); } }

/* Spinner */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(0,180,255,0.2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* Load more */
.load-more-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-bottom: 1rem;
}

.load-more-btn {
  padding: 0.8rem 2rem;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  color: var(--blue);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.load-more-btn:hover {
  background: var(--blue-dim);
  box-shadow: var(--glow);
  transform: translateY(-2px);
}

.load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.load-more-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;
  background: rgba(2,4,6,0.96);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.lightbox-img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 90px rgba(0,0,0,0.7);
  transform: scale(0.92);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-overlay.open .lightbox-img { transform: scale(1); }

.lightbox-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(16,24,40,0.85);
  border: 1px solid var(--border2);
  color: var(--text);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(8px);
  z-index: 4001;
}

.lightbox-close:hover {
  background: var(--error);
  border-color: var(--error);
  transform: rotate(90deg);
}

.lightbox-caption {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(16,24,40,0.85);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 0.6rem 1.2rem;
  font-size: 0.85rem;
  color: var(--text);
  max-width: 80vw;
  text-align: center;
}

/* ==============================
   PANEL TITLE ROW (titolo pannello + filtro data affiancati)
   ============================== */
.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.panel-title-row .panel-title { margin-bottom: 0; }

/* ==============================
   GPS FILTER (segmented control)
   ============================== */
.gps-filter {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem;
  gap: 0.2rem;
  position: relative;
}

/* Pillola scorrevole comune a tutti i "segmented control" (filtro GPS,
   ordinamento classifica): posizione/larghezza calcolate in JS in base
   al pulsante attivo, con una transizione morbida tra i due. */
.segmented-indicator {
  position: absolute;
  top: 0.2rem;
  height: calc(100% - 0.4rem);
  border-radius: 8px;
  background: var(--blue-dim);
  box-shadow: inset 0 0 0 1px var(--border2);
  z-index: 0;
  transition: left 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.gps-filter-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.gps-filter-btn:hover { color: var(--text); }

.gps-filter-btn.active {
  color: var(--blue);
}

@media (max-width: 640px) {
  .gps-filter-btn { padding: 0.45rem 0.6rem; font-size: 0.72rem; }
}

@media (max-width: 420px) {
  .gps-filter { width: 100%; }
  .gps-filter-btn { flex: 1; justify-content: center; }
}

/* ==============================
   DATE RANGE PICKER
   ============================== */
.date-filter { position: relative; }

.date-filter-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  width: 100%;
}

.date-filter-btn:hover { border-color: var(--border2); color: var(--text); }
.date-filter-btn i:first-child { color: var(--blue); }

.date-filter.has-range .date-filter-btn {
  border-color: var(--border2);
  color: var(--blue);
  background: var(--blue-dim);
}

.date-filter-clear-x {
  margin-left: auto;
  color: var(--muted);
  transition: var(--transition);
}
.date-filter-clear-x:hover { color: var(--error); }

/* Il popover è "portato" nel <body> (vedi script.js): position:fixed
   lo rende immune a qualsiasi overflow:hidden dei pannelli che ospitano
   il pulsante, e la posizione (top/left) viene calcolata in JS in base
   al pulsante cliccato. */
.date-picker-popover {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 500;
  width: 300px;
  max-width: calc(100vw - 1rem);
  max-height: calc(100vh - 1rem);
  overflow-y: auto;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 30px rgba(0,180,255,0.08);
  padding: 1rem;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: var(--transition);
}

.date-picker-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Backdrop: invisibile/inattivo su desktop, usato solo su mobile per
   trasformare il popover in un bottom-sheet modale. */
.date-picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 499;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.dp-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.75rem;
  margin-left: 0.35rem;
}
.dp-close:hover { color: var(--error); border-color: var(--error); background: rgba(255,77,106,0.08); }

.dp-month-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.dp-nav {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  font-size: 0.75rem;
}
.dp-nav:hover { background: var(--blue-dim); border-color: var(--border2); }

.dp-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 0.35rem;
}
.dp-weekdays span {
  text-align: center;
  font-size: 0.65rem;
  color: var(--muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.dp-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}
.dp-day.empty { cursor: default; }
.dp-day:not(.empty):not(.future-disabled):hover { background: var(--blue-dim); }
.dp-day.today { color: var(--blue); font-weight: 700; box-shadow: inset 0 0 0 1px var(--border2); }
.dp-day.in-range { background: rgba(0,180,255,0.12); border-radius: 0; }
.dp-day.selected { background: var(--blue); color: #03141c; font-weight: 700; }
.dp-day.selected.start { border-radius: 6px 0 0 6px; }
.dp-day.selected.end { border-radius: 0 6px 6px 0; }
.dp-day.future-disabled { color: var(--muted); opacity: 0.3; cursor: not-allowed; }

.dp-footer {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.dp-range-preview {
  font-size: 0.74rem;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-bottom: 0.6rem;
  text-align: center;
}

.dp-actions { display: flex; gap: 0.5rem; }

.dp-btn-clear, .dp-btn-apply {
  flex: 1;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.dp-btn-clear {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
}
.dp-btn-clear:hover { color: var(--text); background: var(--surface); }

.dp-btn-apply {
  background: var(--blue);
  border: 1px solid var(--blue);
  color: #03141c;
}
.dp-btn-apply:hover:not(:disabled) { box-shadow: var(--glow); }
.dp-btn-apply:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 640px) {
  /* Su mobile il popover diventa un bottom-sheet ancorato in fondo allo
     schermo, con un backdrop che lo mette bene in risalto: molto più
     comodo da usare col pollice di un piccolo dropdown fluttuante. */
  .date-picker-backdrop.open {
    opacity: 1;
    pointer-events: all;
    background: rgba(3,8,14,0.6);
    backdrop-filter: blur(2px);
  }

  .date-picker-popover {
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: 100%;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    padding: 1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
  }

  .date-picker-popover.open {
    transform: translateY(0);
  }

  .dp-day { font-size: 0.85rem; }
  .dp-actions { position: sticky; bottom: 0; }
}

/* ==============================
   MAP POPUP CON IMMAGINE (marker singolo)
   ============================== */
.geo-popup .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 18px !important;
  overflow: hidden;
  background: var(--surface2) !important;
  box-shadow: 0 18px 48px rgba(0,0,0,0.65), 0 0 0 1px rgba(0,180,255,0.08) !important;
}
.geo-popup .leaflet-popup-content { margin: 0 !important; width: auto !important; }
.geo-popup .leaflet-popup-tip-container { display: none; } /* la freccetta stona con il bordo arrotondato della card */

/* Card vera e propria: padding uniforme su tutti i lati, la foto è
   "incorniciata" dentro questo respiro invece di toccare i bordi. */
.map-popup {
  display: flex;
  flex-direction: column;
  width: 250px;
  padding: 0.85rem;
  gap: 0.7rem;
}

.map-popup-img-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  border-radius: 12px;
  cursor: zoom-in;
  overflow: hidden;
  background: var(--bg3);
  border: 1px solid var(--border);
}

.map-popup-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.map-popup-img-wrap:hover .map-popup-img { transform: scale(1.06); }

/* Sfumatura in basso: fa "galleggiare" meglio l'icona di espansione. */
.map-popup-img-fade {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(3,8,14,0.7), rgba(3,8,14,0));
  pointer-events: none;
}

.map-popup-expand {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3,8,14,0.6);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 0.65rem;
  backdrop-filter: blur(4px);
  transition: var(--transition);
}
.map-popup-img-wrap:hover .map-popup-expand {
  background: var(--blue);
  border-color: var(--blue);
  color: #03141c;
  transform: scale(1.08);
}

.map-popup-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.map-popup-desc {
  font-size: 0.83rem;
  color: var(--text);
  font-weight: 500;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.map-popup-region {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--blue);
  font-family: var(--font-mono);
  background: var(--blue-dim);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
}

/* Se manca la foto, la descrizione fa da protagonista con un filo di
   respiro in più sopra, per non sembrare "appiccicata" al bordo alto. */
.map-popup.no-img { padding-top: 0.95rem; }

@media (max-width: 480px) {
  .map-popup { width: 210px; padding: 0.7rem; gap: 0.6rem; }
  .map-popup-img-wrap { height: 130px; border-radius: 10px; }
}

/* ==============================
   EXPORT CSV PANEL
   ============================== */
.export-panel {
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
}

.export-desc {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  max-width: 640px;
  line-height: 1.5;
}

.export-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.export-controls .date-filter { min-width: 220px; }

.export-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  background: linear-gradient(135deg, var(--blue), var(--blue3));
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,180,255,0.3);
  transition: var(--transition);
}
.export-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(0,180,255,0.45); }
.export-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.export-hint {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 700px) {
  .hamburger { display: flex; }
  .nav-links  { display: none; }

  /* Sotto i 700px, Telegram e Login/Badge Admin escono dalla navbar
     (che si affollerebbe troppo su schermi stretti) e si spostano
     dentro il menu a tendina dell'hamburger. Uso !important perché
     .nav-admin-badge riceve anche uno style inline da JS (display:flex
     quando loggati) che altrimenti vincerebbe su questa regola. */
  .navbar-right .nav-telegram,
  .navbar-right .nav-admin-login,
  .navbar-right .nav-admin-badge {
    display: none !important;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  #mapContainer {
    height: 300px;
  }

  #regionChartWrap {
    height: 280px;
  }

  .page { padding: 0.5rem 1rem; }
  .panel { padding: 1.1rem; }
  .page-header { margin-bottom: 2.75rem; }
}

@media (max-width: 380px) {
  .stats-bar { grid-template-columns: 1fr; }
  .stat-card { padding: 0.85rem 1rem; }
  .stat-value { font-size: 1.5rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue3); }

/* ==============================
   ADMIN PASSWORD MODAL
   ============================== */
.admin-modal-box {
  max-width: 420px;
}

.admin-modal-inner {
  padding: 2.5rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.admin-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue-dim);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--blue);
  box-shadow: 0 0 24px rgba(0,180,255,0.15);
  transition: var(--transition);
}

.admin-modal-icon.denied {
  background: rgba(255,77,106,0.1);
  border-color: rgba(255,77,106,0.35);
  color: var(--error);
  box-shadow: 0 0 24px rgba(255,77,106,0.2);
  animation: shake 0.4s cubic-bezier(0.4,0,0.2,1);
}

.admin-modal-icon.success {
  background: rgba(0,229,160,0.1);
  border-color: rgba(0,229,160,0.35);
  color: var(--success);
  box-shadow: 0 0 24px rgba(0,229,160,0.2);
  animation: popIn 0.35s cubic-bezier(0.4,0,0.2,1);
}

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

@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

.admin-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.admin-modal-subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 300px;
}

.admin-pw-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.admin-pw-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,180,255,0.08);
}

.admin-pw-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.06em;
}

.admin-pw-input::placeholder {
  color: var(--muted);
  letter-spacing: 0;
  font-family: var(--font);
}

.admin-pw-toggle {
  padding: 0 0.9rem;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
  height: 100%;
  display: flex;
  align-items: center;
}

.admin-pw-toggle:hover { color: var(--blue); }

.admin-modal-actions {
  display: flex;
  gap: 0.6rem;
  width: 100%;
  margin-top: 0.25rem;
}

.admin-btn-cancel,
.admin-btn-confirm {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.admin-btn-cancel {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
}

.admin-btn-cancel:hover {
  background: var(--surface2);
  color: var(--text);
}

.admin-btn-confirm {
  background: linear-gradient(135deg, #c0392b, #922b21);
  border: 1px solid rgba(192,57,43,0.4);
  color: white;
  box-shadow: 0 2px 12px rgba(192,57,43,0.3);
}

.admin-btn-confirm:hover {
  box-shadow: 0 4px 20px rgba(192,57,43,0.5);
  transform: translateY(-1px);
}

/* Variante blu per il pulsante "Accedi" del modal di login (non è
   un'azione distruttiva, quindi non usa i toni rossi del pulsante
   di conferma eliminazione). */
.login-btn-confirm {
  background: linear-gradient(135deg, var(--blue), var(--blue3));
  border: 1px solid rgba(0,180,255,0.4);
  box-shadow: 0 2px 12px rgba(0,180,255,0.3);
}

.login-btn-confirm:hover {
  box-shadow: 0 4px 20px rgba(0,180,255,0.5);
  transform: translateY(-1px);
}

/* ==============================
   FOOTER — COLLABORAZIONE
   ============================== */
.site-footer {
  position: relative;
  margin-top: 4rem;
  background: var(--bg2);;
  overflow: hidden;
}

/* linea glow in cima al footer */
.footer-glow-top {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  box-shadow: 0 0 24px 2px rgba(0,180,255,0.35);
}

/* sottile scanline decorativa in fondo */
.footer-scan {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0,180,255,0.08) 20%,
    rgba(0,180,255,0.22) 50%,
    rgba(0,180,255,0.08) 80%,
    transparent 100%
  );
}

.footer-inner {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
}

/* "in collaborazione con" con linee laterali */
.footer-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
}

.footer-eyebrow-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border2));
}

.footer-eyebrow-line:last-child {
  background: linear-gradient(270deg, transparent, var(--border2));
}

.footer-eyebrow-text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

/* riga loghi */
.footer-logos-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.2rem;
}

.footer-partner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}

.footer-partner-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.1rem;
  background: rgba(0,180,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  min-width: 80px;
  min-height: 60px;
}

.footer-partner-logo-wrap:hover {
  background: var(--blue-dim);
  border-color: var(--border2);
  box-shadow: 0 0 22px rgba(0,180,255,0.12);
}

.footer-logo {
  display: block;        /* rimuove lo spazio baseline sotto l'immagine */
  width: auto;
  object-fit: contain;
}

.footer-partner-logo-wrap a {
  display: flex;         /* l'<a> attorno al logo GDC non introduce spazio extra */
  align-items: center;
  justify-content: center;
}

.footer-logo-awd {
  height: 28px;
  filter: brightness(1.1) drop-shadow(0 0 8px rgba(0,180,255,0.2));
}

.footer-logo-gdc {
  height: 40px;
  border-radius: 8px;
  filter: drop-shadow(0 0 8px rgba(0,180,255,0.15));
}

.footer-partner-name {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* divisore × centrale */
.footer-x-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 1.6rem; /* allineato visivamente con il wrap logo */
}

.footer-x-pip {
  display: block;
  width: 1px;
  height: 12px;
  background: var(--border2);
}

.footer-x-sym {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--blue);
  line-height: 1;
  text-shadow: 0 0 14px rgba(0,180,255,0.5);
}

/* riga bottom */
.footer-bottom {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.footer-sep {
  color: var(--border2);
  font-size: 0.8rem;
}

.footer-tg-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.footer-tg-link:hover {
  color: var(--text);
  text-shadow: 0 0 10px rgba(0,180,255,0.4);
}

a {
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--text);
  text-shadow: 0 0 10px rgba(0,180,255,0.4);
}

@media (max-width: 480px) {
  .footer-logos-row { gap: 1.2rem; }
  .footer-logo-awd { height: 22px; }
  .footer-logo-gdc { height: 34px; }
  .footer-partner-logo-wrap { padding: 0.6rem 0.8rem; min-width: 66px; min-height: 52px; }
}

/* ==============================
   CLASSIFICA (leaderboard)
   ============================== */
.leaderboard-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 3.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.leaderboard-controls .date-filter { min-width: 200px; }

@media (max-width: 700px) {
  .leaderboard-controls { margin-top: 2.5rem; }
  .leaderboard-controls .search-wrap { flex: 1 1 100%; min-width: 100%; order: -1; }
  .leaderboard-controls .date-filter { flex: 1 1 auto; min-width: 0; }
  .leaderboard-controls .gallery-count { flex: 1 1 100%; text-align: center; }
}

/* Riusa lo stesso "segmented control" del filtro GPS della home, per
   coerenza visiva, ma con le due opzioni di ordinamento. */
.lb-sort {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.2rem;
  gap: 0.2rem;
  position: relative;
}

.lb-sort-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.lb-sort-btn:hover { color: var(--text); }

.lb-sort-btn.active {
  color: var(--blue);
}

@media (max-width: 640px) {
  .lb-sort-btn { padding: 0.45rem 0.6rem; font-size: 0.72rem; }
  .lb-sort-btn span { display: none; } /* resta solo l'icona su schermi molto piccoli */
}

@media (max-width: 420px) {
  .lb-sort { width: 100%; }
  .lb-sort-btn { flex: 1; justify-content: center; }
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  transition: var(--transition);
  animation: cardIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
  transform: translateY(12px);
}

.leaderboard-row:hover {
  border-color: var(--border2);
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}

.lb-rank {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
  background: var(--bg3);
  border: 1px solid var(--border);
}

.lb-rank-medal {
  font-size: 1.1rem;
  color: #03141c;
  border: none;
}
.lb-rank-medal.gold   { background: linear-gradient(135deg, #ffd76a, #e8a93a); box-shadow: 0 0 18px rgba(232,169,58,0.5); }
.lb-rank-medal.silver { background: linear-gradient(135deg, #e6edf3, #b7c2cc); box-shadow: 0 0 18px rgba(183,194,204,0.4); }
.lb-rank-medal.bronze { background: linear-gradient(135deg, #d99a63, #a8622f); box-shadow: 0 0 18px rgba(168,98,47,0.4); color: #fff; }

.lb-user {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
}

.lb-username {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lb-user i.fa-at { color: var(--blue); font-size: 0.85rem; }
.lb-user:hover .lb-username { color: var(--blue); }

.lb-subtext {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

.lb-count {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 76px;
  padding: 0.4rem 0.75rem;
  background: var(--blue-dim);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
}

.lb-count-value {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--blue);
  line-height: 1.1;
}

.lb-count-label {
  font-size: 0.62rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 560px) {
  .leaderboard-row { padding: 0.7rem 0.85rem; gap: 0.7rem; }
  .lb-rank { width: 34px; height: 34px; font-size: 0.78rem; }
  .lb-subtext { display: none; }
  .lb-count { min-width: 60px; padding: 0.3rem 0.55rem; }
  .lb-count-value { font-size: 1rem; }
}

/* ==============================
   SITEMAP
   ============================== */
.sitemap-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 2rem;
}

.sitemap-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.3rem;
  text-decoration: none;
  transition: var(--transition);
}

.sitemap-item:hover {
  border-color: var(--border2);
  background: var(--surface2);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,0.4);
}

.sitemap-icon {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-dim);
  border: 1px solid var(--border2);
  color: var(--blue);
  font-size: 1.15rem;
}

.sitemap-body { flex: 1; min-width: 0; }

.sitemap-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.sitemap-desc {
  font-size: 0.82rem;
  color: var(--muted);
}

.sitemap-item .fa-chevron-right {
  color: var(--muted);
  font-size: 0.85rem;
  transition: var(--transition);
}
.sitemap-item:hover .fa-chevron-right { color: var(--blue); transform: translateX(3px); }
