/* ========================================================
   六合彩獨立走勢分布圖專屬樣式 (modules/trend_marksix/trend_marksix.css)
   完全隔離作用域 · 標準 01~49 號 ＋ 特碼獨立標示
   ======================================================== */
:root {
  --bg-primary: #070913;
  --bg-card: #0c1222;
  --bg-header: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --color-brand: #b91c1c;
  --color-green: #16a34a;
  --color-gold: #f59e0b;
  --color-yellow: #eab308;
  --border-subtle: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.trend-page-container {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 12px 14px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 頂部導航橫幅 */
.trend-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(135deg, rgba(185, 28, 28, 0.45), rgba(15, 23, 42, 0.95));
  border: 1.5px solid rgba(220, 38, 38, 0.4);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(220, 38, 38, 0.15);
}

.trend-brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trend-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(220, 38, 38, 0.6));
}

.trend-title-texts h1 {
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff1f2;
  letter-spacing: 0.5px;
}

.trend-badge-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: 6px;
  margin-top: 2px;
}

.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-back-home:hover {
  background: #334155;
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* 頂部操作工具列 */
.trend-toolbar-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-card);
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.toolbar-group-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.pills-group {
  display: inline-flex;
  background: #1e293b;
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pill-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn:hover {
  color: #ffffff;
}

.pill-btn.active {
  background: #b91c1c;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(185, 28, 28, 0.5);
}

.btn-more-periods {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-more-periods:hover {
  background: #334155;
  color: #ffffff;
}

.toolbar-group-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #1e293b;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.search-input-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #f1f5f9;
  font-size: 0.85rem;
  width: 170px;
}

.search-input-box input::placeholder {
  color: #64748b;
  font-size: 0.8rem;
}

.btn-clear {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.btn-clear:hover {
  color: #f87171;
}

.tip-hint {
  font-size: 0.78rem;
  color: #eab308;
}

/* 走勢矩陣主表容器 */
.trend-table-wrapper {
  position: relative;
  width: 100%;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.4);
}

.trend-matrix-table {
  table-layout: fixed;
  width: max-content;
  min-width: 1420px;
  border-collapse: collapse;
  margin: 0 auto;
  user-select: none;
}

/* 表頭：【期號】+【01 到 49】紅底白字球號標題列 */
.trend-matrix-table thead th {
  padding: 6px 2px;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  vertical-align: middle;
}

.trend-matrix-table th.th-period {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  background: #1e293b !important;
  color: #f1f5f9 !important;
  position: sticky;
  left: 0;
  z-index: 5;
}

.trend-matrix-table th.th-ball {
  width: 27px;
  min-width: 27px;
  max-width: 27px;
  background: #b91c1c !important;
  color: #ffffff !important;
  font-family: monospace, sans-serif;
  letter-spacing: -0.5px;
}

/* 表身 */
.trend-matrix-table tbody tr {
  cursor: pointer;
  transition: background-color 0.15s;
}

.trend-matrix-table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.4);
}

.trend-matrix-table tbody tr:hover {
  background: rgba(51, 65, 85, 0.4);
}

.trend-matrix-table tbody tr.row-active-yellow {
  background: rgba(234, 179, 8, 0.28) !important;
  outline: 1px solid rgba(234, 179, 8, 0.6);
}

.trend-matrix-table tbody tr.row-active-yellow td {
  background: rgba(234, 179, 8, 0.28) !important;
  color: #fef08a !important;
}

.trend-matrix-table tbody td {
  padding: 3px 0;
  height: 28px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 11px;
  box-sizing: border-box;
}

.trend-matrix-table td.td-period {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  font-family: monospace;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  background: #0f172a;
  position: sticky;
  left: 0;
  z-index: 3;
}

.trend-matrix-table td.td-cell {
  width: 27px;
  min-width: 27px;
  max-width: 27px;
}

.cell-dash {
  color: rgba(148, 163, 184, 0.25);
  font-size: 10px;
}

/* 正碼球：綠色亮塊 */
.ball-hit-green {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #16a34a;
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  border-radius: 4px;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
  font-family: monospace;
}

/* 特碼：醒目金底紅外框亮塊 */
.ball-hit-special {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  font-weight: 900;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid #fef08a;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.8);
  font-family: monospace;
}

/* 垂直搜尋高亮欄位 */
.trend-matrix-table .col-active-search {
  background-color: rgba(6, 182, 212, 0.22) !important;
  border-left: 1.5px solid #06b6d4 !important;
  border-right: 1.5px solid #06b6d4 !important;
}

.trend-matrix-table thead th.col-active-search {
  background-color: #0891b2 !important;
  color: #ffffff !important;
}

/* 表尾統計面板 */
.trend-matrix-table tfoot {
  border-top: 2px solid rgba(255, 255, 255, 0.2);
  background: #0f172a;
}

.trend-matrix-table tfoot th.th-stat-label {
  width: 78px;
  min-width: 78px;
  max-width: 78px;
  padding: 6px 4px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  background: #1e293b;
  color: #cbd5e1;
  position: sticky;
  left: 0;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.trend-matrix-table tfoot td {
  width: 27px;
  min-width: 27px;
  max-width: 27px;
  padding: 4px 0;
  text-align: center;
  vertical-align: middle;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.trend-matrix-table .tfoot-count-row td.td-stat-count {
  font-family: monospace;
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  background: #0b1329;
}

.trend-matrix-table .tfoot-bar-row {
  height: 60px;
}

.trend-matrix-table .tfoot-bar-row td.td-stat-bar {
  background: #090e1c;
  vertical-align: bottom;
  padding: 0 3px 3px;
}

.bar-wrapper {
  height: 52px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bar-fill {
  width: 14px;
  background: linear-gradient(to top, #9333ea, #a855f7, #c084fc);
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 6px rgba(168, 85, 247, 0.6);
  transition: height 0.3s ease-out;
}

/* 底部圖例說明 */
.trend-footer-legend {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 6px;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.swatch.green {
  background: #16a34a;
}

.swatch.gold {
  background: #f59e0b;
}

.swatch.yellow {
  background: #eab308;
}

.swatch.purple {
  background: #9333ea;
}
