/* === Julie for Colorado — Event Map Styles === */

:root {
  /* Dark theme (default) */
  --bg-dark: #022b29;
  --bg-dark-green: #004948;
  --bg-sidebar: #022b29;
  --bg-card: #004948;
  --bg-card-hover: #007979;
  --accent: #f1b551;
  --accent-hover: #ec724e;
  --accent-glow: rgba(241, 181, 81, 0.35);
  --text-primary: #ffffff;
  --text-secondary: #ffecd6;
  --text-muted: #ffd498;
  --border: rgba(241, 181, 81, 0.2);
  --attribution-bg: rgba(2, 43, 41, 0.8);
  --marker-bg: #ffffff;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --header-height: 56px;

  --orange: #ec724e;
  --light: #ffecd6;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-dark: #fff8ec;        /* cream page bg */
    --bg-dark-green: #004948;  /* keep brand header */
    --bg-sidebar: #fff8ec;
    --bg-card: #ffffff;
    --bg-card-hover: #ffecd6;
    --accent: #c87a1f;         /* darker yellow for AA contrast on cream */
    --accent-hover: #ec724e;
    --accent-glow: rgba(236, 114, 78, 0.4);
    --text-primary: #022b29;
    --text-secondary: #234a48;
    --text-muted: #5e7a78;
    --border: rgba(2, 43, 41, 0.15);
    --attribution-bg: rgba(255, 248, 236, 0.85);
    --marker-bg: #ffffff;
  }
}

/* === Reset === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-stack);
  background: var(--bg-dark);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

/* === Header === */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 20px;
  background: var(--bg-dark-green);
  border-bottom: 1px solid var(--border);
}

#header .logo {
  height: 38px;
}

#header h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
}

/* === Main Layout === */
#app {
  display: flex;
  height: calc(100vh - var(--header-height));
}

#map-container {
  flex: 7;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* === Sidebar === */
#sidebar {
  flex: 3;
  min-width: 320px;
  max-width: 420px;
  background: var(--bg-sidebar);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

/* === Search Section === */
#search-section {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

#search-section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text-primary);
}

#search-form {
  display: flex;
  gap: 8px;
}

#zip-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-stack);
  outline: none;
  transition: border-color 0.2s;
}

#zip-input:focus {
  border-color: var(--accent);
}

#zip-input::placeholder {
  color: var(--text-muted);
}

#radius-select {
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 6px;
  background: var(--bg-dark);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-stack);
  cursor: pointer;
  outline: none;
}

#radius-select:focus {
  border-color: var(--accent);
}

#search-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  background: var(--orange);
  color: var(--bg-dark);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-stack);
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

#search-btn:hover {
  background: var(--accent-hover);
}

#search-status {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 18px;
}

#search-status.error {
  color: #ef404d;
}

/* === Type Filter === */
#filter-section {
  padding: 14px 20px 16px;
  border-bottom: 1px solid var(--border);
}

#filter-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

#type-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  user-select: none;
  transition: opacity 0.15s, transform 0.1s;
}

.type-chip:active {
  transform: scale(0.97);
}

.type-chip input {
  /* Native checkbox is hidden; chip opacity reflects state. */
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-chip:has(input:not(:checked)) {
  opacity: 0.4;
}

.type-chip-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 12px;
  background: var(--accent);
  border: 1.5px solid var(--marker-bg);
}

.type-chip-label {
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* === Results Section === */
#results-section {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px;
}

#results-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 16px 8px 8px;
}

/* === Event Cards === */
.event-card {
  background: var(--bg-card);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.event-card:hover {
  background: var(--bg-card-hover);
  transform: translateX(2px);
}

.event-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.event-card .card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.event-card .card-distance {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.event-card .card-details {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.event-card .card-venue {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* === Virtual / TBA sections === */
#virtual-section,
#tba-section {
  padding: 0 12px;
  border-top: 1px solid var(--border);
}

#virtual-section h3,
#tba-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 16px 8px 8px;
}

.virtual-card,
.tba-card {
  background: var(--bg-card);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 6px;
}

.virtual-card .card-title,
.tba-card .card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.virtual-card .card-details,
.tba-card .card-details {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.virtual-card a {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}

.virtual-card a:hover {
  text-decoration: underline;
}

.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

.badge-virtual {
  background: #007979;
  color: #ffffff;
}

.badge-tba {
  background: #ef404d;
  color: #ffffff;
}

.badge-recurring {
  background: #a3374c;
  color: #ffffff;
}

.tba-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 12px;
}

.tba-link:hover {
  text-decoration: underline;
}

/* === Map Markers === */
.event-marker {
  width: 30px;
  height: 30px;
  background: var(--marker-bg);
  border: 3px solid var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s;
}

.event-marker:hover {
  transform: scale(1.12);
}

.event-marker-icon {
  font-size: 15px;
  line-height: 1;
  /* Emoji are color glyphs; small text-shadow helps them sit on any tile color. */
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

/* === Search Marker (pulsing) === */
.search-marker {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 0 var(--accent-glow);
  animation: pulse 2s ease-out infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  70% {
    box-shadow: 0 0 0 20px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* === Leaflet Popup Override === */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  padding: 0 !important;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
}

.leaflet-popup-close-button {
  color: var(--text-secondary) !important;
  font-size: 18px !important;
  padding: 6px 8px !important;
}

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

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

.event-popup {
  padding: 14px 16px;
  min-width: 220px;
  max-width: 300px;
}

.event-popup h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.3;
}

.popup-detail {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.4;
}

.popup-detail strong {
  color: var(--text-primary);
}

.popup-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.popup-link:hover {
  text-decoration: underline;
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state .emoji {
  font-size: 28px;
  margin-bottom: 8px;
}

/* === Leaflet controls === */
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-card-hover) !important;
}

.leaflet-control-attribution {
  background: var(--attribution-bg) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a {
  color: var(--text-secondary) !important;
}

/* === Responsive === */
@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }

  #map-container {
    height: 50vh;
    flex: none;
  }

  #sidebar {
    height: 50vh;
    flex: none;
    min-width: unset;
    max-width: unset;
    border-left: none;
    border-top: 1px solid var(--border);
  }

  #search-form {
    flex-wrap: wrap;
  }

  #zip-input {
    flex: 1 1 120px;
  }

  #header .logo {
    height: 30px;
  }

  #header h1 {
    font-size: 12px;
  }
}
