﻿@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;600;700&display=swap');

:root {
  --accent: #7b61ff;
  --accent-2: #5f8bff;
  --accent-3: #47b8a6;
  --ink: #1d2133;
  --muted: #6d7286;
  --panel: #ffffff;
  --bg: #e8e6f2;
}

.demo-shell {
  min-height: 100vh;
  background: var(--bg);
  padding: 28px;
  font-family: 'Manrope', 'Inter', system-ui, sans-serif;
  color: var(--ink);
}

.demo-stage {
  max-width: 1420px;
  margin: 0 auto;
}

.demo-card {
  background: #fdfcff;
  border-radius: 28px;
  padding: 22px;
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 22px;
  box-shadow: 0 30px 70px rgba(64, 52, 128, 0.18);
}

.demo-sidebar {
  background: linear-gradient(180deg, #7d63ff 0%, #6a4cf5 100%);
  border-radius: 22px;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.side-logo {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  font-size: 20px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  align-items: center;
}

.side-dot {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
  background: transparent;
  transition: all 0.2s ease;
}

.side-dot.active,
.side-dot:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.side-footer {
  margin-top: auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
}

.user-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
}

.demo-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.demo-header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  column-gap: 16px;
  row-gap: 14px;
  align-items: start;
}

.header-text h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 6px 0 6px;
  color: var(--ink);
}

.header-text .eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 600;
}

.header-text .lead {
  color: var(--muted);
  font-size: 14px;
}

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

.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: none;
  background: #ffffff;
  color: var(--muted);
  box-shadow: 0 10px 18px rgba(44, 52, 92, 0.08);
}

.header-pills {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
}

