/* 深圳核心区看房地图 - 样式表 */

:root {
  /* 设计令牌 */
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --primary-light: #e8f0fe;
  --accent: #ff6b35;
  --gold: #f5a623;
  --gold-light: #ffd700;
  --green: #34a853;
  --blue: #4285f4;
  --gray: #9aa0a6;
  --gray-light: #e8eaed;
  --gray-bg: #f8f9fa;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-tertiary: #80868b;
  --white: #ffffff;
  --star5: #f5a623;
  --star4: #ff6b35;
  --star3: #4285f4;
  --star2: #9aa0a6;
  --star1: #dadce0;
  --radius: 22px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --font-stack: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
  font-family: var(--font-stack);
  color: var(--text-primary);
  background: var(--gray-bg);
  overflow: hidden;
}

/* 顶部导航栏 */
.topbar {
  height: 60px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--primary);
}

.tab-group {
  display: flex;
  gap: 4px;
  background: var(--gray-bg);
  border-radius: 10px;
  padding: 3px;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 6px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  font-family: var(--font-stack);
}

.tab-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.budget-input {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.budget-input input {
  width: 70px;
  border: 2px solid var(--primary-light);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  font-family: var(--font-stack);
}

.budget-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-stack);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary-light);
}
.btn-outline:hover { border-color: var(--primary); background: var(--primary-light); }

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* 主容器 */
.main-container {
  display: flex;
  height: calc(100vh - 60px);
  position: relative;
}

/* 地图区域 */
.map-area {
  flex: 0 0 60%;
  position: relative;
  height: 100%;
}

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

/* 统一筛选控制栏 - 毛玻璃虚化设计 */
.filter-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  max-width: calc(100% - 32px);
  scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.filter-divider {
  width: 1px;
  height: 20px;
  background: rgba(0,0,0,0.08);
  flex-shrink: 0;
  margin: 0 2px;
}

.filter-tag {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 22px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: rgba(32,34,36,0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-stack);
  white-space: nowrap;
  opacity: 0.55;
  filter: blur(0.5px);
}

.filter-tag:hover {
  opacity: 0.85;
  filter: blur(0);
  color: var(--text-primary);
}

.filter-tag.active {
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(26,115,232,0.25), 0 0 0 1px rgba(26,115,232,0.15);
  opacity: 1;
  filter: blur(0);
  font-weight: 700;
}

