:root {
  --bg-primary: #ffffff;
  --bg-secondary: rgba(255, 255, 255, 0.95);
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: rgba(0, 0, 0, 0.05);
  --shadow: rgba(0, 0, 0, 0.1);
  --accent: #6366f1;
  --card-bg: #ffffff;
  --filters: none
}

[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: rgba(15, 23, 42, 0.95);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --shadow: rgba(0, 0, 0, 0.3);
  --accent: #818cf8;
  --card-bg: #1e293b;
  --filters: sepia(70%) hue-rotate(180deg) saturate(200%)
}


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

a {
  text-decoration: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-primary);
}

#map {
  width: 100%;
  height: 100vh;
  background: var(--bg-primary);
  filter: var(--filters)
}

.custom-marker {
  filter: var(--filters)
}

.marker-count-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c53030;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border-radius: 9px;
  border: 2px solid var(--bg-secondary);
}

.panels {
  position: absolute;
  top: 10px;
  right: 10px;
  max-width: 340px;
  z-index: 1000;
}

.info-panel {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  background: var(--bg-secondary);
  color: var(--text-primary);

}

.info-panel h3 {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 600;
}

.event-count {
  font-size: 13px;
  margin-bottom: 12px;
}

.other-events {
  font-size: 13px;
  margin-bottom: 12px;
  margin-top: 25px;
  width: 100%;
  display: flex;
  align-items: center;
}

.no-location-notice {
  font-size: 9px;
  color: var(--shadow);
  margin-top: 4px;
}

.header-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.header-left {
  flex-shrink: 0;
}

.header-right {
  flex: 1;
  min-width: 0;
}

/* Filters Section */
.filters-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e0e0e0;
}

.filter-group {
  margin-bottom: 8px;
}

.filters-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.filter-input:focus {
  outline: none;
  border-color: #5400b3;
  box-shadow: 0 0 0 3px rgba(84, 0, 179, 0.1);
}

.filter-input::placeholder {
  color: #999;
}

select.filter-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

.clear-filters-btn {
  width: 100%;
  padding: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
}

.clear-filters-btn:hover {
  background: var(--shadow);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.clear-filters-btn:active {
  transform: scale(0.98);
}

.clear-filters-btn svg {
  width: 14px;
  height: 14px;
}

.clear-filters-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.event-list {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 8px;
}

.event-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  align-items: flex-start;
  background: var(--card-bg);
  border-color: var(--border-color);
  box-shadow: 0 1px 3px var(--shadow);

}

.event-item:hover {
  background: var(--bg-secondary);
}

.event-item.filtered-out {
  display: none;
}

.event-thumbnail {
  width: 60px;
  height: 60px;
  min-width: 60px;
  border-radius: 4px;
  object-fit: cover;
  background: #ddd;
}

.event-thumbnail.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 24px;
  font-weight: bold;
}

.event-details {
  flex: 1;
  min-width: 0;
}

.event-action {
  display: flex;
  align-items: center;
  padding: 8px;
  margin: auto;
  margin-left: 4px;
  color: #2c5282;
  transition: all 0.2s;
  border-radius: 4px;
}

.event-action:hover {
  background: var(--bg-secondary);
  color: #1a365d;
}

.event-action svg {
  width: 20px;
  height: 20px;
}

.event-item h4 {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 4px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

.event-item p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-date {
  color: #c53030 !important;
  font-weight: 500 !important;
}

.no-results {
  padding: 20px;
  text-align: center;
  color: var(--text-primary);
  font-size: 13px;
}

.leaflet-popup-content {
  margin: 10px;
  min-width: 200px;
  
  color: var(--bg-primary);
}
.leaflet-popup-content-wrapper {
  background: var(--bg-primary);
}

.popup-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-thumbnail {
  width: 100%;
  height: 150px;
  border-radius: 4px;
  object-fit: cover;
  margin-bottom: 4px;
}

.popup-thumbnail.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 48px;
  font-weight: bold;
}

.toggle-button {
  display: none;
  width: 100%;
  padding: 12px;
  background: var(--bg-primary);
  border: none;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  position: relative;
  touch-action: none;
  user-select: none;
}

