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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: #f5f5f5;
  color: #333;
}

header {
  background: #1a1a2e;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 { font-size: 18px; font-weight: 600; }

#status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

main {
  display: flex;
  height: calc(100vh - 48px);
}

/* Freshness badges */
.freshness-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}

.freshness-badge.freshness-new { background: #27ae60; }
.freshness-badge.freshness-mid { background: #f39c12; }
.freshness-badge.freshness-old { background: #e74c3c; }

/* Filter Panel */
#filter-panel {
  width: 260px;
  min-width: 260px;
  background: #fff;
  padding: 16px;
  overflow-y: auto;
  border-right: 1px solid #ddd;
}

#filter-panel h2 {
  font-size: 15px;
  margin-bottom: 12px;
  color: #1a1a2e;
}

#filter-panel label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-top: 12px;
  margin-bottom: 4px;
}

#filter-panel input[type="number"],
#filter-panel input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-row input { flex: 1; }
.range-row span { color: #999; }

.checkbox-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.checkbox-grid label {
  font-size: 12px;
  font-weight: 400;
  margin-top: 0;
  padding: 2px 4px;
  cursor: pointer;
  white-space: nowrap;
}

.checkbox-grid input { margin-right: 2px; }

.checkbox-single {
  display: flex !important;
  align-items: center;
  gap: 6px;
  font-weight: 600 !important;
  margin-top: 14px !important;
  cursor: pointer;
}

.checkbox-single input { margin: 0; }

#btn-reset {
  margin-top: 16px;
  width: 100%;
  padding: 8px;
  background: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

#btn-reset:hover { background: #ddd; }

/* Content */
#content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#map-container {
  height: 40%;
  min-height: 200px;
  border-bottom: 2px solid #ddd;
}

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

#list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #eee;
}

#filtered-count {
  font-size: 13px;
  color: #666;
}

#sort-select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

#property-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

/* Property Card */
.property-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.property-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Freshness border colors */
.property-card.freshness-new {
  border-left: 4px solid #27ae60;
}

.property-card.freshness-mid {
  border-left: 4px solid #f39c12;
}

.property-card.freshness-old {
  border-left: 4px solid #e74c3c;
}

/* Viewed (already-clicked) properties */
.property-card.viewed {
  background: #f0f0f0;
  opacity: 0.6;
}

.property-card.viewed .name {
  color: #888;
  text-decoration: line-through;
}

.property-card.viewed .card-rent {
  color: #999;
}

.property-card.viewed::after {
  content: "閲覧済み";
  position: absolute;
  top: 4px;
  right: 8px;
  font-size: 10px;
  color: #999;
  background: #ddd;
  padding: 1px 6px;
  border-radius: 3px;
}

.property-card { position: relative; }

.card-image {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 4px;
  background: #f0f0f0;
  flex-shrink: 0;
}

.card-body { flex: 1; min-width: 0; }

.card-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.card-title .name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Bookmark button */
.btn-bookmark {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #ccc;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.15s;
}

.btn-bookmark:hover { color: #f1c40f; }
.btn-bookmark.bookmarked { color: #f1c40f; }

.card-rent {
  font-size: 18px;
  font-weight: 700;
  color: #e74c3c;
}

.card-rent .admin {
  font-size: 12px;
  font-weight: 400;
  color: #999;
  margin-left: 4px;
}

.card-details {
  font-size: 12px;
  color: #666;
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.card-location {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.card-source {
  font-size: 11px;
  color: #aaa;
  margin-top: 4px;
}

/* Leaflet popup */
.popup-title { font-weight: 600; font-size: 13px; }
.popup-rent { color: #e74c3c; font-weight: 700; font-size: 14px; }
.popup-detail { font-size: 12px; color: #666; }
.popup-link { font-size: 12px; }

/* Responsive */
@media (max-width: 768px) {
  main { flex-direction: column; }
  #filter-panel {
    width: 100%;
    min-width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid #ddd;
  }
  #map-container { height: 250px; min-height: 250px; }
}
