html {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.leaflet-popup-content {
  max-height: 450px;
  overflow-y: auto;
  line-height: 1.6;
  min-width: 280px;
}

.leaflet-popup-content b {
  color: #333;
}

.leaflet-popup-content a {
  color: #1a73e8;
}

.price-marker {
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  border: 1.5px solid rgba(0,0,0,0.3);
  text-align: center;
  color: #fff;
  text-shadow: 0 0 3px rgba(0,0,0,0.5);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  position: relative;
}

.fav-star {
  position: absolute;
  top: -10px;
  right: -8px;
  font-size: 14px;
  filter: drop-shadow(0 0 1px rgba(0,0,0,0.5));
}

.popup-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
  margin-bottom: 4px;
}

.popup-header b {
  font-size: 14px;
  flex: 1;
}

.popup-fav-btn {
  background: none;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.popup-fav-btn:hover {
  border-color: #f5a623;
  background: #fff8e1;
}

.popup-fav-btn.active {
  border-color: #f5a623;
  background: #fff8e1;
}

.popup-fav-btn .fav-label {
  font-size: 11px;
  font-weight: 600;
  color: #666;
}

.popup-fav-btn.active .fav-label {
  color: #f5a623;
}

.popup-notes {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.popup-notes label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  display: block;
  margin-bottom: 4px;
}

.popup-notes textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}

.popup-notes textarea:focus {
  border-color: #4285f4;
}

.popup-notes .save-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.save-btn {
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.save-btn:hover {
  background: #3367d6;
}

.save-status {
  font-size: 11px;
  color: #4caf50;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
}

.save-status.show {
  opacity: 1;
}

/* Room types table in popup */
.room-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.room-table th {
  background: #f5f5f5;
  padding: 4px 6px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1.5px solid #ddd;
}

.room-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #eee;
}

.room-match {
  background: #e8f5e9;
}

/* Sidebar */
.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
  width: 340px;
  height: 100vh;
  background: #fff;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar.collapsed {
  transform: translateX(-340px);
}

.sidebar-toggle {
  position: absolute;
  top: 12px;
  z-index: 1001;
  left: 340px;
  width: 32px;
  height: 48px;
  background: #fff;
  border: none;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: left 0.3s ease;
}

.sidebar.collapsed + .sidebar-toggle {
  left: 0;
}

.sidebar-header {
  padding: 16px;
  background: #4285f4;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-header h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.sidebar-header .subtitle {
  opacity: 0.85;
  font-size: 13px;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.tab-bar {
  display: flex;
  border-bottom: 2px solid #eee;
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #888;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active {
  color: #4285f4;
  border-bottom-color: #4285f4;
}

.tab-btn:hover {
  color: #333;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.fav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.fav-item {
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
}

.fav-item:hover {
  background: #f8f9fa;
  margin: 0 -16px;
  padding: 12px 16px;
}

.fav-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fav-item-name {
  font-weight: 600;
  font-size: 13px;
  color: #333;
}

.fav-item-price {
  font-size: 12px;
  color: #4285f4;
  font-weight: 600;
}

.fav-item-note {
  font-size: 11px;
  color: #888;
  margin-top: 3px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-item-remove {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
}

.fav-item-remove:hover {
  color: #e53935;
  background: #ffebee;
}

.fav-empty {
  color: #aaa;
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
  line-height: 1.6;
}

/* Custom property form */
.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #444;
  margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #4285f4;
}

.form-group textarea {
  resize: vertical;
  min-height: 50px;
}

.form-row {
  display: flex;
  gap: 8px;
}

.form-row .form-group {
  flex: 1;
}

.amen-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
}

.amen-checks label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: normal;
}

.btn-primary {
  background: #4285f4;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn-primary:hover {
  background: #3367d6;
}

.btn-pick {
  background: #fff;
  border: 1.5px solid #4285f4;
  color: #4285f4;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}

.btn-pick:hover {
  background: #e8f0fe;
}

.btn-pick.active {
  background: #4285f4;
  color: #fff;
}

.btn-export {
  background: #34a853;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
}

.btn-export:hover {
  background: #2d8e47;
}

.custom-list {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.custom-item {
  padding: 10px;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 8px;
}

.custom-item-info {
  flex: 1;
  font-size: 12px;
  line-height: 1.5;
}

.custom-item-info b {
  font-size: 13px;
}

.custom-item-del {
  background: none;
  border: 1px solid #e53935;
  color: #e53935;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}

.custom-item-del:hover {
  background: #ffebee;
}

.price-marker.custom-marker {
  border: 2px dashed #1a73e8 !important;
}

.popup-edit-btn {
  background: #fff;
  border: 1.5px solid #4285f4;
  color: #4285f4;
  border-radius: 6px;
  padding: 5px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  display: inline-block;
}

.popup-edit-btn:hover {
  background: #e8f0fe;
}

.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}

.search-box input:focus {
  border-color: #4285f4;
}

.search-box .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: #999;
  font-size: 15px;
}

.filter-section {
  margin-bottom: 18px;
}

.filter-label {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filter-label .value {
  color: #4285f4;
  font-weight: 700;
  font-size: 12px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 10px;
  border-radius: 16px;
  border: 1.5px solid #ddd;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.chip:hover {
  border-color: #aaa;
}

.chip.active {
  background: #e8f0fe;
  border-color: #4285f4;
  color: #1a73e8;
  font-weight: 600;
}

.chip-fav {
  padding: 5px 10px;
  border-radius: 16px;
  border: 1.5px solid #f5a623;
  background: #fff8e1;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  color: #f5a623;
  font-weight: 600;
}

.chip-fav.active {
  background: #f5a623;
  color: #fff;
}

.results-bar {
  padding: 10px 16px;
  border-top: 1px solid #eee;
  font-size: 13px;
  color: #666;
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.results-bar .count {
  font-weight: 700;
  color: #333;
}

.reset-btn {
  background: none;
  border: none;
  color: #4285f4;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.reset-btn:hover {
  background: #e8f0fe;
}

.legend {
  margin-top: 8px;
}

.legend-title {
  font-weight: 600;
  font-size: 13px;
  color: #444;
  margin-bottom: 8px;
}

.legend-bar {
  display: flex;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}

.legend-bar div {
  flex: 1;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #777;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-inputs input[type=number] {
  width: 80px;
  padding: 7px 8px;
  border: 1.5px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
  outline: none;
  -moz-appearance: textfield;
}

.range-inputs input[type=number]:focus {
  border-color: #4285f4;
}

.range-inputs input[type=number]::-webkit-inner-spin-button,
.range-inputs input[type=number]::-webkit-outer-spin-button {
  opacity: 1;
}

.range-dash {
  color: #999;
  font-weight: 600;
}

.range-unit {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

.section-divider {
  border-top: 1px solid #eee;
  margin: 12px 0 14px;
}

.section-title {
  font-weight: 700;
  font-size: 14px;
  color: #333;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.marker-cluster {
  background: rgba(66,133,244,0.25) !important;
}

.marker-cluster div {
  background: #4285f4 !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 14px !important;
}

.marker-cluster-small {
  background: rgba(66,133,244,0.2) !important;
}

.marker-cluster-small div {
  background: #4285f4 !important;
}

.marker-cluster-medium {
  background: rgba(251,140,0,0.25) !important;
}

.marker-cluster-medium div {
  background: #fb8c00 !important;
}

.marker-cluster-large {
  background: rgba(229,57,53,0.25) !important;
}

.marker-cluster-large div {
  background: #e53935 !important;
}
