/* ============================================================
   BCP_BKK2 BSC / Rack UI
   Legacy rack and compare layout, backed by the normalized API.
   ============================================================ */

.bcp-bkk2-bsc-page {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--text-primary);
  font: 13px/1.5 var(--font-sans);
}

.bcp-bkk2-bsc-page * { box-sizing: border-box; }

.bcp-bkk2-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 4px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.bcp-bkk2-toolbar-title {
  padding: 8px 12px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.bcp-bkk2-view-tabs { display: inline-flex; gap: 4px; }

.bcp-bkk2-view-tabs button {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}

.bcp-bkk2-view-tabs button:hover {
  background: var(--bg-panel);
  color: var(--text-primary);
}

.bcp-bkk2-view-tabs button.active {
  border-color: var(--text-primary);
  background: var(--text-primary);
  color: #fff;
}

.bcp-bkk2-card {
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.bcp-bkk2-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.bcp-bkk2-card-title .dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--warning);
}

.bcp-bkk2-card-title .dot-voltage { background: #ef4444; }
.bcp-bkk2-card-title .dot-soc { background: #22c55e; }

.bcp-bkk2-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.bcp-bkk2-summary-box,
.bcp-bkk2-status-chip {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}

.bcp-bkk2-label {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .2px;
  text-transform: uppercase;
}

.bcp-bkk2-value {
  margin-top: 2px;
  color: var(--text-primary);
  font: 600 16px var(--font-mono);
}

.bcp-bkk2-unit {
  margin-left: 3px;
  color: var(--text-secondary);
  font: 500 11px var(--font-sans);
}

.bcp-bkk2-status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.bcp-bkk2-status-chip .bcp-bkk2-value { font-size: 14px; }
.bcp-bkk2-status-chip.online .bcp-bkk2-value { color: var(--success); }

.bcp-bkk2-table-wrap { overflow-x: auto; margin: -4px; }

.bcp-bkk2-table {
  width: 100%;
  min-width: 930px;
  border-collapse: collapse;
}

.bcp-bkk2-table th,
.bcp-bkk2-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--border-default);
  text-align: center;
  white-space: nowrap;
}

.bcp-bkk2-table th {
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .25px;
  text-transform: uppercase;
}

.bcp-bkk2-table td { color: var(--text-primary); font-size: 12px; }
.bcp-bkk2-table tr:last-child td { border-bottom: 0; }
.bcp-bkk2-status-normal { color: var(--success); font-weight: 600; }
.bcp-bkk2-status-offline { color: var(--danger); font-weight: 600; }

.bcp-bkk2-inline-meter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.bcp-bkk2-inline-meter-value { width: 42px; text-align: right; }

.bcp-bkk2-meter {
  display: inline-block;
  width: 52px;
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  background: var(--bg-panel);
}

.bcp-bkk2-meter-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width .35s ease;
}

.bcp-bkk2-meter-fill.soc { background: linear-gradient(90deg, #4ade80, #22c55e); }
.bcp-bkk2-meter-fill.voltage { background: linear-gradient(90deg, #f97316, #ef4444); }

.bcp-bkk2-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bcp-bkk2-rack-box {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-default);
}

.bcp-bkk2-rack-box:last-child { border-bottom: 0; }

.bcp-bkk2-rack-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
}

.bcp-bkk2-rack-head .mono {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.bcp-bkk2-rack-meter {
  height: 10px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
}

.bcp-bkk2-rack-meter .bcp-bkk2-meter-fill { width: 0; height: 100%; }

.bcp-bkk2-stamp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px;
  color: var(--text-tertiary);
  font-size: 11px;
  flex-wrap: wrap;
}

.bcp-bkk2-stamp-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-weight: 600;
}

.bcp-bkk2-stamp-live::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  animation: bcp-bkk2-pulse 1.6s ease-in-out infinite;
}

.bcp-bkk2-stamp-live.offline { color: var(--danger); }

.bcp-bkk2-error,
.bcp-bkk2-loading {
  padding: 28px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-secondary);
  text-align: center;
}

.bcp-bkk2-error { color: var(--danger); }

@keyframes bcp-bkk2-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

@media (max-width: 900px) {
  .bcp-bkk2-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bcp-bkk2-compare-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .bcp-bkk2-toolbar { align-items: stretch; flex-direction: column; }
  .bcp-bkk2-toolbar-title { padding-bottom: 0; }
  .bcp-bkk2-view-tabs { width: 100%; }
  .bcp-bkk2-view-tabs button { flex: 1; }
  .bcp-bkk2-summary-grid,
  .bcp-bkk2-status-row { grid-template-columns: 1fr; }
  .bcp-bkk2-stamp { align-items: flex-start; flex-direction: column; }
}
