:root {
  --bg-main: #0b1320;
  --bg-card: #152238;
  --bg-card-hover: #1c2d4a;
  --border: #243552;
  --primary: #38bdf8;
  --accent: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --badge-bg: #1e293b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; 
  background: var(--bg-main); 
  color: var(--text-main); 
  min-height: 100vh; 
  display: flex; 
  flex-direction: column;
  overflow-x: hidden;
}

/* Header & Nav Responsive */
header {
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.5px;
}
.brand span { color: var(--primary); }

nav { 
  display: flex; 
  align-items: center; 
  gap: 4px; 
  flex-wrap: wrap; 
}
nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}
nav a:hover, nav a.active { color: #fff; background: var(--bg-card); }
nav a.active { color: var(--primary); }

.btn-cta {
  background: var(--primary);
  color: #0b1320 !important;
  font-weight: 700 !important;
  padding: 6px 14px !important;
  border-radius: 6px;
}
.btn-cta:hover { background: #7dd3fc !important; }

/* Main Layout */
main { flex: 1; display: flex; flex-direction: column; }
.container { 
  max-width: 1200px; 
  margin: 0 auto; 
  padding: 30px 16px; 
  width: 100%; 
}

/* Hero Section Ottimizzata */
.hero-original {
  position: relative;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px 80px;
  background-color: #0b1320;
  background-image: 
    linear-gradient(180deg, rgba(11, 19, 32, 0.65) 0%, rgba(11, 19, 32, 0.95) 100%),
    url('images/hero-home.jpg');
  background-position: center center;
  background-size: cover;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
}

.hero-content { 
  max-width: 800px; 
  z-index: 10; 
}
.hero-content h1 {
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 900;
  line-height: 1.2;
  color: #fff;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}
.hero-content p {
  font-size: clamp(15px, 2.5vw, 18px);
  color: #cbd5e1;
  line-height: 1.6;
  margin: 0 auto;
  max-width: 680px;
}

/* Features Grid 01, 02, 03 */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: -40px;
  position: relative;
  z-index: 20;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, border-color 0.2s;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
.feature-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  background: var(--bg-card-hover);
}
.feature-num {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 8px;
}
.feature-card h3 {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
}
.feature-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 22px;
  flex: 1;
}
.btn-scopri {
  display: inline-block;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-decoration: none;
  color: var(--primary);
  text-transform: uppercase;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 9px 16px;
  border-radius: 6px;
  text-align: center;
  transition: all 0.2s;
}
.btn-scopri:hover {
  background: var(--primary);
  color: #0b1320;
}

/* Stats Bar Responsive */
.stats-bar {
  margin-top: 50px; 
  padding: 24px 16px; 
  background: var(--bg-card); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  display: grid; 
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); 
  gap: 20px; 
  text-align: center;
}
.stats-num {
  font-size: clamp(26px, 4vw, 34px); 
  font-weight: 900; 
  color: var(--primary);
}
.stats-label {
  font-size: 12px; 
  color: var(--text-muted); 
  text-transform: uppercase; 
  font-weight: 700; 
  margin-top: 4px;
}

/* Footer */
footer {
  background: #0f172a;
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: auto;
}

/* Breakpoints Mobile */
@media (max-width: 768px) {
  header { padding: 12px 16px; }
  nav { width: 100%; justify-content: flex-start; overflow-x: auto; padding-bottom: 4px; }
  .features-grid { margin-top: 20px; }
  .hero-original { padding: 40px 16px 50px; min-height: 320px; }
}

/* Subpage Hero con background coerente */
.hero-subpage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 55px 20px 50px;
  background-color: #0b1320;
  background-image: 
    linear-gradient(180deg, rgba(11, 19, 32, 0.7) 0%, rgba(11, 19, 32, 0.98) 100%),
    url('images/hero-home.jpg');
  background-position: center 30%;
  background-size: cover;
  background-repeat: no-repeat;
  border-bottom: 1px solid var(--border);
}
.hero-subpage-content {
  max-width: 780px;
  z-index: 10;
}
.hero-subpage-content h1 {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.hero-subpage-content p {
  font-size: clamp(14px, 2vw, 17px);
  color: #cbd5e1;
  line-height: 1.5;
  margin: 0 auto;
}

/* Card layout e dettagli per Chi Siamo, Blog e Contatto */
.content-grid-2col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}
.info-card-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
}
.info-card-box h2 {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 14px;
}
.info-card-box p {
  font-size: 15px;
  color: #cbd5e1;
  line-height: 1.7;
  margin-bottom: 14px;
}

