/* projects/show 頁專用 CSS（從 inline <style> 抽出，方便 browser cache） */
.note-tip { position: relative; }
.note-tip:hover::after { content: attr(data-tip); position: absolute; bottom: 120%; right: 0; background: #333; color: #fff; padding: 4px 8px; border-radius: 4px; font-size: 12px; white-space: nowrap; z-index: 10; pointer-events: none; }

/* Card 容器（對齊 area 頁 .area-card 視覺） */
.project-card { background: white; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #e5e7eb; padding: 24px; margin-bottom: 20px; transition: box-shadow 0.2s; }
.project-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.project-card > h2 { margin: 0 0 16px 0; font-size: 17px; color: #1f2937; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.project-card > h2::before { content: ''; display: inline-block; width: 3px; height: 18px; background: #2563eb; border-radius: 2px; flex-shrink: 0; }

.tab-container { margin-bottom: 20px; }
.tab-buttons { display: flex; gap: 10px; margin-bottom: 15px; }
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: #e5e7eb;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.tab-btn.active { background: #2563eb; color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }
.sales-matrix { overflow-x: auto; }
.sales-matrix table { border-collapse: collapse; min-width: 100%; }
.sales-matrix th, .sales-matrix td {
  border: 1px solid #ddd;
  padding: 8px 12px;
  text-align: center;
  min-width: 80px;
  font-size: 12px;
}
.sales-matrix th { background: #333; color: white; position: sticky; top: 0; }
.sales-matrix .floor-header { background: #f3f4f6; font-weight: bold; position: sticky; left: 0; }
.sales-matrix .sold { transition: filter 0.15s; }
.sales-matrix .sold:hover { filter: brightness(0.9); }
.sales-matrix .empty { background: #f9fafb; color: #9ca3af; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); column-gap: 28px; row-gap: 3px; }
.info-item { display: flex; border-bottom: 1px solid #eee; padding: 7px 0; font-size: 14px; line-height: 1.45; }
.info-label { color: #666; min-width: 96px; }
.info-value { font-weight: 500; }
.stat-card {
  background: white;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e5e7eb;
}
.stat-card .stat-value { font-size: 24px; font-weight: bold; }
.stat-card .stat-label { color: #666; font-size: 12px; margin-top: 4px; }
.stat-card .stat-sub { color: #999; font-size: 11px; margin-top: 2px; }
.progress-bar-bg {
  background: #e5e7eb;
  border-radius: 4px;
  height: 8px;
  margin-top: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.ping-filter-btn {
  padding: 6px 14px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.ping-filter-btn:hover { border-color: #2563eb; color: #2563eb; }
.ping-filter-btn.active { background: #2563eb; color: white; border-color: #2563eb; }

/* 手機版 RWD */
@media (max-width: 640px) {
  .project-main { padding: 14px 10px !important; }
  .project-card { padding: 14px !important; margin-bottom: 16px !important; }
  .project-card > h2 { font-size: 16px !important; margin-bottom: 12px !important; }
  .project-main > h1 { font-size: 20px !important; padding-bottom: 8px !important; }
  .project-main > h1 .developer-name { display: block; margin-left: 0 !important; margin-top: 4px; font-size: 13px !important; }

  /* 統計卡片 */
  .project-stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .stat-card { padding: 12px !important; }
  .stat-card .stat-value { font-size: 20px !important; }

  /* 基本資料 */
  .project-info-section { padding: 14px !important; }
  .info-grid { grid-template-columns: 1fr !important; }
  .info-label { min-width: 90px !important; font-size: 13px; }

  /* 地圖街景 */
  .map-street-grid { grid-template-columns: 1fr !important; }
  .map-street-grid > div { height: 250px !important; }

  /* Tab 按鈕 */
  .tab-buttons { flex-wrap: wrap; gap: 6px !important; }
  .tab-btn { padding: 8px 14px !important; font-size: 13px !important; }

  /* 實價登錄表格 */
  .txn-table-wrap { padding: 10px !important; }
  .txn-table { min-width: 800px; }
  .txn-table th, .txn-table td { padding: 8px 6px !important; }

  /* 坪數篩選 */
  .ping-filter-btn { padding: 5px 10px !important; font-size: 12px !important; }

  /* 價格分析圖表 */
  .analysis-grid { grid-template-columns: 1fr !important; }

  /* 設計圖 */
  .urban-plan-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important; gap: 6px !important; }
  .urban-plan-thumb { height: 70px !important; }

  /* 銷控表 */
  .sales-matrix { padding: 10px !important; }

  /* 圖表高度縮減 */
  .chart-container { height: 220px !important; }
  .analysis-grid > div { padding: 14px !important; }
  .analysis-grid h3 { font-size: 14px !important; }

  /* 頁面標題 */
  .project-main > h1 { font-size: 22px !important; }

  /* 基本資料子區塊間距 */
  .project-info-section .info-item { padding: 6px 0 !important; }

  /* 銷控表 cell 更緊湊 */
  .sales-matrix th, .sales-matrix td { padding: 6px 8px !important; min-width: 65px !important; font-size: 11px !important; }

  /* 熱力圖圖例 */
  .heatmap-legend { flex-wrap: wrap; font-size: 11px; gap: 6px !important; }

  /* 交易表格 body cell nowrap 關鍵欄位 */
  .txn-table td { white-space: nowrap; }

  /* footer 間距 */
  .project-main > footer { padding: 12px 0 !important; }

  /* 設計圖 lightbox 按鈕（手機上縮小、貼邊、加深底色，讓圖片避開按鈕區） */
  #urban-prev { left: 6px !important; padding: 6px 10px !important; font-size: 24px !important; background: rgba(0,0,0,0.55) !important; }
  #urban-next { right: 6px !important; padding: 6px 10px !important; font-size: 24px !important; background: rgba(0,0,0,0.55) !important; }
  .urban-lightbox-img { max-width: 80% !important; }
}

/* 交易詳情 modal */
#txn-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4); backdrop-filter: blur(4px);
  z-index: 1000; justify-content: center; align-items: center;
  opacity: 0; transition: opacity 0.2s ease-out;
}
#txn-modal.show { opacity: 1; }
#txn-modal .modal-card {
  background: #fff; border-radius: 16px;
  max-width: 420px; width: 92%; max-height: 85vh;
  overflow-y: auto; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transform: translateY(12px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
#txn-modal.show .modal-card { transform: translateY(0) scale(1); }
#txn-modal .modal-header {
  padding: 20px 24px 16px; display: flex;
  justify-content: space-between; align-items: flex-start;
}
#txn-modal .modal-close {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af; font-size: 20px; line-height: 1;
  transition: background 0.15s, color 0.15s; flex-shrink: 0;
}
#txn-modal .modal-close:hover { background: #f3f4f6; color: #374151; }
#txn-modal .modal-hero {
  margin: 0 24px 16px; padding: 16px 20px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  border-radius: 12px; display: flex;
  justify-content: space-around; text-align: center;
}
#txn-modal .modal-hero .hero-item { flex: 1; }
#txn-modal .modal-hero .hero-label {
  font-size: 11px; color: #94a3b8; margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
#txn-modal .modal-hero .hero-value {
  font-size: 20px; font-weight: 700; color: #0f172a;
}
#txn-modal .modal-hero .hero-unit {
  font-size: 12px; color: #64748b; font-weight: 400;
}
#txn-modal .modal-hero .hero-divider {
  width: 1px; background: #e2e8f0; margin: 0 4px;
}
#txn-modal .modal-body { padding: 0 24px 20px; }
#txn-modal .modal-row {
  display: flex; justify-content: space-between;
  align-items: center; padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
#txn-modal .modal-row:last-child { border-bottom: none; }
#txn-modal .modal-label { font-size: 13px; color: #94a3b8; }
#txn-modal .modal-value { font-size: 14px; color: #1e293b; font-weight: 500; text-align: right; }
#txn-modal .modal-badge {
  display: inline-block; font-size: 11px; font-weight: 600;
  border-radius: 6px; padding: 2px 8px; letter-spacing: 0.3px;
}
#txn-modal .modal-special {
  font-size: 11px; color: #f59e0b; margin-left: 6px;
}
