/* ============================================================
   Mapa — "Nuestro Territorio" · design-system pass (v2)
   Editorial hero + keyless dark basemap + Discoteca-style rail.
   Tokens mirror DESIGN_SYSTEM.md / Discoteca (--d-*).
   ============================================================ */

:root {
  --m-primary: #ff4d00;
  --m-primary-dim: rgba(255, 77, 0, 0.14);
  --m-success: #00ff88;
  --m-yellow: #f5c518;
  --m-bg: #0a0a0a;
  --m-card: #141414;
  --m-card-2: #1a1a1a;
  --m-line: rgba(255, 255, 255, 0.08);
  --m-text-dim: rgba(255, 255, 255, 0.55);
  --m-text-faint: rgba(255, 255, 255, 0.32);
  --m-font: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --m-mono: 'Space Mono', ui-monospace, SFMono-Regular, monospace;
}

.map-page {
  background: var(--m-bg);
  color: #fff;
  font-family: var(--m-font);
}

/* ===== Map section ===== */

.map-section {
  position: relative;
  background: var(--m-bg);
  padding: 0;
}

.map-cities {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: calc(100vh - 161px);
  min-height: 640px;
}

.city-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--m-card);
}

.city-panel + .city-panel {
  border-left: 1px solid var(--m-line);
}

.city-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--m-line);
  background: var(--m-card);
}

.city-panel-name {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--m-mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  margin: 0;
}

.city-panel-name::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--m-primary);
  box-shadow: 0 0 10px rgba(255, 77, 0, 0.7);
}