@media (max-width: 850px) {
  .content-grid-2col { grid-template-columns: 1fr; }
  .hero-subpage { padding: 40px 16px 36px; }
}

/* Hamburger Button */
.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  padding: 6px 10px;
  font-size: 20px;
  cursor: pointer;
}

/* Mobile Drawer Overlay */
@media (max-width: 820px) {
  .menu-btn { display: block; }
  
  nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: #0f172a;
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    padding: 60px 20px 20px;
    gap: 8px;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 25px rgba(0,0,0,0.5);
    z-index: 1001;
  }
  
  nav.open { right: 0; }
  
  nav a {
    width: 100%;
    padding: 10px 14px;
    font-size: 15px;
  }
  
  .btn-cta {
    margin-left: 0 !important;
    margin-top: 10px;
    text-align: center;
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(3px);
    z-index: 1000;
  }
  .nav-backdrop.show { display: block; }
  
  .menu-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
  }
}


/* --- Fix Navbar & Brand --- */
header .brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff !important;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.02em;
}
header .brand span {
    color: var(--primary, #38bdf8) !important;
}

/* Regole Desktop (schermi larghi >= 992px) */
@media (min-width: 992px) {
    .menu-btn, .menu-close-btn, .nav-backdrop {
        display: none !important;
    }
    header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 32px;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    nav {
        display: flex !important;
        position: static !important;
        flex-direction: row !important;
        width: auto !important;
        height: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        align-items: center;
        gap: 14px;
        padding: 0 !important;
    }
    nav a {
        color: #cbd5e1;
        text-decoration: none;
        font-size: 0.92rem;
        padding: 8px 12px;
        border-radius: 6px;
        transition: all 0.2s ease;
    }
    nav a:hover, nav a.active {
        color: #ffffff;
        background: rgba(255, 255, 255, 0.08);
    }
    nav a.btn-cta {
        background: var(--primary, #0284c7);
        color: #ffffff !important;
        font-weight: 600;
        padding: 8px 18px;
    }
}

/* Regole Mobile (schermi < 992px) */
@media (max-width: 991px) {
    .menu-btn {
        display: block !important;
        background: transparent;
        border: none;
        color: #ffffff;
        font-size: 1.6rem;
        cursor: pointer;
        padding: 4px 8px;
    }
    .menu-close-btn {
        display: block !important;
        background: transparent;
        border: none;
        color: #ffffff;
        font-size: 2rem;
        align-self: flex-end;
        cursor: pointer;
        margin-bottom: 16px;
        padding: 0;
        line-height: 1;
    }
    nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: #0f172a;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
        display: flex;
        flex-direction: column;
        padding: 24px;
        gap: 12px;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
    }
    nav.open {
        right: 0;
    }
    nav a {
        color: #e2e8f0;
        text-decoration: none;
        font-size: 1.05rem;
        padding: 10px 14px;
        border-radius: 8px;
    }
    nav a:hover, nav a.active {
        background: rgba(255, 255, 255, 0.05);
        color: #38bdf8;
    }
    nav a.btn-cta {
        background: #0284c7;
        color: #fff !important;
        text-align: center;
        margin-top: 8px;
    }
    .nav-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(4px);
        z-index: 999;
    }
    .nav-backdrop.show {
        display: block;
    }
}


/* --- Spaziatura Search & Filter Bar Calendario --- */
.search-container, .filter-bar, .search-box-wrapper {
    margin: 28px auto 36px auto;
    padding: 0 16px;
    max-width: 900px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    justify-content: center;
}

