/* Settings Panel Styles */
.settings-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  height: 100vh;
  background: #2c3e50;
  color: white;
  z-index: 1000;
  transition: transform 0.3s ease;
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  overflow-y: auto;
}

.settings-panel.collapsed {
  transform: translateX(-320px);
}

.panel-header {
  display: flex;
  align-items: center;
  padding: 15px;
  background: #34495e;
  border-bottom: 1px solid #4a5f7a;
}

.toggle-btn {
  position: fixed;
  top: 15px;
  left: 15px;
  background: #2c3e50;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  z-index: 1002;
  transition: all 0.3s ease;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
  opacity: 1;
}

.toggle-btn:hover {
  background: #34495e;
}

.toggle-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  flex: 1;
}

.close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.settings-panel.collapsed .panel-header h3 {
  opacity: 0;
}

.panel-content {
  padding: 20px;
}

.setting-group {
  margin-bottom: 20px;
}

.setting-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #ecf0f1;
}

.setting-group select,
.setting-group input[type="number"] {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid #4a5f7a;
  border-radius: 4px;
  background: #34495e;
  color: white;
  font-size: 14px;
}

.setting-group select {
  width: 100%;
}

.setting-group input[type="checkbox"] {
  margin-right: 8px;
  vertical-align: middle;
}

.setting-group label {
  display: flex;
  align-items: center;
  font-weight: 500;
  color: #ecf0f1;
  margin-bottom: 8px;
}

.checkbox-group label {
  margin-bottom: 6px;
  font-weight: 400;
}

.checkbox-group {
  margin-top: 8px;
}

.setting-group select:focus,
.setting-group input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.apply-btn,
.clear-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 10px;
  transition: background-color 0.2s;
}

.apply-btn {
  background: #3498db;
  color: white;
}

.apply-btn:hover {
  background: #2980b9;
}

.clear-btn {
  background: #e74c3c;
  color: white;
}

.clear-btn:hover {
  background: #c0392b;
}

/* Map positioning - full screen overlay */
#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

/* History Panel Styles */
.history-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 320px;
  height: 100vh;
  background: #2c3e50;
  color: white;
  z-index: 1000;
  transition: transform 0.3s ease;
  box-shadow: -2px 0 10px rgba(0,0,0,0.2);
  overflow-y: auto;
}

.history-panel.collapsed {
  transform: translateX(320px);
}

.toggle-history-btn {
  position: fixed;
  top: 15px;
  right: 15px;
  background: #2c3e50;
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 4px;
  z-index: 1002;
  transition: all 0.3s ease;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
}

.toggle-history-btn:hover {
  background: #34495e;
}

.toggle-history-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px;
  background: #34495e;
  border-bottom: 1px solid #4a5f7a;
}

.history-tabs {
  display: flex;
  background: #34495e;
  border-bottom: 1px solid #4a5f7a;
}

.history-tab {
  flex: 1;
  background: none;
  border: none;
  color: #95a5a6;
  padding: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 3px solid transparent;
}

.history-tab:hover {
  color: white;
  background: rgba(255,255,255,0.05);
}

.history-tab.active {
  color: white;
  border-bottom-color: #f1c40f;
}

.history-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  flex: 1;
}

.close-history-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.close-history-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.history-content {
  padding: 15px;
}

.history-empty {
  color: #95a5a6;
  font-style: italic;
  text-align: center;
  margin-top: 20px;
}

.history-item {
  background: #34495e;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-item:hover {
  background: #4a5f7a;
}

.history-item-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
}

.history-item h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 500;
}

.history-item p {
  margin: 0;
  font-size: 12px;
  color: #bdc3c7;
}

.history-item .history-price {
  font-size: 14px;
  font-weight: 600;
  color: #2ecc71;
  margin-top: 8px;
}

.history-item .history-remove {
  float: right;
  background: none;
  border: none;
  color: #e74c3c;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
}

.history-item .history-remove:hover {
  color: #c0392b;
}

.favorite-btn {
  background: none;
  border: none;
  color: #f1c40f;
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  margin-left: 5px;
}

.favorite-btn:hover {
  color: #f39c12;
}

