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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Crimson Text', Georgia, serif;
  color: #3b2a1a;
}

/* === Fullscreen Map === */
#map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

/* === Shared Panel Style (parchment) === */
.panel {
  background: linear-gradient(135deg, #f5e6c8 0%, #e8d5a3 30%, #f0debb 60%, #e5ceA0 100%);
  border: 2px solid #8b6914;
  border-radius: 6px;
  box-shadow:
    0 4px 16px rgba(60, 40, 10, 0.35),
    inset 0 0 30px rgba(139, 105, 20, 0.08);
  z-index: 1000;
}

/* === Title Bar === */
#title-bar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  text-align: center;
  background: linear-gradient(135deg, #f5e6c8 0%, #e8d5a3 50%, #f0debb 100%);
  border: 2px solid #8b6914;
  border-radius: 6px;
  padding: 6px 24px;
  box-shadow:
    0 4px 16px rgba(60, 40, 10, 0.35),
    inset 0 0 30px rgba(139, 105, 20, 0.08);
  pointer-events: none;
}

#title-bar h1 {
  font-family: 'IM Fell English', serif;
  font-size: 1.8rem;
  color: #4a2e0a;
  letter-spacing: 0.05em;
  text-shadow: 1px 1px 2px rgba(139, 105, 20, 0.3);
  line-height: 1;
}

#title-bar .subtitle {
  font-family: 'Crimson Text', Georgia, serif;
  font-style: italic;
  font-size: 0.85rem;
  color: #7a5a2a;
}

/* === Filter Panel === */
#filter-panel {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 280px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  transition: width 0.3s ease;
}

#filter-panel.collapsed {
  width: auto;
}

#filter-panel.collapsed #panel-content {
  display: none;
}

#panel-toggle {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: #4a2e0a;
  cursor: pointer;
  text-align: left;
  font-family: 'IM Fell English', serif;
}

#panel-toggle:hover {
  color: #8b6914;
}

#panel-content {
  padding: 0 14px 14px;
}

#panel-content h2 {
  font-family: 'IM Fell English', serif;
  font-size: 1.3rem;
  color: #4a2e0a;
  margin-bottom: 12px;
  border-bottom: 1px solid #c4a45a;
  padding-bottom: 6px;
}

/* === Filter Groups === */
.filter-group {
  margin-bottom: 14px;
}

.filter-group > label {
  display: block;
  font-family: 'IM Fell English', serif;
  font-size: 1rem;
  color: #5a3a1a;
  margin-bottom: 6px;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-btn {
  padding: 5px 10px;
  border: 1px solid #a0843a;
  border-radius: 4px;
  background: rgba(255, 248, 230, 0.7);
  color: #4a2e0a;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  background: rgba(196, 164, 90, 0.3);
}

.filter-btn.active {
  background: #8b6914;
  color: #fff8e6;
  border-color: #6b4f0a;
}

/* === Radius Control === */
.radius-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

#radius-slider {
  flex: 1;
  accent-color: #8b6914;
}

#radius-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a2e0a;
  min-width: 50px;
}

.radius-actions {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
}

.action-btn {
  padding: 4px 8px;
  border: 1px solid #a0843a;
  border-radius: 4px;
  background: rgba(255, 248, 230, 0.7);
  color: #4a2e0a;
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-btn:hover {
  background: rgba(196, 164, 90, 0.3);
}

.hint {
  font-size: 0.75rem;
  color: #8a7040;
  font-style: italic;
}

/* === Checkboxes === */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.checkbox-label {
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.checkbox-label input[type="checkbox"] {
  accent-color: #8b6914;
}

/* === Market Count === */
.market-count {
  font-size: 0.85rem;
  color: #7a5a2a;
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid #c4a45a;
}

/* === Legend === */
#legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 8px 12px;
}

#legend.collapsed #legend-content {
  display: none;
}

#legend-toggle {
  display: block;
  background: none;
  border: none;
  font-family: 'IM Fell English', serif;
  font-size: 1.1rem;
  color: #4a2e0a;
  cursor: pointer;
  width: 100%;
  text-align: right;
}

#legend-content h3 {
  font-family: 'IM Fell English', serif;
  font-size: 1rem;
  color: #4a2e0a;
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 3px;
}

.legend-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-icon-default {
  background: #8b6914;
  border: 2px solid #5a3a0a;
}

.legend-icon-beerenweine {
  background: #722f6b;
  border: 2px solid #4a1a45;
}

