/* 过渡动画与图表样式 */

@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.page.active { animation: pageIn .3s cubic-bezier(.2,.7,.3,1) both; }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.stats-grid > *, .chart-grid > * {
  animation: riseIn .45s cubic-bezier(.2,.7,.3,1) both;
}
.stats-grid > *:nth-child(2), .chart-grid > *:nth-child(2) { animation-delay: .05s; }
.stats-grid > *:nth-child(3), .chart-grid > *:nth-child(3) { animation-delay: .1s; }
.stats-grid > *:nth-child(4), .chart-grid > *:nth-child(4) { animation-delay: .15s; }

.metric-card {
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px -20px rgba(0,0,0,.65);
  border-color: var(--bright);
}

.nav-btn, .sidebar-logout, .sidebar-docs {
  transition: background .18s ease, color .18s ease, transform .16s ease;
}
.nav-btn:active { transform: scale(.985); }

.panel { transition: border-color .25s ease, background .25s ease, box-shadow .25s ease; }

.badge { transition: color .2s ease, background .2s ease; }
.badge.flash { animation: fadeIn .5s ease; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.chart-card.wide { grid-column: span 2; }
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: auto; }
}

.chart-wrap { position: relative; height: 180px; margin-top: 4px; }
.chart-wrap.short { height: 150px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }

.chart-line {
  fill: none;
  stroke: rgba(255,255,255,.92);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: dashIn 1.1s ease forwards;
}
@keyframes dashIn { to { stroke-dashoffset: 0; } }

.chart-area { opacity: 0; animation: fadeIn .9s .25s ease forwards; }
.chart-grid-line { stroke: rgba(255,255,255,.07); stroke-width: 1; }
.chart-axis-text { fill: rgba(255,255,255,.34); font-size: 9px; }
.chart-dot { fill: rgba(255,255,255,.95); opacity: 0; animation: fadeIn .4s .55s ease forwards; }
.chart-dot:hover { r: 4; }

.chart-bar {
  fill: rgba(255,255,255,.5);
  transform-box: fill-box;
  transform-origin: bottom;
  animation: growUp .7s cubic-bezier(.2,.7,.3,1) both;
  transition: fill .18s ease;
}
.chart-bar:hover { fill: rgba(255,255,255,.85); }
@keyframes growUp {
  from { transform: scaleY(0); opacity: .2; }
  to   { transform: scaleY(1); opacity: 1; }
}

.chart-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 10px;
  color: var(--muted);
}
.chart-foot b { color: #fff; font-weight: 600; }
.lg-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 0 3px rgba(255,255,255,.10);
}
.lg-sep { width: 1px; height: 10px; background: var(--line); }

.bar-list { display: grid; gap: 11px; margin-top: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) 2fr auto;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}
.bar-row .b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .b-val { color: #fff; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; border-radius: 5px; background: var(--inset); overflow: hidden; }
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 5px;
  background: linear-gradient(90deg, rgba(255,255,255,.42), rgba(255,255,255,.92));
  transition: width .9s cubic-bezier(.2,.7,.3,1);
}

.meter.big {
  height: 10px;
  border-radius: 6px;
  background: var(--inset);
  overflow: hidden;
  margin: 16px 0 10px;
}
.meter.big > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,.45), rgba(255,255,255,.95));
  transition: width .9s cubic-bezier(.2,.7,.3,1);
}

@media (prefers-reduced-motion: reduce) {
  .page.active, .stats-grid > *, .chart-grid > *, .chart-line, .chart-bar, .chart-area {
    animation: none !important;
  }
  .meter.big > span, .bar-fill { transition: none !important; }
}

/* ---------- 折叠面板（下拉过渡）---------- */
details.fold { padding: 0; overflow: hidden; }
details.fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 21px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  color: var(--text);
  transition: background .2s ease;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary:hover { background: rgba(255,255,255,.05); }
details.fold > summary .badge { transition: transform .25s ease, color .25s ease; }
details.fold[open] > summary .badge { transform: rotate(180deg); }
details.fold .fold-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .32s cubic-bezier(.2,.7,.3,1);
}
details.fold[open] .fold-body { grid-template-rows: 1fr; }
details.fold .fold-inner { overflow: hidden; }
details.fold .fold-inner > div { padding: 0 21px 18px; }
#detailTable .data-table { font-size: 11px; }