.toggle-button::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: background 0.2s;
}

.toggle-button:active::before {
  background: var(--bg-primary);
}

.toggle-button-text {
  margin-top: 8px;
  display: block;
}

.popup-content h3 {
  margin: 0;
  color: #2c5282;
  font-size: 16px;
  line-height: 1.4;
}

.popup-content p {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
}

.popup-content a {
  color: var(--text-primary);
}
.popup-content .date {
  font-weight: bold;
  color: #c53030;
}

.venue-event-count {
  font-size: 12px !important;
  color: var(--text-secondary) !important;
}

.popup-event-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 260px;
  overflow-y: auto;
}

.popup-event-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 4px;
  text-decoration: none;
  color: var(--text-primary);
}

.popup-event-list-item:hover {
  background: var(--bg-secondary);
}

.popup-event-list-item-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.popup-event-list-item-details strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup-event-list-item-details .date {
  font-size: 12px;
}

/* Mobile styles */
@media (max-width: 768px) {
  #map {
    transition: height 0.3s ease;
  }

  #map.list-expanded {
    height: 50vh;
  }

  .toggle-button {
    display: block;
  }

  .panels {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    transition: transform 0.3s ease;
    will-change: transform;
  }

  .panels.dragging {
    transition: none;
  }

  .panels.collapsed {
    transform: translateY(calc(100% - 50px));
  }

  .info-panel {
    border-radius: 0;
    margin: 0;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
  }

  /* Horizontal scrolling filters for mobile */
  .header-container {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
  }

  .filters-section {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
  }

  .filters-container {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 4px;
  }

  .filters-container::-webkit-scrollbar {
    display: none;
  }

  .filters-container .filter-group {
    flex-shrink: 0;
    min-width: 200px;
    width: 200px;
    margin-bottom: 0;
  }

  .clear-filters-btn {
    min-width: 140px;
    flex-shrink: 0;
  }

  .popup-thumbnail {
    height: 80px;
  }

  .popup-thumbnail.placeholder {
    font-size: 32px;
  }

  .event-list {
    max-height: none;
    flex: 1;
    overflow-y: auto;
  }

  .event-thumbnail {
    width: 50px;
    height: 50px;
    min-width: 50px;
  }

  .event-action svg {
    width: 18px;
    height: 18px;
  }

  .event-action {
    padding: 6px;
  }

  .event-item h4 {
    font-size: 13px;
  }

  .event-item p {
    font-size: 11px;
  }

  .info-panel h3 {
    font-size: 14px;
  }

  .event-count {
    font-size: 12px;
    margin-bottom: 8px;
    width: 130px;
  }

  .filter-input {
    font-size: 12px;
    padding: 7px 9px;
  }

  .clear-filters-btn {
    font-size: 11px;
    padding: 7px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .info-panel {
    padding: 10px;
  }

  .event-thumbnail {
    width: 45px;
    height: 45px;
    min-width: 45px;
  }

  .event-item {
    gap: 8px;
    padding: 6px;
  }

  .filters-container .filter-group {
    min-width: 180px;
    width: 180px;
  }

  .clear-filters-btn {
    min-width: 120px;
  }
}

/* Scrollbar styling */
.event-list::-webkit-scrollbar {
  width: 6px;
}

.event-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.event-list::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 3px;
}

.event-list::-webkit-scrollbar-thumb:hover {
  background: #555;
}



.leaflet-bar a {
  background-color: var(--bg-primary);
  color: var(--text-primary)
}

.leaflet-container .leaflet-control-attribution {
  background: var(--bg-primary);
  color: var(--text-secondary);
}








.dark-mode-toggle {
  position: absolute;
  top: 20px;
  right: 380px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px var(--shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.2s;
}

.dark-mode-toggle:hover {
  transform: scale(1.05);
}

.dark-mode-toggle svg {
  width: 20px;
  height: 20px;
  color: var(--text-primary);
}

[data-theme="dark"] .sun-icon {
  display: none;
}

.moon-icon {
  display: none;
}

[data-theme="dark"] .moon-icon {
  display: block;
}

@media (max-width: 768px) {
  .dark-mode-toggle {
    top: 10px;
    right: 10px;
  }
}