.pill {
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.pill-purple {
  background: linear-gradient(135deg, #8a6bff 0%, #6f56f7 100%);
}

.pill-blue {
  background: linear-gradient(135deg, #5e8bff 0%, #4a6df3 100%);
}

.pill-teal {
  background: linear-gradient(135deg, #58c2b2 0%, #46a59a 100%);
}

.pill-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  display: grid;
  place-items: center;
}

.pill-value {
  font-weight: 700;
  font-size: 18px;
}

.pill-label {
  font-size: 12px;
  opacity: 0.9;
}

.demo-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.7fr 1.05fr;
  gap: 22px;
}

.grid-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  border: none;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 40px rgba(38, 36, 88, 0.08);
  overflow: hidden;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #eeeaf8;
  font-weight: 600;
  padding: 14px 18px;
  font-size: 15px;
}

.card-body {
  padding: 16px 18px 18px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.vitals-card .card-body {
  display: grid;
  gap: 16px;
}

.bpm-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.bpm-value {
  font-size: 42px;
  font-weight: 700;
  color: #6a4cf5;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.bpm-unit {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.bpm-meta {
  text-align: right;
  color: var(--muted);
  font-size: 13px;
}

.bpm-status {
  font-weight: 700;
  color: var(--ink);
  margin-top: 4px;
}

.bpm-note {
  font-size: 12px;
  color: #8b8fa3;
}

.bpm-updated {
  font-size: 11px;
  color: #9aa0b3;
  margin-top: 6px;
  transition: color 0.2s ease;
}

.bpm-updated.bpm-flash {
  color: #6a4cf5;
}

.bpm-bar {
  height: 10px;
  border-radius: 999px;
  background: #f0edf9;
  position: relative;
  overflow: hidden;
}

.bpm-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 65%;
  background: linear-gradient(90deg, #7b61ff 0%, #59c1b0 100%);
}

.upload-area {
  min-height: 140px;
  border-radius: 16px;
  border: 2px dashed rgba(123, 97, 255, 0.3);
  background: linear-gradient(180deg, #f9f7ff 0%, #f1eefc 100%);
}

.btn {
  border-radius: 12px;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, #7b61ff 0%, #6a4cf5 100%);
  border: none;
}

.btn-outline-primary {
  color: #6a4cf5;
  border-color: rgba(106, 76, 245, 0.35);
}

.btn-outline-primary:hover {
  background: rgba(106, 76, 245, 0.12);
}

.btn-outline-teal {
  color: #2aa7a1;
  border-color: rgba(42, 167, 161, 0.35);
}

.btn-outline-teal:hover {
  background: rgba(42, 167, 161, 0.12);
}

.signal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.signal-plot {
  min-height: 240px;
  border-radius: 14px;
  background: #faf9ff;
}

.signal-info {
  background: #f9f8fd;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 8px;
  font-size: 13px;
}

.signal-hidden {
  display: none;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.info-row strong {
  color: var(--ink);
}

.signal-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.signal-count {
  background: #f2effa;
  border-radius: 10px;
  padding: 4px 10px;
  font-weight: 600;
  color: #5a4de3;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: #f2effa;
  color: #5a4de3;
}

.class-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.metric-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 14px 30px rgba(38, 36, 88, 0.08);
}

.metric-value {
  font-size: 18px;
  font-weight: 700;
  color: #4f58d7;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
}

.quality-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quality-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.quality-item {
  background: #f6f4ff;
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}

.quality-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.quality-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.quality-pill.neutral {
  background: #e8e6ff;
  color: #5a4de3;
}

.quality-pill.good {
  background: #d9f7ec;
  color: #1e8e6e;
}

.quality-pill.warn {
  background: #fff1db;
  color: #b56a00;
}

.quality-pill.bad {
  background: #fde2e1;
  color: #c4453d;
}

.quality-note {
  font-size: 12px;
  color: var(--muted);
  background: #faf9ff;
  border-radius: 12px;
  padding: 10px 12px;
}

.model-info-card .card-body {
  display: grid;
  gap: 10px;
}

.model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f5ff;
  font-size: 13px;
}

.model-row span {
  color: var(--muted);
}

.model-row strong {
  font-weight: 600;
  color: #3b3f59;
}

.progress {
  height: 8px;
  border-radius: 999px;
}

.progress-bar {
  border-radius: 999px;
}

.badge.class-0 { background: #6f56f7; color: white; }
.badge.class-1 { background: #ff8c6b; color: white; }
.badge.class-2 { background: #6fbeff; color: white; }
.badge.class-3 { background: #ffd166; color: #1d2133; }
.badge.class-4 { background: #adb5bd; color: #1d2133; }

#ecgPlot,
#classPerformance,
#confusionMatrix,
#rocCurves,
#modelComparison {
  background: #faf9ff;
  border-radius: 14px;
}

@media (max-width: 1200px) {
  .demo-card {
    grid-template-columns: 1fr;
  }
  .demo-sidebar {
    flex-direction: row;
    justify-content: space-around;
    height: 64px;
  }
  .demo-grid {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .quality-row {
    grid-template-columns: 1fr;
  }
  .header-pills {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .demo-shell {
    padding: 16px;
  }
  .signal-grid {
    grid-template-columns: 1fr;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .quality-row {
    grid-template-columns: 1fr;
  }
}

/* Dark mode is manual (theme toggle) and scoped to demo page */
.theme-dark .demo-shell {
  background: radial-gradient(circle at top, #1c2233 0%, #0f1320 55%, #0b0f1a 100%);
  color: #e6e9f2;
}

.theme-dark .demo-shell .demo-card {
  background: #111623;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.theme-dark .demo-shell .demo-content {
  color: #e6e9f2;
}

.theme-dark .demo-shell .demo-header h1 {
  color: #f2f4ff;
}

.theme-dark .demo-shell .demo-header .lead,
.theme-dark .demo-shell .eyebrow {
  color: #aab2c6;
}

.theme-dark .demo-shell .demo-sidebar {
  background: linear-gradient(180deg, #3a2fa8, #241a6f);
}

.theme-dark .demo-shell .side-dot {
  background: rgba(255, 255, 255, 0.08);
  color: #e9ecff;
}

.theme-dark .demo-shell .side-dot.active {
  background: #6f56f7;
  color: #ffffff;
}

.theme-dark .demo-shell .card,
.theme-dark .demo-shell .metric-card {
  background: #171d2b;
  color: #e6e9f2;
  border: 1px solid #232a3d;
}

.theme-dark .demo-shell .card-header {
  color: #f2f4ff;
  border-bottom: 1px solid #232a3d;
  background: transparent;
}

.theme-dark .demo-shell .upload-area {
  background: #131827;
}

.theme-dark .demo-shell .border-dashed {
  border-color: rgba(140, 148, 170, 0.25);
}

.theme-dark .demo-shell .icon-btn {
  background: #232a3d;
  color: #c9d0ff;
}

.theme-dark .demo-shell .signal-count {
  background: #232a3d;
  color: #d7dcf2;
}

.theme-dark .demo-shell .pill {
  background: #1d2435;
  border: 1px solid #2a3145;
  color: #e7ebff;
}

.theme-dark .demo-shell .pill-icon {
  background: rgba(255, 255, 255, 0.08);
  color: #cfd6ff;
}

.theme-dark .demo-shell .quality-item,
.theme-dark .demo-shell .quality-note,
.theme-dark .demo-shell .model-row {
  background: #1b2233;
}

.theme-dark .demo-shell .quality-pill.neutral {
  background: #2a3145;
  color: #cbd4ff;
}

.theme-dark .demo-shell .quality-pill.good {
  background: rgba(51, 184, 138, 0.2);
  color: #8ee8c6;
}

.theme-dark .demo-shell .quality-pill.warn {
  background: rgba(255, 181, 92, 0.18);
  color: #ffd49c;
}

.theme-dark .demo-shell .quality-pill.bad {
  background: rgba(235, 92, 92, 0.18);
  color: #ffb3b3;
}

.theme-dark .demo-shell .progress {
  background: #232a3d;
}

.theme-dark .demo-shell .table {
  color: #dfe4f4;
}

.theme-dark .demo-shell .table th,
.theme-dark .demo-shell .table td {
  border-color: #2a3145;
}

.theme-dark .demo-shell .table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.theme-dark .demo-shell #ecgPlot,
.theme-dark .demo-shell #classPerformance,
.theme-dark .demo-shell #confusionMatrix,
.theme-dark .demo-shell #rocCurves,
.theme-dark .demo-shell #modelComparison {
  background: #111624;
}

.theme-dark .demo-shell .btn-outline-secondary {
  color: #c7ccd9;
  border-color: #3a425a;
}

.theme-dark .demo-shell .btn-outline-primary,
.theme-dark .demo-shell .btn-outline-teal,
.theme-dark .demo-shell .btn-outline-info,
.theme-dark .demo-shell .btn-outline-success,
.theme-dark .demo-shell .btn-outline-warning,
.theme-dark .demo-shell .btn-outline-danger {
  color: #dfe4f4;
  border-color: #3a425a;
}