/* 路线信息 */
.route-bar {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 500;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  box-shadow: var(--shadow-md);
  font-size: 13px;
  display: none;
}
.route-bar.show { display: block; }
.route-bar-title { font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.route-bar-content { color: var(--text-secondary); line-height: 1.6; }

/* 右侧列表 */
.list-area {
  flex: 0 0 40%;
  overflow-y: auto;
  background: var(--gray-bg);
  padding: 12px;
}

.list-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stats {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
}

/* 卡片列表 */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 小区卡片 */
.community-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.community-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.community-card.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.community-card.unsuitable {
  opacity: 0.45;
  background: var(--gray-bg);
}
.community-card.unsuitable .card-name {
  text-decoration: line-through;
}

.community-card.viewed {
  border-left: 4px solid var(--blue);
}

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

.card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.card-stars {
  font-size: 14px;
  white-space: nowrap;
  letter-spacing: 1px;
}

.card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.card-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.card-tag.recommend { background: #e6f4ea; color: var(--green); }
.card-tag.influencer { background: #fce8e6; color: #d93025; }
.card-tag.hot { background: #fef7e0; color: #b06000; }
.card-tag.controversial { background: #f1f3f4; color: #5f6368; }

.card-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.card-info-item {
  display: flex;
  gap: 4px;
}
.card-info-item .label { color: var(--text-tertiary); white-space: nowrap; }
.card-info-item .value { font-weight: 600; color: var(--text-primary); }

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.card-school {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
}
.card-school .tier1 { color: var(--gold); font-weight: 700; }
.card-school .tier2 { color: var(--green); font-weight: 600; }

.card-actions {
  display: flex;
  gap: 4px;
}

.status-btn {
  border: 1.5px solid var(--gray-light);
  background: var(--white);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: all var(--transition);
  font-family: var(--font-stack);
}
.status-btn.active.viewed-btn { background: var(--blue); color: var(--white); border-color: var(--blue); }
.status-btn.active.unsuitable-btn { background: var(--gray); color: var(--white); border-color: var(--gray); }

/* 卡片摘要 - 推荐亮点 */

/* 心仪匹配卡片样式 */
.community-card.preferred {
  border: 2px solid rgba(235, 47, 150, 0.3);
  background: linear-gradient(135deg, #fff5fa 0%, #ffffff 40%);
}
.community-card.preferred::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #eb2f96, #ff6b9d);
}
.preferred-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #eb2f96, #ff6b9d);
  padding: 2px 10px;
  border-radius: 12px;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(235,47,150,0.25);
}

.card-summary {
  margin-top: 8px;
  padding: 8px 10px;
  background: linear-gradient(135deg, #f0f7ff 0%, #f8fbff 100%);
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.card-summary .hl {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 700;
  color: var(--primary-dark);
  background: rgba(26,115,232,0.08);
  padding: 2px 6px;
  border-radius: 6px;
  white-space: nowrap;
}
.card-summary .hl.warn { color: #b06000; background: rgba(255,247,224,0.8); }
.card-summary .hl.good { color: var(--green); background: rgba(52,168,83,0.08); }
.card-summary .hl.gold { color: var(--gold); background: rgba(245,166,35,0.1); }

/* 信息弹窗 */
.info-window {
  font-size: 13px;
  line-height: 1.6;
  max-width: 340px;
}

.iw-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.iw-section {
  margin-bottom: 8px;
}

.iw-row {
  display: flex;
  gap: 6px;
  margin-bottom: 2px;
}
.iw-row .iw-label { color: var(--text-tertiary); white-space: nowrap; min-width: 56px; }
.iw-row .iw-value { color: var(--text-primary); font-weight: 500; }

.iw-note {
  background: var(--primary-light);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--primary-dark);
  line-height: 1.5;
}

.iw-env {
  background: #fef7e0;
  border-radius: 8px;
  padding: 6px 10px;
  margin-top: 6px;
  font-size: 12px;
  color: #b06000;
}

.iw-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* 新增小区表单 */
.add-form-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.add-form-overlay.show { display: flex; }

.add-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.add-form h3 {
  font-size: 18px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1.5px solid var(--gray-light);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-stack);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* 移动端 */
@media (max-width: 768px) {
  .topbar {
    padding: 0 12px;
    gap: 8px;
    overflow-x: auto;
  }
  .topbar-title { font-size: 15px; }
  .topbar-right { gap: 8px; }
  .budget-input { font-size: 12px; }
  .budget-input input { width: 55px; }

  .main-container {
    flex-direction: column;
    position: relative;
  }

  .map-area {
    flex: 0 0 55%;
    height: 55%;
  }

  .list-area {
    flex: 1;
    height: 45%;
    border-top: 1px solid var(--gray-light);
  }

  .filter-bar {
    top: 8px;
    left: 8px;
    padding: 2px;
    gap: 2px;
    max-width: calc(100% - 16px);
  }

  .filter-tag {
    padding: 4px 8px;
    font-size: 11px;
  }

  .metro-select {
    padding: 4px 8px !important;
    font-size: 11px !important;
    max-width: 120px;
  }

  .filter-divider {
    margin: 0 1px;
  }

  .card-list { gap: 8px; }
  .community-card { padding: 12px; border-radius: 16px; }
  .card-name { font-size: 14px; }
  .card-info { font-size: 12px; }
  .card-info { grid-template-columns: 1fr; }

  .route-bar {
    font-size: 12px;
    bottom: 6px;
    left: 6px;
    right: 6px;
    padding: 8px 12px;
  }
}

/* 打印样式 */
@media print {
  body {
    background: white;
    overflow: visible;
    height: auto;
  }
  .topbar, .map-area, .filter-bar, .route-bar, .add-form-overlay {
    display: none !important;
  }
  .main-container {
    display: block;
    height: auto;
  }
  .list-area {
    overflow: visible;
    height: auto;
    background: white;
    padding: 20px;
  }
  .community-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
    margin-bottom: 12px;
    opacity: 1 !important;
  }
  .card-header { break-after: avoid; }
  .list-header { break-after: avoid; }
  .print-only { display: block !important; }
  .print-section-title {
    font-size: 18px;
    font-weight: 700;
    margin-top: 20px;
    margin-bottom: 10px;
    break-after: avoid;
    border-bottom: 2px solid #333;
    padding-bottom: 4px;
  }
  .print-header {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    break-after: avoid;
  }
}

.print-only { display: none; }

/* Leaflet 标记点样式 */
.custom-marker { background: transparent !important; border: none !important; }

/* 缩放控件移到右下角，避免遮挡筛选 */
.leaflet-top.leaflet-left { display: none !important; }
.leaflet-control-zoom { 
  position: absolute !important; 
  bottom: 10px !important; 
  right: 10px !important; 
  top: auto !important; 
  left: auto !important; 
  border: none !important; 
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15) !important;
}
.leaflet-control-zoom a {
  width: 36px !important; 
  height: 36px !important; 
  line-height: 36px !important;
  font-size: 18px !important;
  color: #333 !important;
  background: rgba(255,255,255,0.95) !important;
  backdrop-filter: blur(8px);
  border: none !important;
  border-bottom: 1px solid rgba(0,0,0,0.06) !important;
  transition: all 0.2s !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(26,115,232,0.08) !important;
  color: var(--primary) !important;
}

/* Leaflet 地图容器背景优化 */
.leaflet-container { 
  font-family: var(--font-stack) !important; 
  background: #e8eaed !important;
}

/* 隐藏Leaflet水印 */
.leaflet-control-attribution { display: none !important; }
.leaflet-tooltip {
  border: none !important;
  background: rgba(255,255,255,0.95) !important;
  border-radius: 4px !important;
  padding: 2px 8px !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important;
  color: #333 !important;
}
.leaflet-popup-content-wrapper {
  border-radius: 16px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15) !important;
  padding: 4px !important;
}
.leaflet-popup-content {
  margin: 12px 16px !important;
  line-height: 1.5 !important;
}
.leaflet-popup-tip { border-radius: 4px !important; }
.leaflet-container { font-family: var(--font-stack) !important; }

/* 打印内容 */
.print-content { display: none; }
@media print {
  .print-content { display: block !important; }
}

/* 看房记录面板 */
.record-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.record-item {
  background: var(--gray-bg);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.record-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.record-date { font-weight: 700; font-size: 13px; }
.record-rating { color: var(--gold); font-size: 14px; }
.record-feeling { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.record-photos {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.record-photos img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--gray-light);
}

/* 卡片负面评价预览 */
.card-neg-preview {
  margin-top: 6px;
  font-size: 11px;
  color: #d93025;
  background: #fce8e6;
  border-radius: 6px;
  padding: 3px 8px;
  display: inline-block;
}

/* 弹窗负面评价区块 */
.iw-negatives {
  margin-top: 8px;
  border-top: 1px dashed #e0e0e0;
  padding-top: 8px;
}
.iw-neg-title {
  font-size: 13px;
  font-weight: 700;
  color: #d93025;
  margin-bottom: 6px;
}
.iw-neg-item {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 4px 0;
  border-bottom: 1px solid rgba(217,48,37,0.08);
}
.iw-neg-count {
  display: inline-block;
  background: #fce8e6;
  color: #d93025;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  margin-right: 4px;
}

/* 弹窗看房记录区块 */
.iw-records {
  margin-top: 8px;
  border-top: 1px dashed #e0e0e0;
  padding-top: 8px;
}
.iw-record-item {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  padding: 4px 0;
}

/* 隐藏已看按钮激活 - 与filter-tag统一 */
#hideViewedBtn.active {
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(26,115,232,0.25), 0 0 0 1px rgba(26,115,232,0.15);
  opacity: 1;
  filter: blur(0);
  font-weight: 700;
}

/* 心仪筛选标签特殊颜色 */
.filter-tag[data-filter="preferred"].active {
  background: linear-gradient(135deg, #eb2f96, #ff6b9d);
  color: #fff;
}

/* 地铁标记 */
.metro-marker { background: transparent !important; border: none !important; }

/* 地铁站筛选下拉框 - 与filter-tag统一风格 */
.metro-select {
  border: none !important;
  background: transparent !important;
  padding: 7px 14px !important;
  border-radius: 22px !important;
  font-size: 13px !important;
  font-weight: 600;
  cursor: pointer;
  color: rgba(32,34,36,0.5);
  font-family: var(--font-stack);
  white-space: nowrap;
  opacity: 0.55;
  filter: blur(0.5px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  max-width: 160px;
}
.metro-select:hover {
  opacity: 0.85;
  filter: blur(0);
  color: var(--text-primary);
}
.metro-select option {
  color: var(--text-primary);
  background: var(--white);
  filter: blur(0);
  opacity: 1;
}
.metro-select:focus { border-color: var(--primary); }

/* 弹窗重构样式 */
.iw-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}
.iw-title { font-size: 16px; font-weight: 700; flex: 1; }
.iw-stars { font-size: 14px; white-space: nowrap; letter-spacing: 1px; }
.iw-score { font-size: 11px; color: var(--text-tertiary); margin-left: 4px; }
.iw-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 4px;
}
.iw-status.viewed { background: #e8f0fe; color: var(--blue); }
.iw-status.unsuitable { background: var(--gray-light); color: var(--gray); }

.iw-scroll {
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.iw-scroll::-webkit-scrollbar { width: 4px; }
.iw-scroll::-webkit-scrollbar-track { background: transparent; }
.iw-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 2px; }

.iw-sec-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--gray-light);
}

.tier-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: 4px;
}
.tier-badge.t1 { background: rgba(245,166,35,0.12); color: var(--gold); }
.tier-badge.t2 { background: rgba(52,168,83,0.1); color: var(--green); }

.iw-record-item {
  background: var(--gray-bg);
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 6px;
}
.iw-rec-date { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.iw-rec-stars { font-size: 12px; color: var(--gold); margin-left: 4px; }
.iw-rec-feeling { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 2px; }
.iw-rec-photos { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.iw-rec-photos img { width: 50px; height: 50px; object-fit: cover; border-radius: 6px; cursor: pointer; border: 1px solid var(--gray-light); }