.popup-favorite-btn {
  background: #f1c40f;
  border: none;
  color: #2c3e50;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.popup-favorite-btn:hover {
  background: #f39c12;
}

.popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.popup-ignore-btn {
  background: #95a5a6;
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.popup-ignore-btn:hover {
  background: #e74c3c;
}

/* Score badge in popup */
.popup-score {
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
}

.popup-score-value {
  display: block;
  font-weight: 700;
  font-size: 14px;
}

.popup-score-detail {
  display: block;
  opacity: 0.85;
  font-size: 11px;
}

.score-high { background: #d4edda; color: #155724; }
.score-mid  { background: #fff3cd; color: #856404; }
.score-low  { background: #f8d7da; color: #721c24; }

/* Score badge in history panel */
.history-score-wrap {
  float: right;
  position: relative;
}

.history-score {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.score-tooltip {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #2c3e50;
  color: #ecf0f1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  pointer-events: none;
}

.history-score-wrap:hover .score-tooltip {
  display: block;
}

.score-tooltip.visible {
  display: block;
  pointer-events: auto;
}

/* Link in favorites list */
.history-link {
  display: inline-block;
  margin-top: 6px;
  color: #3498db;
  font-size: 12px;
  text-decoration: none;
  font-weight: 500;
}

.history-link:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* Filter dropdown at top center */
.marker-counter {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1002;
  transition: opacity 0.3s ease;
  pointer-events: auto;
}

.marker-counter.hidden {
  opacity: 0;
  pointer-events: none;
}

.filter-toggle {
  background: #2c3e50;
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 2px 2px 8px rgba(0,0,0,0.3);
  transition: background 0.2s;
  white-space: nowrap;
}

.filter-toggle:hover {
  background: #34495e;
}

.filter-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  background: #2c3e50;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
  overflow: hidden;
  min-width: 180px;
}

.filter-dropdown.open {
  display: block;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: white;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.filter-row:hover {
  background: rgba(255,255,255,0.1);
}

.filter-row-inactive {
  opacity: 0.4;
}

.filter-label {
  flex: 1;
}

.filter-count {
  font-weight: 700;
  min-width: 24px;
  text-align: right;
}

.filter-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.6);
  flex-shrink: 0;
}

/* Share button — inside settings panel */
.share-btn {
  width: 100%;
  padding: 10px;
  background: #1abc9c;
  border: none;
  color: white;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 20px;
  transition: background 0.2s;
}

.share-btn:hover {
  background: #16a085;
}

/* Welcome popup */
.welcome-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.welcome-popup {
  background: #fff;
  border-radius: 8px;
  padding: 32px 36px;
  max-width: 520px;
  width: 90%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  color: #2c3e50;
  font-size: 14px;
  line-height: 1.6;
}

.welcome-popup h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.welcome-popup h3 {
  margin: 16px 0 8px;
  font-size: 16px;
}

.welcome-popup ul {
  margin: 0;
  padding-left: 20px;
}

.welcome-popup li {
  margin-bottom: 6px;
}

.welcome-note {
  margin-top: 16px;
  font-size: 12px;
  color: #7f8c8d;
}

.welcome-accept-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.welcome-accept-btn:hover {
  background: #34495e;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .settings-panel,
  .history-panel {
    width: 100vw;
  }

  .settings-panel.collapsed {
    transform: translateX(-100vw);
  }

  .history-panel.collapsed {
    transform: translateX(100vw);
  }

  .filter-toggle {
    padding: 6px 12px;
    font-size: 13px;
  }

  .filter-dropdown {
    min-width: 160px;
  }

  .filter-row {
    padding: 10px 12px;
  }

  .toggle-btn,
  .toggle-history-btn {
    padding: 10px 14px;
  }

  .welcome-popup {
    padding: 20px 18px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
  }

  .welcome-popup h2 {
    font-size: 18px;
  }

  .popup-actions {
    flex-direction: column;
  }

  .leaflet-popup-content {
    max-width: 250px;
    font-size: 13px;
  }
}

@media (max-width: 360px) {
  .filter-toggle {
    padding: 5px 10px;
    font-size: 12px;
  }
}