.legend-icon-mps {
  background: #1a6b3a;
  border: 2px solid #0a4a2a;
}

.legend-icon-christmas {
  background: #b02020;
  border: 2px solid #7a0a0a;
}
.legend-icon-concert {
  background: #5b2f8a;
  border: 2px solid #341660;
}
.legend-icon-festival {
  background: #8a4f10;
  border: 2px solid #5a2a00;
}

/* === Concert cluster icon === */
.concert-cluster {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #5b2f8a;
  border: 3px solid #341660;
  color: white;
  font-family: serif;
  font-size: 13px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* === Concert popup badges === */
.popup-badge-concert {
  background: #5b2f8a;
  color: white;
}
.popup-badge-festival {
  background: #8a4f10;
  color: white;
}

/* === Custom Marker Reset === */
.custom-marker {
  background: none !important;
  border: none !important;
}

/* === Marker Cluster Overrides === */
.marker-cluster-small {
  background-color: rgba(139, 105, 20, 0.4) !important;
}
.marker-cluster-small div {
  background-color: rgba(139, 105, 20, 0.7) !important;
  color: #fff8e6 !important;
  font-family: 'Crimson Text', Georgia, serif !important;
}

.marker-cluster-medium {
  background-color: rgba(139, 105, 20, 0.5) !important;
}
.marker-cluster-medium div {
  background-color: rgba(139, 105, 20, 0.8) !important;
  color: #fff8e6 !important;
  font-family: 'Crimson Text', Georgia, serif !important;
}

.marker-cluster-large {
  background-color: rgba(139, 105, 20, 0.6) !important;
}
.marker-cluster-large div {
  background-color: rgba(139, 105, 20, 0.9) !important;
  color: #fff8e6 !important;
  font-family: 'Crimson Text', Georgia, serif !important;
}

/* === Leaflet Popup Override === */
.leaflet-popup-content-wrapper {
  background: linear-gradient(135deg, #f5e6c8, #e8d5a3) !important;
  border: 1px solid #a0843a !important;
  border-radius: 6px !important;
  box-shadow: 0 3px 10px rgba(60, 40, 10, 0.3) !important;
}

.leaflet-popup-content {
  font-family: 'Crimson Text', Georgia, serif !important;
  color: #3b2a1a !important;
  font-size: 0.9rem !important;
  line-height: 1.4 !important;
}

.leaflet-popup-content h3 {
  font-family: 'IM Fell English', serif;
  font-size: 1.1rem;
  color: #4a2e0a;
  margin-bottom: 4px;
}

.leaflet-popup-content a {
  color: #8b6914;
  text-decoration: none;
}

.leaflet-popup-content a:hover {
  text-decoration: underline;
}

.leaflet-popup-tip {
  background: #e8d5a3 !important;
  border: 1px solid #a0843a !important;
}

.popup-date {
  font-style: italic;
  color: #7a5a2a;
}

.popup-location {
  color: #5a3a1a;
}

.popup-sources {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #7a5a2a;
  opacity: 0.8;
}

.popup-links {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.ical-link {
  display: inline-block;
  font-size: 0.8rem;
  color: #5b2f8a;
  text-decoration: none;
  border: 1px solid #c0a0e0;
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
.ical-link:hover {
  background: #f0e8fa;
  border-color: #5b2f8a;
}

.popup-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 4px;
}

.popup-badge-beerenweine {
  background: #722f6b;
  color: #fff;
}

.popup-badge-mps {
  background: #1a6b3a;
  color: #fff;
}

/* === Decoration Overlays === */
/* mix-blend-mode is set directly on the custom decoPane in JS */

/* === Radius Circle === */
.radius-circle {
  fill: rgba(139, 105, 20, 0.1);
  stroke: #8b6914;
  stroke-width: 2;
  stroke-dasharray: 8 4;
}

/* === Impressum Link === */
#impressum-link {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  font-family: 'Crimson Text', serif;
  font-size: 0.8rem;
}
#impressum-link a {
  color: #5a3a1a;
  text-decoration: none;
  opacity: 0.5;
  transition: opacity 0.2s;
}
#impressum-link a:hover { opacity: 1; }

/* Mobile-only elements hidden on desktop */
#btn-list-mobile { display: none; }

/* === Mobile === */
@media (max-width: 640px) {
  /* Filter panel: full width, slides up from bottom */
  #filter-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    max-width: 100%;
    max-height: 60vh;
    border-radius: 12px 12px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom, 12px);
  }

  #filter-panel.collapsed {
    max-height: 48px;
    width: 100% !important;
    overflow: hidden;
  }

  #panel-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }

  #panel-toggle {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-size: 1.2rem;
    width: auto;
  }

  #btn-list-mobile {
    display: block;
    flex-shrink: 0;
    padding: 8px 14px;
    font-family: 'IM Fell English', serif;
    font-size: 0.9rem;
    color: #3a2a0a;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(139, 105, 20, 0.3);
    cursor: pointer;
    white-space: nowrap;
  }

  #panel-content {
    padding: 0 16px 16px;
    overflow-y: auto;
    max-height: calc(60vh - 48px);
  }

  /* Title bar: compact top center */
  #title-bar {
    top: 10px;
    right: 10px;
    left: auto;
    padding: 6px 14px;
  }

  #title-bar h1 {
    font-size: 1.2rem;
  }

  #title-bar .subtitle {
    display: none;
  }

  /* Legend: top left, compact */
  #legend {
    bottom: auto;
    top: 10px;
    left: 10px;
  }

  /* Bigger touch targets for filter buttons */
  .filter-btn, .action-btn {
    padding: 10px 14px;
    font-size: 0.95rem;
    min-height: 44px;
  }

  /* Radius slider easier to use */
  #radius-slider {
    height: 28px;
  }

  /* Leaflet zoom: just above collapsed panel handle (48px) */
  .leaflet-bottom.leaflet-right {
    bottom: 58px !important;
  }

  /* Impressum: hide on mobile (too cramped) */
  #impressum-link {
    display: none;
  }

  /* Popup max width */
  .leaflet-popup-content-wrapper {
    max-width: 85vw;
  }
}

