/* style.css - 完美復刻房仲ERP戰情室設計規範 */
:root {
  --sidebar-bg: #1e222d;
  --sidebar-hover: #2a2f3d;
  --sidebar-active: #e60012; /* 永慶紅強調標記 */
  --body-bg: #f0f3f8;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --red-kpi: #ef4444;
  --orange-kpi: #f59e0b;
  --green-kpi: #10b981;
  --blue-kpi: #0284c7;
  --purple-kpi: #8b5cf6;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Microsoft JhengHei", Roboto, sans-serif;
}

body {
  background-color: var(--body-bg);
  color: var(--text-main);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* 左側邊欄 */
.sidebar {
  width: 200px;
  background-color: var(--sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand-section {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--sidebar-active);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
}

.brand-text h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
}

.brand-text p {
  font-size: 9px;
  color: var(--text-light);
  margin-top: 2px;
}

.nav-menu {
  flex: 1;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background-color: var(--sidebar-active);
  color: #fff;
  font-weight: 700;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
}

.store-info {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.slogan {
  color: #94a3b8;
  font-style: italic;
  font-size: 10px;
  line-height: 1.3;
}

/* 主畫面區塊 */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 頂部 Header */
.top-header {
  height: 64px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title-box h1 {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 16px;
}

.clock-badge {
  font-size: 12px;
  color: var(--text-muted);
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e2e8f0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
}

/* 可滾動主工作區 */
.scroll-area {
  flex: 1;
  padding: 16px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* 頂部快速篩選列 */
.top-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.select-pill {
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.search-wrapper {
  flex: 1;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 16px 8px 36px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  font-size: 12px;
  outline: none;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13px;
}

/* 5 大 KPI 卡片列 */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 16px 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border-left: 4px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi-card.c-red { border-left-color: var(--red-kpi); }
.kpi-card.c-orange { border-left-color: var(--orange-kpi); }
.kpi-card.c-green { border-left-color: var(--green-kpi); }
.kpi-card.c-blue { border-left-color: var(--blue-kpi); }
.kpi-card.c-purple { border-left-color: var(--purple-kpi); }

.kpi-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi-number-wrap {
  margin: 10px 0 6px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kpi-number {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.kpi-unit {
  font-size: 12px;
  color: var(--text-muted);
}

.kpi-badge {
  font-size: 11px;
  background: #dcfce7;
  color: #15803d;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.kpi-sub-info {
  font-size: 11px;
  color: var(--text-muted);
}

.text-up { color: #16a34a; font-weight: 600; }

/* 核心雙欄結構 (左: 清單, 右: 分析面板) */
.workspace-grid {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 16px;
  align-items: start;
}

/* 左側案件清單卡片區塊 */
.table-panel {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.tab-pill-group {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.tab-pill {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.tab-pill.active {
  background: var(--sidebar-active);
  color: #fff;
}

.view-switch {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.btn-switch {
  border: none;
  background: #fff;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-switch.active {
  background: #f1f5f9;
  color: var(--text-main);
  font-weight: 600;
}

/* 表格本體 */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.data-table tr:hover {
  background-color: #fafbfd;
}

/* 表格列細節樣式 */
.cell-property {
  display: flex;
  align-items: center;
  gap: 12px;
}

.prop-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
}

.prop-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 13px;
}

.prop-sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.badge-status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  display: inline-block;
}

.badge-status.exclusive { background: #fee2e2; color: #b91c1c; }
.badge-status.normal { background: #dbeafe; color: #1d4ed8; }
.badge-status.sold { background: #dcfce7; color: #15803d; }
.badge-status.market { background: #fef3c7; color: #b45309; }
.badge-status.valuation { background: #f3e8ff; color: #7e22ce; }

.price-main {
  font-weight: 800;
  color: var(--text-main);
  font-size: 13px;
}

.price-sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.price-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-top: 3px;
  font-weight: 600;
}

.price-tag.danger { background: #fee2e2; color: #dc2626; }
.price-tag.success { background: #dcfce7; color: #16a34a; }
.price-tag.info { background: #e0f2fe; color: #0284c7; }

.tag-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #475569;
}

.dot-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.dot-danger { background: var(--red-kpi); }
.dot-warning { background: var(--orange-kpi); }
.dot-success { background: var(--green-kpi); }
.dot-info { background: var(--blue-kpi); }

.btn-detail {
  padding: 4px 10px;
  border: 1px solid var(--border-color);
  background: #fff;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-main);
}

.btn-detail:hover {
  background: #f1f5f9;
}

/* 右側分析與小工具 */
.side-widgets {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.widget-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.widget-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.widget-title {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.widget-sublink {
  font-size: 11px;
  color: #0284c7;
  text-decoration: none;
  cursor: pointer;
}

/* 案件趨勢折線圖模擬 */
.chart-box {
  width: 100%;
  height: 120px;
}

/* 估價甜甜圈圖 */
.donut-box {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 0;
}

.donut-chart {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: conic-gradient(#10b981 0% 58%, #f59e0b 58% 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.donut-inner {
  width: 54px;
  height: 54px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-number {
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
}

.donut-label {
  font-size: 9px;
  color: var(--text-muted);
}

.donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
}

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

/* 待辦項目清單 */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 6px;
  font-size: 12px;
}

.task-badge {
  font-weight: 700;
  color: var(--text-main);
}

/* 最近活動流 */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  padding-left: 14px;
  border-left: 2px solid #f1f5f9;
}

.timeline-item {
  position: relative;
  font-size: 11px;
}

.timeline-dot {
  position: absolute;
  left: -19px;
  top: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.timeline-dot.blue { background: #0284c7; }
.timeline-dot.green { background: #10b981; }
.timeline-dot.yellow { background: #f59e0b; }

.timeline-time {
  font-weight: 700;
  color: var(--text-muted);
  margin-right: 4px;
}