.city-panel-meta {
  font-family: var(--m-mono);
  font-size: 0.7rem;
  color: var(--m-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.city-map {
  position: relative;
  flex: 1;
  min-height: 0;
  background: var(--m-bg);
}

#venueMap-barcelona,
#venueMap-mexico-city {
  width: 100%;
  height: 100%;
  background: var(--m-bg);
  z-index: 1;
}

/* ===== Leaflet / MapLibre dark chrome ===== */

.leaflet-container {
  font-family: var(--m-font);
  background: var(--m-bg);
}

.leaflet-control-zoom a {
  background: var(--m-card-2) !important;
  color: #fff !important;
  border: 1px solid var(--m-line) !important;
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  font-size: 18px !important;
  transition:
    background 0.2s,
    color 0.2s;
}

.leaflet-control-zoom a:hover {
  background: var(--m-primary) !important;
  color: #0a0a0a !important;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
  border-radius: 10px !important;
  overflow: hidden;
}

.leaflet-control-zoom-in {
  border-bottom: 1px solid var(--m-line) !important;
}

.leaflet-control-attribution {
  background: rgba(10, 10, 10, 0.82) !important;
  color: rgba(255, 255, 255, 0.3) !important;
  font-size: 10px !important;
  padding: 3px 8px !important;
  border-radius: 6px 0 0 0 !important;
}

.leaflet-control-attribution a {
  color: rgba(255, 77, 0, 0.65) !important;
}

/* ===== Marker ===== */

.venue-marker-icon {
  background: none !important;
  border: none !important;
}

.marker-pin {
  width: 32px;
  height: 32px;
  background: var(--m-primary);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(255, 77, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.marker-pin svg {
  transform: rotate(45deg);
}

.venue-marker-icon:hover .marker-pin {
  transform: rotate(-45deg) scale(1.15);
  box-shadow: 0 6px 22px rgba(255, 77, 0, 0.65);
}

.marker-pulse {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 77, 0, 0.32);
  animation: map-pulse 2s ease-out infinite;
  pointer-events: none;
}

@keyframes map-pulse {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* ===== Popups ===== */

.leaflet-popup-content-wrapper {
  background: var(--m-card-2) !important;
  color: #fff !important;
  border-radius: 12px !important;
  border: 1px solid rgba(255, 77, 0, 0.25) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  padding: 0 !important;
}

.leaflet-popup-tip {
  background: var(--m-card-2) !important;
  border: 1px solid rgba(255, 77, 0, 0.25) !important;
  border-top: none !important;
  border-left: none !important;
  box-shadow: none !important;
}

.leaflet-popup-close-button {
  color: rgba(255, 255, 255, 0.4) !important;
  font-size: 20px !important;
  width: 28px !important;
  height: 28px !important;
  top: 8px !important;
  right: 8px !important;
  z-index: 10;
}

.leaflet-popup-close-button:hover {
  color: var(--m-primary) !important;
}

.venue-popup {
  padding: 1.3rem 1.35rem 1.35rem;
}

.venue-popup.loading {
  color: var(--m-text-faint);
  font-size: 0.8rem;
}

.popup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.popup-head-main {
  min-width: 0;
}

.popup-cat {
  display: block;
  font-family: var(--m-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--m-primary);
  margin-bottom: 0.2rem;
}

.popup-name {
  font-size: 1.12rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: -0.01em;
}

.popup-city-badge {
  flex-shrink: 0;
  font-family: var(--m-mono);
  font-size: 0.64rem;
  font-weight: 700;
  color: var(--m-primary);
  background: var(--m-primary-dim);
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.popup-address {
  font-size: 0.8rem;
  color: var(--m-text-dim);
  margin: 0 0 0.7rem;
  line-height: 1.4;
}

.popup-notes {
  font-size: 0.8rem;
  color: var(--m-text-dim);
  line-height: 1.5;
  margin: 0 0 0.7rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--m-line);
}

/* DJ Library network rows */
.popup-net {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--m-line);
  border-bottom: 1px solid var(--m-line);
  margin-bottom: 0.7rem;
}

.popup-net-block {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.popup-net-label {
  font-family: var(--m-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m-text-faint);
}

.popup-net-djs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.popup-dj {
  font-family: var(--m-mono);
  font-size: 0.72rem;
  color: #fff;
  text-decoration: none;
  border: 1px solid var(--m-line);
  border-radius: 999px;
  padding: 0.28rem 0.62rem;
  transition: all 0.2s;
}

.popup-dj:hover {
  color: var(--m-primary);
  border-color: rgba(255, 77, 0, 0.4);
  background: var(--m-primary-dim);
}

.popup-net-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.popup-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.popup-link {
  color: var(--m-primary) !important;
  text-decoration: none !important;
  font-family: var(--m-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.5rem 0.95rem;
  border: 1px solid rgba(255, 77, 0, 0.4);
  border-radius: 999px;
  background: rgba(255, 77, 0, 0.06);
  transition: all 0.2s;
}

.popup-link:hover {
  background: var(--m-primary);
  color: #0a0a0a !important;
  border-color: var(--m-primary);
}

.popup-link-set {
  color: #fff !important;
  border-color: var(--m-line);
}

.popup-link-set:hover {
  border-color: rgba(255, 77, 0, 0.4);
  background: var(--m-primary-dim);
  color: var(--m-primary) !important;
}

/* ===== Per-city venue rail ===== */

.venue-list {
  flex: 0 1 auto;
  max-height: 30vh;
  overflow-y: auto;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  border-top: 1px solid var(--m-line);
  background: var(--m-card);
}

.venue-list::-webkit-scrollbar {
  width: 4px;
}

.venue-list::-webkit-scrollbar-track {
  background: transparent;
}

.venue-list::-webkit-scrollbar-thumb {
  background: rgba(255, 77, 0, 0.25);
  border-radius: 2px;
}

.venue-card {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.venue-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--m-line);
}

.venue-card.active {
  background: var(--m-primary-dim);
  border-color: rgba(255, 77, 0, 0.35);
}

.venue-index {
  flex-shrink: 0;
  font-family: var(--m-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--m-primary);
  padding-top: 0.15rem;
  letter-spacing: 0.05em;
}

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

.venue-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.venue-card-name {
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

.venue-card-city {
  flex-shrink: 0;
  font-family: var(--m-mono);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--m-text-faint);
}

.venue-card-address {
  font-size: 0.75rem;
  color: var(--m-text-faint);
  margin: 0 0 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Direct link button on each venue rail card (website / RA / Instagram) */
.venue-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--m-mono);
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--m-primary) !important;
  text-decoration: none !important;
  border: 1px solid rgba(255, 77, 0, 0.4);
  background: rgba(255, 77, 0, 0.06);
  border-radius: 999px;
  padding: 0.32rem 0.7rem;
  transition: all 0.2s;
  cursor: pointer;
}

.venue-card-btn:hover {
  background: var(--m-primary);
  color: #0a0a0a !important;
  border-color: var(--m-primary);
}

/* ===== CTA ===== */

.map-cta {
  background: var(--m-bg);
  padding: 4.5rem 2rem;
  text-align: center;
  position: relative;
}

.map-cta::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 77, 0, 0.4), transparent);
}