/* ===  Liste-Button === */
#btn-list {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  background: rgba(245, 235, 210, 0.95);
  border: 1.5px solid #8b6914;
  border-radius: 20px;
  padding: 7px 18px;
  font-family: 'IM Fell English', serif;
  font-size: 0.9rem;
  color: #3a2a0a;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  transition: background 0.15s;
}
#btn-list:hover { background: rgba(235, 220, 185, 0.98); }

@media (max-width: 640px) {
  #btn-list { display: none; }
}

/* === List Modal === */
.list-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.list-modal.hidden { display: none; }

.list-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 18, 5, 0.45);
  cursor: pointer;
}

.list-modal-content {
  position: relative;
  background: #fdf6e3;
  border: 2px solid #8b6914;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  width: min(680px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Crimson Text', Georgia, serif;
}

.list-modal-header {
  padding: 14px 16px 0;
  border-bottom: 1px solid #d4a853;
  flex-shrink: 0;
}
.list-modal-header h2 {
  font-family: 'IM Fell English', serif;
  font-size: 1.1rem;
  color: #3a2a0a;
  margin: 0 0 10px;
}
#list-count {
  font-size: 0.8rem;
  color: #7a6030;
  font-style: italic;
  font-family: 'Crimson Text', serif;
}

.list-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #7a6030;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.list-modal-close:hover { color: #3a2a0a; }

/* Category tabs */
.list-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: -1px;
}
.list-tab {
  background: #ede0b5;
  border: 1px solid #c4a030;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 5px 14px;
  font-family: 'Crimson Text', serif;
  font-size: 0.9rem;
  color: #5a4010;
  cursor: pointer;
}
.list-tab.active {
  background: #fdf6e3;
  color: #3a2a0a;
  font-weight: 600;
}
.list-tab:hover:not(.active) { background: #f5e8c0; }

/* Scrollable list */
.list-modal-body {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0;
}

/* Individual list items */
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid #ede0b5;
  cursor: pointer;
  transition: background 0.1s;
}
.list-item:hover { background: #faf0d0; }
.list-item:last-child { border-bottom: none; }

.list-item-dot {
  flex-shrink: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-top: 4px;
}

.list-item-main { flex: 1; min-width: 0; }

.list-item-name {
  font-size: 0.95rem;
  color: #2a1a04;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-meta {
  font-size: 0.82rem;
  color: #6a5020;
  margin-top: 1px;
}

.list-item-date {
  flex-shrink: 0;
  font-size: 0.82rem;
  color: #5a4010;
  text-align: right;
  white-space: nowrap;
}

.list-empty {
  text-align: center;
  padding: 32px 16px;
  color: #8a7040;
  font-style: italic;
}