.search-container input[type="text"],
.search-box-wrapper input[type="text"],
#search-input {
    min-height: 48px;
    padding: 12px 18px;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: #1e293b;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    flex: 1 1 300px;
}

@media (max-width: 768px) {
    .search-container, .filter-bar, .search-box-wrapper {
        margin: 20px auto 24px auto;
        padding: 0 12px;
        flex-direction: column;
        width: 100%;
    }
    .search-container input[type="text"],
    .search-box-wrapper input[type="text"],
    #search-input {
        width: 100%;
    }
}

/* --- Spaziatura Header e Search Calendario --- */
.calendar-header-text h2 {
    margin-bottom: 8px;
}

.calendar-header-text p {
    color: #94a3b8;
    margin-bottom: 0;
    font-size: 0.98rem;
}

.calendar-search-wrap {
    display: flex;
    align-items: center;
}

.calendar-search-wrap #search-box {
    padding: 12px 18px;
    font-size: 0.95rem;
    border-radius: 8px;
    border: 1px solid var(--border, rgba(255, 255, 255, 0.15));
    background: var(--bg-card, #1e293b);
    color: #ffffff;
    width: 320px;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.calendar-search-wrap #search-box:focus {
    border-color: var(--primary, #38bdf8);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

/* Su Desktop: contenitore separato e allineato ai lati */
@media (min-width: 769px) {
    .calendar-header-text + .calendar-search-wrap {
        margin-top: 20px;
        margin-bottom: 32px;
    }
}

/* Su Mobile: campo di ricerca a tutta larghezza e distanziato */
@media (max-width: 768px) {
    .calendar-search-wrap {
        width: 100%;
        margin-top: 18px;
        margin-bottom: 24px;
    }
    .calendar-search-wrap #search-box {
        width: 100%;
    }
}

/* ==========================================================================
   Restyling Card Escursioni & Griglia (Calendario / Tipo Attività)
   ========================================================================== */
.calendar-month, .category-block {
    margin-bottom: 48px;
}

.month-header, .cat-heading {
    font-size: 1.35rem;
    font-weight: 700;
    color: #f8fafc;
    padding-bottom: 12px;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(56, 189, 248, 0.25);
    display: flex;
    align-items: center;
    gap: 10px;
}

.diff-heading {
    font-size: 1.05rem;
    font-weight: 600;
    color: #94a3b8;
    margin: 24px 0 14px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Griglia Card Responsive */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Singola Card Escursione */
.event-card {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.event-card:hover {
    transform: translateY(-3px);
    border-color: rgba(56, 189, 248, 0.4);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

/* Header Card: Data e Sezione */
.event-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.badge {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.badge-diff {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-orange {
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.3);
}

/* Titolo e Corpo */
.event-card .card-body h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.4;
    margin-bottom: 12px;
}

/* Metriche Tecniche */
.card-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 0.84rem;
    color: #94a3b8;
}

.card-metrics span {
    background: rgba(15, 23, 42, 0.6);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-metrics strong {
    color: #f1f5f9;
}

/* Itinerario e Tappe */
.card-tappe {
    font-size: 0.85rem;
    color: #cbd5e1;
    background: rgba(15, 23, 42, 0.4);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #38bdf8;
    line-height: 1.4;
}

/* Quick Nav Badge in attivita.html */
#quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}

#quick-nav a {
    text-decoration: none;
    transition: all 0.2s ease;
}

#quick-nav a:hover {
    background: #38bdf8;
    color: #0f172a;
}

/* ==========================================================================
   Layout Mappa Geografica (mappa.html)
   ========================================================================== */
.map-layout {
    display: flex;
    height: calc(100vh - 72px);
    position: relative;
    overflow: hidden;
}

#map {
    flex: 1 1 65%;
    height: 100%;
    z-index: 1;
}

.map-sidebar {
    flex: 0 0 420px;
    max-width: 420px;
    height: 100%;
    overflow-y: auto;
    background: #0f172a;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.35);
    z-index: 2;
}

@media (max-width: 900px) {
    .map-layout {
        flex-direction: column;
        height: auto;
    }
    #map {
        height: 55vh;
        width: 100%;
    }
    .map-sidebar {
        flex: 1 1 auto;
        max-width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
}

/* ==========================================================================
   Layout Agenda a Fisarmonica (Calendario)
   ========================================================================== */
.agenda-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agenda-item {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
}

.agenda-item:hover {
    border-color: rgba(56, 189, 248, 0.4);
    background: #243248;
}

.agenda-summary {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    gap: 16px;
}

.agenda-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 4px 8px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.agenda-date .day-num {
    font-size: 1.25rem;
    font-weight: 700;
    color: #38bdf8;
    line-height: 1;
}

.agenda-date .day-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
}