.map-cta-content {
  max-width: 600px;
  margin: 0 auto;
}

.map-cta-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.map-cta-text {
  font-size: 1rem;
  color: var(--m-text-dim);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.map-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--m-primary);
  color: #0a0a0a;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: var(--m-mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  transition: all 0.2s;
}

.map-cta-btn:hover {
  background: #ff7a3d;
  transform: translateY(-1px);
}

.map-cta + .map-cta {
  border-top: 1px solid var(--m-line);
}

.map-cta-btn-alt {
  background: var(--m-yellow);
  color: #0a0a0a;
}

.map-cta-btn-alt:hover {
  background: #ffd94d;
  color: #0a0a0a;
}

.city-panel-badges {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ===== Responsive ===== */

@media (max-width: 1024px) {
  .map-cities {
    grid-template-columns: 1fr;
    height: auto;
  }

  .city-panel + .city-panel {
    border-left: none;
    border-top: 1px solid var(--m-line);
  }

  .city-map {
    height: 42vh;
    min-height: 320px;
    flex: none;
  }

  .venue-list {
    max-height: 32vh;
  }
}

@media (max-width: 600px) {
  .city-map {
    height: 40vh;
    min-height: 300px;
  }

  .venue-list {
    max-height: 30vh;
  }
}

/* ===== Community events layer ===== */

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--m-line);
  background: var(--m-card);
}

.map-toolbar-label {
  font-family: var(--m-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--m-text-faint);
}

.map-events-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--m-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--m-text-dim);
  background: transparent;
  border: 1px solid var(--m-line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.map-events-toggle:hover {
  color: #fff;
  border-color: rgba(245, 197, 24, 0.5);
}

.map-events-toggle.active {
  color: #0a0a0a;
  background: var(--m-yellow);
  border-color: var(--m-yellow);
}

.events-count {
  font-family: var(--m-mono);
  font-size: 0.72rem;
  color: var(--m-text-dim);
  letter-spacing: 0.06em;
}

.city-panel-events {
  flex-shrink: 0;
  font-family: var(--m-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--m-yellow);
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.28);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.event-marker-icon {
  background: none !important;
  border: none !important;
}

.event-marker-pin {
  width: 28px;
  height: 28px;
  background: var(--m-yellow);
  border: 1px solid rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(245, 197, 24, 0.45);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.event-marker-icon:hover .event-marker-pin {
  transform: scale(1.12);
  box-shadow: 0 6px 22px rgba(245, 197, 24, 0.6);
}

.event-marker-pulse {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(245, 197, 24, 0.3);
  animation: map-pulse 2s ease-out infinite;
  pointer-events: none;
}

.event-popup {
  padding: 1.2rem 1.3rem 1.3rem;
}

.event-popup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.event-popup-badge {
  flex-shrink: 0;
  font-family: var(--m-mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: var(--m-yellow);
  background: rgba(245, 197, 24, 0.12);
  border: 1px solid rgba(245, 197, 24, 0.3);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.event-popup-name {
  font-size: 1.08rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.event-popup-price {
  flex-shrink: 0;
  font-family: var(--m-mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--m-success);
  background: rgba(0, 255, 136, 0.1);
  border: 1px solid rgba(0, 255, 136, 0.3);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.event-popup-meta {
  font-size: 0.82rem;
  color: var(--m-text-dim);
  margin: 0 0 0.3rem;
}

.event-popup-venue {
  font-size: 0.82rem;
  color: #fff;
  margin: 0 0 0.6rem;
  line-height: 1.4;
}

.event-popup-djs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--m-line);
  border-bottom: 1px solid var(--m-line);
  margin-bottom: 0.6rem;
}

.event-popup-djs-label {
  font-size: 0.85rem;
}

.event-popup-dj {
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: var(--m-card-2);
  border: 1px solid var(--m-line);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
}

.event-popup-dj-tba {
  color: var(--m-text-faint);
  font-style: italic;
}

.event-popup-desc {
  font-size: 0.8rem;
  color: var(--m-text-dim);
  line-height: 1.5;
  margin: 0 0 0.6rem;
}

.event-popup-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.event-popup-actions .popup-link {
  background: var(--m-card-2);
  border: 1px solid var(--m-line);
}
