/* ============================================
   Dashboard — Real-time Data Visualization
   ============================================ */

.dash-header {
  text-align: center;
  padding: 48px 0 24px;
}
.dash-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 8px;
}
.dash-update {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 12px;
  font-family: "Inter", sans-serif;
}
.dash-update .live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4caf50;
  margin-right: 4px;
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Sections */
.dash-section {
  margin-bottom: 40px;
}
.dash-section-title {
  font-family: "Noto Serif JP", serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* 予測 vs 実測 comparison cards */
.dash-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-park-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
}
.park-label {
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}
.park-label--tdl { color: #d81b72; }
.park-label--tds { color: #2563a8; }

.level-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.level-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.level-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.level-num {
  font-family: "Inter", sans-serif;
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
}
.level-text {
  font-size: 0.72rem;
  color: var(--text-sub);
}
.level-arrow {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-top: 12px;
}

.level-verdict {
  margin-top: 12px;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
}
.level-verdict.hit {
  background: rgba(76, 175, 80, 0.1);
  color: #388e3c;
}
.level-verdict.miss {
  background: rgba(244, 67, 54, 0.1);
  color: #c62828;
}
.level-verdict.waiting {
  background: var(--accent-soft);
  color: var(--text-muted);
}

/* Park switch tabs */
.dash-park-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.dash-tab {
  padding: 6px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  color: var(--text-sub);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.dash-tab:hover {
  border-color: var(--accent);
}
.dash-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Waittime list */
.waittime-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wt-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: background 0.15s;
}
.wt-row:hover {
  background: var(--surface);
}
.wt-rank {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  color: var(--text-muted);
  width: 24px;
  flex-shrink: 0;
}
.wt-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wt-time {
  font-family: "Inter", sans-serif;
  font-size: 1rem;
  font-weight: 600;
  min-width: 50px;
  text-align: right;
  flex-shrink: 0;
}
.wt-time span {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}
.wt-bar-bg {
  width: 80px;
  height: 6px;
  background: var(--surface);
  border-radius: 3px;
  margin-left: 12px;
  flex-shrink: 0;
  overflow: hidden;
}
.wt-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s var(--ease);
}
.wt-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-width: 50px;
  text-align: right;
  flex-shrink: 0;
}
.wt-status.closed {
  color: #c62828;
}

/* Bar chart */
.bar-chart-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bc-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.bc-label {
  width: 140px;
  font-size: 0.75rem;
  color: var(--text-sub);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}
.bc-bar-wrap {
  flex: 1;
  height: 22px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.bc-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s var(--ease);
  display: flex;
  align-items: center;
  padding-left: 8px;
}
.bc-bar-val {
  font-family: "Inter", sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.bc-bar--tdl { background: linear-gradient(90deg, #f48db0, #d81b72); }
.bc-bar--tds { background: linear-gradient(90deg, #8ec0e0, #2563a8); }

/* Note */
.dash-note {
  padding: 24px 0 40px;
  border-top: 1px solid var(--border-light);
  margin-top: 20px;
}
.dash-note p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.dash-loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* History table */
.history-table-wrap {
  overflow-x: auto;
}
.history-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.history-tbl th {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 6px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.history-tbl td {
  text-align: center;
  padding: 7px 6px;
  border-bottom: 1px solid var(--border-light);
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
}
.history-tbl .ht-date {
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.ht-exact {
  color: #388e3c;
  font-weight: 600;
}
.ht-close {
  color: #b8925a;
  font-weight: 500;
}
.ht-off {
  color: #c62828;
  font-weight: 500;
}
.ht-summary {
  text-align: center;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-sub);
}
.ht-summary strong {
  font-size: 1rem;
  color: var(--text);
}

/* offline / error */
.dash-error {
  text-align: center;
  padding: 32px;
  background: var(--surface);
  border-radius: 12px;
  color: var(--text-sub);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
  .dash-comparison {
    grid-template-columns: 1fr;
  }
  .dash-park-card {
    padding: 20px 16px;
  }
  .level-num {
    font-size: 2rem;
  }
  .wt-bar-bg {
    width: 50px;
  }
  .bc-label {
    width: 100px;
    font-size: 0.68rem;
  }
}
@media (max-width: 480px) {
  .wt-bar-bg {
    display: none;
  }
  .bc-label {
    width: 80px;
  }
  .hide-sp {
    display: none;
  }
  .history-tbl td,
  .history-tbl th {
    padding: 6px 3px;
    font-size: 0.72rem;
  }
}