.agenda-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.agenda-title {
    font-size: 1.02rem;
    font-weight: 600;
    color: #ffffff;
}

.agenda-tags {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.agenda-icon {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.25s ease;
    margin-left: 8px;
}

.agenda-item.open .agenda-icon {
    transform: rotate(180deg);
    color: #38bdf8;
}

.agenda-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.5);
    border-top: 1px solid transparent;
}

.agenda-item.open .agenda-details {
    max-height: 500px;
    border-top-color: rgba(255, 255, 255, 0.08);
}

.agenda-details-inner {
    padding: 16px 20px 20px 20px;
}

@media (max-width: 640px) {
    .agenda-summary {
        padding: 10px 14px;
        gap: 12px;
    }
    .agenda-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* ==========================================================================
   Stili Marker e Pin Mappa Leaflet
   ========================================================================== */
.pin-primary {
    background-color: #38bdf8;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6), 0 0 12px rgba(56, 189, 248, 0.5);
    width: 14px !important;
    height: 14px !important;
    cursor: pointer;
}

.pin-sub {
    background-color: #fb923c;
    border: 2px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
    width: 10px !important;
    height: 10px !important;
    cursor: pointer;
}

/* Fix contenitore mappa e popup */
#map {
    width: 100%;
    height: 100%;
    min-height: 450px;
    background: #0b1120;
}

.leaflet-popup-content-wrapper {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-tip {
    background: #ffffff;
}

/* ==========================================================================
   Marker Leaflet & Layout Area Geografica
   ========================================================================== */
.pin-primary {
    background: #38bdf8 !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.8), 0 2px 6px rgba(0,0,0,0.6);
    width: 14px !important;
    height: 14px !important;
    display: block;
    cursor: pointer;
}

.pin-sub {
    background: #fb923c !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 0 8px rgba(251, 146, 60, 0.8), 0 2px 6px rgba(0,0,0,0.6);
    width: 10px !important;
    height: 10px !important;
    display: block;
    cursor: pointer;
}

.map-layout {
    display: flex;
    height: calc(100vh - 72px);
    width: 100%;
    position: relative;
    overflow: hidden;
}

#map {
    flex: 1 1 65%;
    height: 100%;
    min-height: 400px;
    background: #0f172a;
    z-index: 1;
}

.map-sidebar {
    flex: 0 0 420px;
    max-width: 420px;
    height: 100%;
    overflow-y: auto;
    background: #0f172a;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    padding: 20px;
    z-index: 2;
}

.leaflet-popup-content-wrapper {
    background: #1e293b !important;
    color: #f8fafc !important;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.leaflet-popup-tip {
    background: #1e293b !important;
}

@media (max-width: 900px) {
    .map-layout {
        flex-direction: column;
        height: auto;
    }
    #map {
        height: 50vh;
        width: 100%;
    }
    .map-sidebar {
        flex: 1 1 auto;
        max-width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
}

/* ==========================================================================
   Toggle Filtro Temporale (Future / Passate)
   ========================================================================== */
.time-toggle-group {
    display: inline-flex;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 3px;
    gap: 4px;
}

