/* ===== PHASE 4: City Selector, Geolocation, Map View ===== */

/* ── City Selector ─────────────────────────────────────────── */
.city-selector {
  position: relative;
  z-index: 90;
}

.city-selector-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--color-divider);
  border-radius: 20px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.city-selector-btn:hover {
  border-color: #ff2d78;
  background: rgba(255,45,120,0.08);
}

.city-chevron {
  transition: transform 0.2s ease;
}
.city-dropdown.open ~ .city-selector-btn .city-chevron,
.city-selector-btn[aria-expanded="true"] .city-chevron {
  transform: rotate(180deg);
}

.city-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 260px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s ease;
  overflow: hidden;
}
.city-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.city-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.city-geo-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(0,229,255,0.3);
  border-radius: 16px;
  background: rgba(0,229,255,0.08);
  color: #00e5ff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.city-geo-btn:hover {
  background: rgba(0,229,255,0.15);
  border-color: rgba(0,229,255,0.5);
}

.city-dropdown-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 8px 8px;
}

.city-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.15s ease;
  text-align: left;
}
.city-option:hover {
  background: rgba(255,255,255,0.05);
}
.city-option.active {
  background: rgba(255,45,120,0.12);
  color: #ff2d78;
}
.city-option-name {
  font-weight: 500;
}
.city-option-state {
  font-size: 12px;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* ── Geolocation Prompt ────────────────────────────────────── */
.geo-prompt {
  position: fixed;
  bottom: calc(var(--bottom-tab-height, 64px) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.geo-prompt.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.geo-prompt-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  max-width: 400px;
}

.geo-prompt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.geo-prompt-text strong {
  font-size: 14px;
  color: var(--color-text);
}
.geo-prompt-text span {
  font-size: 12px;
  color: var(--color-text-muted);
}

.geo-prompt-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.geo-prompt-allow {
  padding: 6px 16px;
  border: none;
  border-radius: 20px;
  background: #ff2d78;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.geo-prompt-allow:hover { background: #e0256a; }

.geo-prompt-dismiss {
  padding: 6px 12px;
  border: 1px solid var(--color-divider);
  border-radius: 20px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.geo-prompt-dismiss:hover {
  background: rgba(255,255,255,0.05);
}

/* ── Map View Page ─────────────────────────────────────────── */
.map-view-page {
  padding-top: calc(var(--header-height, 56px) + 16px);
  padding-bottom: calc(var(--bottom-tab-height, 64px) + 32px);
  min-height: 100vh;
}

.map-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 var(--space-6);
  margin-bottom: var(--space-4);
  max-width: var(--content-wide);
  margin-left: auto;
  margin-right: auto;
}

.map-title {
  font-family: var(--font-display, 'Clash Display', sans-serif);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
  margin: 0;
}
.map-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin: 4px 0 0;
}

.map-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-divider);
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.view-toggle-btn:hover { color: var(--color-text); background: rgba(255,255,255,0.05); }
.view-toggle-btn.active {
  background: rgba(255,45,120,0.12);
  color: #ff2d78;
  border-color: rgba(255,45,120,0.3);
}

.map-view-toggle {
  display: flex;
  gap: 4px;
}

/* Map filters */
.map-filters {
  display: flex;
  gap: 8px;
  padding: 0 var(--space-6);
  margin-bottom: var(--space-4);
  max-width: var(--content-wide);
  margin-left: auto;
  margin-right: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.map-filters::-webkit-scrollbar { display: none; }

.map-filter-btn {
  padding: 6px 14px;
  border: 1px solid var(--color-divider);
  border-radius: 20px;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.map-filter-btn:hover { color: var(--color-text); }
.map-filter-btn.active {
  background: rgba(255,45,120,0.12);
  color: #ff2d78;
  border-color: rgba(255,45,120,0.3);
}

/* Map container */
.map-container-wrap {
  padding: 0 var(--space-6);
  max-width: var(--content-wide);
  margin: 0 auto;
}

.event-map {
  width: 100%;
  height: 65vh;
  min-height: 400px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--color-divider);
}

/* Custom map markers */
.cc-marker-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff2d78;
  border: 2px solid rgba(255,45,120,0.4);
  border-radius: 50%;
  box-shadow: 0 2px 12px rgba(255,45,120,0.35);
  transition: transform 0.2s ease;
  cursor: pointer;
}
.cc-marker-dot:hover {
  transform: scale(1.2);
}
.cc-marker-dot span {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

/* Leaflet popup override */
.cc-leaflet-popup .leaflet-popup-content-wrapper {
  background: var(--color-surface, #16161d);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  color: var(--color-text, #f0f0f5);
  padding: 0;
}
.cc-leaflet-popup .leaflet-popup-content {
  margin: 0;
  min-width: 200px;
}
.cc-leaflet-popup .leaflet-popup-tip {
  background: var(--color-surface, #16161d);
  border: 1px solid rgba(255,255,255,0.1);
}
.cc-leaflet-popup .leaflet-popup-close-button {
  color: var(--color-text-muted, #888);
  font-size: 18px;
  top: 8px;
  right: 8px;
}

.cc-popup {
  padding: 14px 16px;
}
.cc-popup-venue {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #fff;
}
.cc-popup-count {
  font-size: 12px;
  color: var(--color-text-muted, #888);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.cc-popup-event {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  text-decoration: none;
  color: var(--color-text, #f0f0f5);
  transition: color 0.15s;
}
.cc-popup-event:hover { color: #ff2d78; }
.cc-popup-date {
  font-size: 11px;
  font-weight: 600;
  color: #00e5ff;
  min-width: 48px;
}
.cc-popup-name {
  font-size: 13px;
  font-weight: 500;
}
.cc-popup-more {
  display: block;
  font-size: 12px;
  color: #ff2d78;
  text-decoration: none;
  margin-top: 6px;
  font-weight: 500;
}

/* ── Event Panel (side panel on map click) ─────────────────── */
.map-event-panel {
  position: fixed;
  right: 0;
  top: var(--header-height, 56px);
  width: 360px;
  max-width: 90vw;
  height: calc(100vh - var(--header-height, 56px));
  background: var(--color-surface);
  border-left: 1px solid var(--color-divider);
  z-index: 95;
  overflow-y: auto;
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.map-panel-close {
  position: sticky;
  top: 0;
  float: right;
  width: 36px;
  height: 36px;
  margin: 12px;
  border: 1px solid var(--color-divider);
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.panel-venue-name {
  font-family: var(--font-display, 'Clash Display', sans-serif);
  font-size: 22px;
  font-weight: 700;
  padding: 20px 20px 4px;
  margin: 0;
}
.panel-event-count {
  font-size: 13px;
  color: var(--color-text-muted);
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--color-divider);
}

.panel-events-list {
  padding: 12px;
}

.panel-event-item {
  display: flex;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.15s;
}
.panel-event-item:hover {
  background: rgba(255,255,255,0.04);
}

.panel-event-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.panel-event-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.panel-event-date {
  font-size: 12px;
  color: #00e5ff;
  font-weight: 600;
}
.panel-event-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel-event-genre {
  font-size: 12px;
  color: var(--color-text-muted);
  text-transform: capitalize;
}

/* ── Map List View ─────────────────────────────────────────── */
.map-list-view {
  max-height: 65vh;
  min-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--color-divider);
  border-radius: 16px;
}

.map-list-item {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.15s;
}
.map-list-item:last-child { border-bottom: none; }
.map-list-item:hover { background: rgba(255,255,255,0.03); }

.map-list-img {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.map-list-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.map-list-date {
  font-size: 12px;
  color: #00e5ff;
  font-weight: 600;
}
.map-list-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-list-venue {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* ── Map Toggle Link (on events page) ──────────────────────── */
.map-toggle-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1px solid var(--color-divider);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  margin-top: 8px;
  transition: all 0.2s;
}
.map-toggle-link:hover {
  color: #ff2d78;
  border-color: rgba(255,45,120,0.3);
}

/* ── Spinner for geo loading ───────────────────────────────── */
.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0,229,255,0.3);
  border-top-color: #00e5ff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Mobile Adjustments ────────────────────────────────────── */
@media (max-width: 768px) {
  .map-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .map-header-right {
    width: 100%;
    justify-content: space-between;
  }
  .event-map {
    height: 55vh;
    min-height: 320px;
    border-radius: 12px;
  }
  .map-event-panel {
    width: 100%;
    max-width: 100vw;
    top: auto;
    bottom: 0;
    height: 60vh;
    border-left: none;
    border-top: 1px solid var(--color-divider);
    border-radius: 16px 16px 0 0;
    animation: slideUpPanel 0.3s ease;
  }
  @keyframes slideUpPanel {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .city-dropdown {
    width: 240px;
    left: 0;
    right: auto;
  }
  .geo-prompt-inner {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
  }
  .geo-prompt-text {
    flex: 1;
    min-width: 140px;
  }
  .geo-prompt-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
