/* ============================================================
 MAP UI / FINAL DESIGN
 Includes:
 - Floating controls
 - Card Animation
 - Dark Mode
 - Bounce animation
 - Scrollable popup content
============================================================ */

:root {
  --accent: #3bd2c9;
  --bg: #ffffff;
  --text: #191919;
  --card: #ffffff;
}

body.dark-mode {
  --bg: #111;
  --text: #ffffff;
  --card: #1c1c1c;
}

/* Map fullscreen */
#map {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Theme button */
.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 2000;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--accent);
  font-size: 18px;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Floating filter buttons */
.map-filters-scroll {
  position: fixed;
  top: 90px;
  left: 0;
  width: 100%;
  padding: 10px;
  overflow-x: auto;
  z-index: 1200;
}

.map-controls {
  display: flex;
  gap: 12px;
  padding: 0 22px; /* Aumenta lo spazio a sinistra e destra */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* --- Nasconde scrollbar su tutti i browser --- */

/* Safari / Chrome / Edge */
.map-filters-scroll::-webkit-scrollbar,
.map-controls::-webkit-scrollbar {
  display: none;
}

/* Firefox */
.map-filters-scroll,
.map-controls {
  scrollbar-width: none;
}

.map-filter-btn {
  white-space: nowrap;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--accent);
  border-radius: 100px;
  padding: 8px 14px;
  font-family: inherit;
  display: flex;
  gap: 6px;
  align-items: center;
}

.map-filter-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Bottom Card */
#map-card {
  position: fixed;
  bottom: -300px;
  left: 0;
  width: 100%;
  padding: 0;
  transition: 0.35s cubic-bezier(0.25, 1, 0.3, 1);
  z-index: 1500;
}

#map-card.visible {
  bottom: 0;
}

.map-card-inner {
  background: var(--card);
  color: var(--text);
  border-radius: 18px 18px 0 0;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.map-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.map-card-icon {
  width: 34px;
  height: 34px;
}

.map-card-category {
  opacity: 0.6;
  font-size: 12px;
}

.map-card-title {
  font-size: 18px;
  margin: 2px 0;
}

/* Area scrollabile del testo */
.map-card-scroll {
  max-height: 50vh;              /* altezza massima del contenuto */
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;         /* Firefox */
  -webkit-overflow-scrolling: touch;
}

.map-card-desc {
  font-size: 14px;
  margin: 6px 0 12px;
}

/* scrollbar style (optional, premium) */
.map-card-scroll::-webkit-scrollbar {
  width: 6px;
}
.map-card-scroll::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 150, 0.6);
  border-radius: 6px;
}
.map-card-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.map-card-btn {
  background: var(--accent);
  color: white;
  padding: 10px 18px;
  text-decoration: none;
  border-radius: 100px;
  font-weight: 600;
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
}

/* Marker bounce animation */
.bounce {
  animation: markerBounce 0.5s ease;
}

/* Force buttons to stay side-by-side */
.map-card-btn-row {
  display: flex;
  gap: 10px;
  width: 100%;
}

/* Each button takes 50% width and stays aligned */
.map-card-btn-row .map-card-btn {
  flex: 1;
  text-align: center;
  padding: 12px 10px;
  font-size: 14px;
  white-space: nowrap; /* prevents line break */
}

/* Style second button */
.secondary-btn {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
}
.secondary-btn:hover {
  background: var(--accent);
  color: white;
}

.fixed-ring {
  border: 3px solid #3BD2C9;
  border-radius: 50%;
  width: 54px;
  height: 54px;
  box-sizing: border-box;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

/* If screen is VERY small (<320px), auto resize text */
@media (max-width: 330px) {
  .map-card-btn-row .map-card-btn {
    font-size: 12px;
    padding: 10px 6px;
  }
}


@keyframes markerBounce {
  0% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  100% { transform: translateY(0); }
}

/* === ANIMAZIONE FILTRI — MOBILE DEFAULT (solo se attivata via JS) === */
.filters-animate .map-filter-btn {
  opacity: 0;
  transform: translateX(40px);
  animation: slideIn 0.45s ease-out forwards;
}

/* Effetto cascata */
.filters-animate .map-filter-btn:nth-child(1) { animation-delay: 0.05s; }
.filters-animate .map-filter-btn:nth-child(2) { animation-delay: 0.15s; }
.filters-animate .map-filter-btn:nth-child(3) { animation-delay: 0.25s; }
.filters-animate .map-filter-btn:nth-child(4) { animation-delay: 0.35s; }
.filters-animate .map-filter-btn:nth-child(5) { animation-delay: 0.45s; }

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* === DESKTOP: niente animazione === */
@media (min-width: 768px) {
  .filters-animate .map-filter-btn {
    opacity: 1;
    transform: none;
    animation: none;
  }
}