.time-toggle-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-toggle-btn.active {
    background: var(--primary, #38bdf8);
    color: #0f172a;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.time-toggle-btn:hover:not(.active) {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}


/* ==========================================================================
   Slot Pubblicitari e Sponsorizzazioni (Montagna Click)
   ========================================================================== */
.ad-slot-wrapper {
    margin: 28px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 970px;
    box-sizing: border-box;
    clear: both;
}

.ad-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    margin-bottom: 6px;
    align-self: center;
}

.ad-slot {
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    min-height: 90px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #475569;
    font-size: 0.85rem;
}

.ad-slot.ad-leaderboard {
    max-width: 728px;
    height: 90px;
}

.ad-slot.ad-box {
    max-width: 336px;
    height: 280px;
}

.ad-slot.ad-in-feed {
    margin: 16px 0;
    min-height: 100px;
    border-color: rgba(56, 189, 248, 0.2);
}

@media (max-width: 768px) {
    .ad-slot.ad-leaderboard {
        max-width: 320px;
        height: 100px;
    }
}


/* --- OTTIMIZZAZIONI ACCESSIBILITA (WCAG AA) & TOUCH TARGET --- */
.stats-label, .meta-label, .sub-label, .filter-label {
    color: #cbd5e1 !important; /* Contrasto elevato rispetto a #0f172a (supera 7:1) */
}
header nav a, .time-toggle-btn, .btn, .btn-cta, button {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- OTTIMIZZAZIONI ACCESSIBILITA (WCAG AA) & TOUCH TARGET --- */
.stats-label, .meta-label, .sub-label, .filter-label {
    color: #cbd5e1 !important;
}
header nav a, .time-toggle-btn, .btn, .btn-cta, button {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Touch target minimi raccomandati da Lighthouse (min 48x48px) */
header nav a, .time-toggle-btn, .btn, .btn-cta, .btn-scopri, button {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/* Contrasto globale rinforzato per superare WCAG AA (Lighthouse) */
p, span, time, .hero-lead, .card-date, .card-desc, .event-meta, .section-subtitle, .badge {
    color: #e2e8f0;
}
.text-muted, .dimmed, .subtitle, footer, footer p {
    color: #cbd5e1 !important;
}


/* --- DROPDOWN NAV STYLES --- */
.nav-item-dropdown {
    position: relative;
    display: inline-block;
}
.dropdown-trigger {
    background: none;
    border: none;
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    transition: color 0.2s;
}
.dropdown-trigger:hover {
    color: #38bdf8;
}
.dropdown-trigger .arrow {
    font-size: 0.75rem;
    transition: transform 0.2s;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    z-index: 1000;
}
.dropdown-menu a {
    display: block;
    padding: 8px 16px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.dropdown-menu a:hover {
    background: #1e293b;
    color: #38bdf8;
}
/* Desktop hover */
@media (min-width: 851px) {
    .nav-item-dropdown:hover .dropdown-menu {
        display: block;
    }
    .nav-item-dropdown:hover .arrow {
        transform: rotate(180deg);
    }
}
/* Mobile layout */
@media (max-width: 850px) {
    .nav-item-dropdown {
        display: block;
        width: 100%;
    }
    .dropdown-trigger {
        width: 100%;
        justify-content: space-between;
        padding: 12px 16px;
    }
    .dropdown-menu {
        position: static;
        background: #090d16;
        border: none;
        box-shadow: none;
        padding-left: 15px;
    }
    .nav-item-dropdown.dropdown-open .dropdown-menu {
        display: block;
    }
    .nav-item-dropdown.dropdown-open .arrow {
        transform: rotate(180deg);
    }
}


/* Hero Section Ottimizzata con foto personale */
.hero-original {
    background-color: #0b1320;
    background-image: linear-gradient(rgba(11, 19, 32, 0.6), rgba(11, 19, 32, 0.7)), url('images/hero-home.jpg') !important;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

/* Subpage Hero con sfondo coerente */
.hero-subpage {
    background-color: #0b1320;
    background-image: linear-gradient(rgba(11, 19, 32, 0.6), rgba(11, 19, 32, 0.7)), url('images/destinazioni-rifugi.jpg') !important;
    background-position: center 30%;
    background-size: cover;
    background-repeat: no-repeat;
}
