/* SONARA — Map view (shared) */

.map-with-rail {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
@media (max-width: 1080px) {
  .map-with-rail { grid-template-columns: 1fr; }
}
.map-with-rail > .map-view { min-width: 0; }

.map-view {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ─── Opt-in banner (top of map) ─── */
.map-optin-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(123,85,208,0.10) 0%, rgba(217,119,87,0.05) 80%);
  border: 1px solid rgba(123,85,208,0.24);
  font-size: 13px;
}
.map-optin-banner .ic {
  width: 30px; height: 30px;
  border-radius: 10px;
  background: rgba(123,85,208,0.18);
  color: var(--violet-bright, #7b55d0);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.map-optin-banner .meta {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  color: var(--foreground);
}
.map-optin-banner .meta .dot { color: color-mix(in oklab, var(--muted-foreground) 50%, transparent); }
.map-optin-banner .meta span:not(.dot) { color: var(--muted-foreground); }
.map-optin-banner strong { color: var(--foreground); font-weight: 600; }
.map-optin-banner .opt-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--violet-bright, #7b55d0);
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(123,85,208,0.30);
  background: rgba(123,85,208,0.06);
}
.map-optin-banner .opt-link:hover {
  background: rgba(123,85,208,0.14);
}

/* ─── Controls row ─── */
.map-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.map-chip {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 150ms;
}
.map-chip:hover { background: var(--muted); border-color: var(--muted-foreground); }
.map-chip.active {
  background: var(--violet, #7b55d0);
  color: white;
  border-color: var(--violet, #7b55d0);
  box-shadow: 0 4px 12px -4px rgba(123,85,208,0.5);
}
.map-radius {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  color: var(--muted-foreground);
}
.map-radius .lbl { font-weight: 500; }
.map-radius .v {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: right;
}
.map-radius input[type="range"] {
  -webkit-appearance: none;
  width: 110px;
  height: 4px;
  background: var(--muted);
  border-radius: 999px;
  outline: 0;
}
.map-radius input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--violet, #7b55d0);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.map-radius input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px;
  border: 0;
  border-radius: 999px;
  background: var(--violet, #7b55d0);
  cursor: pointer;
}
.map-spacer { flex: 1; }
.map-legend {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--muted-foreground);
}
.map-legend .lg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.lg-dot {
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--violet-bright, #7b55d0);
  border: 2px solid var(--card);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px;
  font-weight: 800;
  color: white;
  box-shadow: 0 0 0 1px var(--border);
}
.lg-dot.producer { background: var(--violet, #7b55d0); }
.lg-dot.artisti { background: linear-gradient(135deg, #f59e0b, #d97757); }
.lg-dot.studio { background: #16a34a; color: white; }
.lg-dot.verified { background: white; color: var(--violet); }

/* ─── Map canvas ─── */
.map-canvas {
  height: 620px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card);
  position: relative;
  z-index: 1;
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset, 0 14px 36px -18px rgba(46,24,102,0.30);
}
@media (max-width: 768px) {
  .map-canvas { height: 480px; border-radius: 14px; }
}

/* Leaflet container reset to match theme */
.leaflet-container {
  background: var(--card) !important;
  font-family: var(--font-sans) !important;
}
.leaflet-control-zoom a {
  background: var(--card) !important;
  color: var(--foreground) !important;
  border-color: var(--border) !important;
}

/* ─── Avatar Pins ─── */
.sn-pin { background: transparent !important; border: 0 !important; }
.sn-pin-inner {
  width: 48px; height: 54px;
  position: relative;
  cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
  transition: transform 180ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
.sn-pin-inner:hover { transform: translateY(-3px) scale(1.08); }

.sn-pin-av {
  width: 44px; height: 44px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0;
  border: 3px solid white;
  box-shadow:
    0 0 0 2px var(--violet, #7b55d0),
    0 4px 12px rgba(0,0,0,0.25);
  position: absolute;
  top: 0; left: 2px;
}
.sn-pin-inner.artisti .sn-pin-av {
  box-shadow:
    0 0 0 2px #d97757,
    0 4px 12px rgba(0,0,0,0.25);
}
.sn-pin-inner.is-studio .sn-pin-av {
  box-shadow:
    0 0 0 2px #16a34a,
    0 4px 12px rgba(0,0,0,0.25);
}
.sn-pin-av.art-a { background: linear-gradient(135deg, #41228e, #6b4bb8 70%); }
.sn-pin-av.art-b { background: linear-gradient(135deg, #2e1866, #41228e 60%, #16a34a); }
.sn-pin-av.art-c { background: linear-gradient(135deg, #6b4bb8, #ec4899 80%); }
.sn-pin-av.art-d { background: linear-gradient(135deg, #f59e0b, #41228e 70%); }
.sn-pin-av.art-e { background: linear-gradient(135deg, #16a34a, #41228e 70%); }
.sn-pin-av.art-f { background: linear-gradient(135deg, #0ea5e9, #6b4bb8 70%); }

.sn-pin-pointer {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid white;
  filter: drop-shadow(0 1px 0 rgba(123,85,208,1));
}
.sn-pin-inner.artisti .sn-pin-pointer { filter: drop-shadow(0 1px 0 #d97757); }
.sn-pin-inner.is-studio .sn-pin-pointer { filter: drop-shadow(0 1px 0 #16a34a); }

.sn-pin-verified {
  position: absolute;
  top: -2px; right: -2px;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--violet, #7b55d0);
  color: white;
  font-size: 11px;
  font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid white;
}
.sn-pin-studio {
  position: absolute;
  bottom: 8px; right: -4px;
  width: 18px; height: 18px;
  border-radius: 999px;
  background: #16a34a;
  color: white;
  font-size: 10px;
  font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid white;
  letter-spacing: 0;
}

/* ─── Cluster ─── */
.sn-cluster-wrap { background: transparent !important; border: 0 !important; }
.sn-cluster {
  width: 44px; height: 44px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--violet-bright, #7b55d0), var(--violet, #41228e));
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 3px solid white;
  box-shadow: 0 6px 16px rgba(65,34,142,0.4), 0 0 0 6px rgba(123,85,208,0.18);
  transition: transform 180ms;
}
.sn-cluster-wrap:hover .sn-cluster { transform: scale(1.08); }

/* ─── Popup card (floating bottom-right) ─── */
.map-popup-card {
  position: absolute;
  z-index: 30;
  bottom: 26px;
  right: 26px;
  width: 320px;
  max-width: calc(100% - 32px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px -18px rgba(0,0,0,0.45), 0 0 0 1px rgba(123,85,208,0.15);
  padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  animation: mpop 240ms cubic-bezier(0.25, 0.1, 0.25, 1);
}
@keyframes mpop {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.map-popup-card .close {
  position: absolute;
  top: 10px; right: 10px;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--muted);
  border: 0;
  color: var(--muted-foreground);
  cursor: pointer;
  font-size: 12px;
}
.map-popup-card .close:hover { background: var(--border); color: var(--foreground); }

.map-popup-card .head {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
}
.map-popup-card .head .av {
  width: 44px; height: 44px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.map-popup-card .head .av.art-a { background: linear-gradient(135deg, #41228e, #6b4bb8); }
.map-popup-card .head .av.art-b { background: linear-gradient(135deg, #2e1866, #16a34a); }
.map-popup-card .head .av.art-c { background: linear-gradient(135deg, #6b4bb8, #ec4899); }
.map-popup-card .head .av.art-d { background: linear-gradient(135deg, #f59e0b, #41228e); }
.map-popup-card .head .av.art-e { background: linear-gradient(135deg, #16a34a, #41228e); }
.map-popup-card .head .av.art-f { background: linear-gradient(135deg, #0ea5e9, #6b4bb8); }
.map-popup-card .head .meta { min-width: 0; }
.map-popup-card .head .nm {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  color: var(--foreground);
  display: inline-flex; align-items: center; gap: 6px;
}
.map-popup-card .head .nm .ver { color: var(--violet-bright, #7b55d0); display: inline-flex; }
.map-popup-card .head .city {
  font-size: 11.5px;
  color: var(--muted-foreground);
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 2px;
}
.map-popup-card .head .rating {
  font-size: 12.5px;
  color: var(--foreground);
  display: inline-flex; align-items: center; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.map-popup-card .head .rating .muted { color: var(--muted-foreground); font-size: 11px; }

.map-popup-card .tags {
  display: flex; flex-wrap: wrap; gap: 5px;
}
.map-popup-card .tags .tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--muted);
  border: 1px solid var(--border);
  color: var(--foreground);
  font-weight: 500;
}
.map-popup-card .tags .studio-tag {
  background: rgba(22,163,74,0.14);
  color: #16a34a;
  border-color: rgba(22,163,74,0.30);
  display: inline-flex; align-items: center; gap: 4px;
}

.map-popup-card .stats {
  font-size: 12px;
  color: var(--muted-foreground);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.map-popup-card .stats .sep { opacity: 0.5; }
.map-popup-card .stats strong { color: var(--foreground); font-weight: 700; font-variant-numeric: tabular-nums; }

.map-popup-card .play-row {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--background);
  cursor: pointer;
  text-align: left;
}
.map-popup-card .play-row:hover { border-color: var(--violet-bright, #7b55d0); }
.map-popup-card .play-row .play-btn {
  width: 32px; height: 32px;
  border-radius: 999px;
  background: var(--violet, #7b55d0);
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
}
.map-popup-card .play-row .play-meta { min-width: 0; }
.map-popup-card .play-row .t {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--foreground);
}
.map-popup-card .play-row .s {
  display: block;
  font-size: 11px;
  color: var(--muted-foreground);
  margin-top: 1px;
}

.map-popup-card .actions {
  display: flex;
  gap: 8px;
}
.map-popup-card .actions button,
.map-popup-card .actions a {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  text-decoration: none;
  transition: all 150ms;
}
.map-popup-card .actions .ghost {
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
}
.map-popup-card .actions .ghost:hover { background: var(--muted); }
.map-popup-card .actions .primary {
  background: var(--violet, #7b55d0);
  color: white;
  border: 0;
  box-shadow: 0 4px 12px -4px rgba(123,85,208,0.5);
}
.map-popup-card .actions .primary:hover { background: var(--violet-light, #6b4bb8); transform: translateY(-1px); }

@media (max-width: 720px) {
  .map-popup-card { left: 12px; right: 12px; bottom: 12px; width: auto; }
}

/* ─── View toggle (Lista/Mappa) in toolbar ─── */
.view-toggle {
  display: inline-flex;
  background: var(--muted);
  border: 1px solid var(--border);
  padding: 3px;
  border-radius: 10px;
  gap: 2px;
}
.view-toggle button {
  padding: 6px 12px;
  border-radius: 7px;
  background: transparent;
  border: 0;
  color: var(--muted-foreground);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  transition: all 120ms;
}
.view-toggle button:hover { color: var(--foreground); }
.view-toggle button.active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}
