/* blood-pressure-calculator — BP gauge, classification badges, context panels */

/* ===== CHIP ROWS ===== */
.bp-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ===== SEMICIRCULAR BP GAUGE ===== */
.bp-gauge-wrap {
  position: relative;
  width: 280px;
  height: 155px;
  margin: 1.5rem auto 1rem;
}
.bp-gauge-outer {
  position: relative;
  width: 280px;
  height: 140px;
  border-radius: 140px 140px 0 0;
  overflow: hidden;
}
.bp-gauge-bg {
  position: absolute;
  width: 100%;
  height: 200%;
  border-radius: 50%;
  background: conic-gradient(
    from 180deg,
    #22c55e 0deg 36deg,
    #eab308 36deg 54deg,
    #f97316 54deg 72deg,
    #ef4444 72deg 144deg,
    #991b1b 144deg 180deg
  );
}
.bp-gauge-inner {
  position: absolute;
  width: 180px;
  height: 180px;
  background: var(--bs-body-bg, #fff);
  border-radius: 50%;
  top: 50px;
  left: 50px;
  z-index: 1;
}
[data-bs-theme="dark"] .bp-gauge-inner {
  background: var(--evvy-gray-100, #1e1e1e);
}
.bp-gauge-needle {
  position: absolute;
  width: 4px;
  height: 100px;
  bottom: 0;
  left: 50%;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-90deg);
  z-index: 2;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.bp-gauge-needle::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 55px solid var(--evvy-text-primary, #333);
}
.bp-gauge-needle::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--evvy-text-primary, #333);
}
[data-bs-theme="dark"] .bp-gauge-needle::before {
  border-bottom-color: #e0e0e0;
}
[data-bs-theme="dark"] .bp-gauge-needle::after {
  background: #e0e0e0;
}
.bp-gauge-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--evvy-text-secondary, #666);
  margin-top: 4px;
  padding: 0 0.25rem;
}
.bp-gauge-center-label {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 3;
}
.bp-gauge-center-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--evvy-text-primary, #333);
  line-height: 1.1;
}
.bp-gauge-center-unit {
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--evvy-text-secondary, #666);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===== CLASSIFICATION BADGES ===== */
.bp-badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  border-radius: var(--bs-border-radius-pill, 50rem);
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  white-space: nowrap;
}
.bp-badge-normal    { background: #22c55e; }
.bp-badge-elevated  { background: #eab308; color: #1a1a1a; }
.bp-badge-stage1    { background: #f97316; }
.bp-badge-stage2    { background: #ef4444; }
.bp-badge-crisis    { background: #991b1b; }

/* ===== CONTEXT PANEL ===== */
.bp-context-panel {
  background: color-mix(in srgb, var(--cluster-dark) 6%, transparent);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 0.875rem 1rem;
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--evvy-text-secondary, #666);
  line-height: 1.55;
}
.bp-context-panel strong {
  color: var(--evvy-text-primary, #333);
}
[data-bs-theme="dark"] .bp-context-panel {
  background: color-mix(in srgb, var(--cluster-dark) 12%, transparent);
}

/* ===== CRISIS ALERT ===== */
.bp-crisis-alert {
  background: #fef2f2;
  border: 2px solid #ef4444;
  border-radius: var(--evvy-radius-lg, 12px);
  padding: 1rem 1.125rem;
  margin-top: 1rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  display: none;
}
.bp-crisis-alert.visible {
  display: block;
}
.bp-crisis-alert strong {
  color: #991b1b;
}
.bp-crisis-alert .bp-crisis-icon {
  font-size: 1.25rem;
  color: #ef4444;
  margin-right: 0.375rem;
  vertical-align: -2px;
}
[data-bs-theme="dark"] .bp-crisis-alert {
  background: color-mix(in srgb, #ef4444 10%, var(--evvy-gray-100, #1e1e1e));
  border-color: #b91c1c;
}
[data-bs-theme="dark"] .bp-crisis-alert strong {
  color: #fca5a5;
}

/* ===== METRIC CARDS (pulse pressure / MAP) ===== */
.bp-metrics-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.bp-metric-flag {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: var(--bs-border-radius-pill, 50rem);
  font-size: 0.6875rem;
  font-weight: 600;
  margin-left: 0.375rem;
  vertical-align: middle;
}
.bp-metric-flag-normal { background: #dcfce7; color: #166534; }
.bp-metric-flag-warn   { background: #fef9c3; color: #854d0e; }
.bp-metric-flag-danger { background: #fee2e2; color: #991b1b; }
[data-bs-theme="dark"] .bp-metric-flag-normal { background: #166534; color: #dcfce7; }
[data-bs-theme="dark"] .bp-metric-flag-warn   { background: #854d0e; color: #fef9c3; }
[data-bs-theme="dark"] .bp-metric-flag-danger { background: #991b1b; color: #fee2e2; }

/* ===== POSITION/TIME CONTEXT ===== */
.bp-note {
  font-size: 0.75rem;
  color: var(--evvy-text-secondary, #666);
  margin-top: 0.5rem;
  font-style: italic;
  line-height: 1.5;
}

/* ===== PREMIUM: READING LOG TABLE ===== */
.bp-log-table {
  width: 100%;
  font-size: 0.8125rem;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0.75rem;
}
.bp-log-table th {
  background: color-mix(in srgb, var(--cluster-dark) 8%, transparent);
  padding: 0.5rem 0.625rem;
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--evvy-text-secondary, #666);
  border-bottom: 1px solid var(--evvy-border-color, #DEE2E6);
  text-align: left;
}
.bp-log-table th:first-child { border-radius: 8px 0 0 0; }
.bp-log-table th:last-child  { border-radius: 0 8px 0 0; }
.bp-log-table td {
  padding: 0.5rem 0.625rem;
  border-bottom: 1px solid var(--evvy-border-color, #DEE2E6);
  color: var(--evvy-text-primary, #333);
  vertical-align: middle;
}
.bp-log-table .bp-log-delete {
  cursor: pointer;
  color: var(--evvy-text-secondary, #666);
  opacity: 0.6;
  transition: opacity 0.2s;
}
.bp-log-table .bp-log-delete:hover {
  opacity: 1;
  color: #ef4444;
}
[data-bs-theme="dark"] .bp-log-table th {
  background: color-mix(in srgb, var(--cluster-dark) 14%, transparent);
}

/* ===== PREMIUM: TREND CHART ===== */
.bp-chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  margin-top: 1rem;
  background: var(--bs-body-bg, #fff);
  border: 1px solid var(--evvy-border-color, #DEE2E6);
  border-radius: var(--evvy-radius-lg, 12px);
  overflow: hidden;
}
[data-bs-theme="dark"] .bp-chart-wrap {
  background: var(--evvy-gray-100, #1e1e1e);
}
.bp-chart-canvas {
  width: 100%;
  height: 100%;
}

/* ===== PREMIUM: AVERAGES CARDS ===== */
.bp-avg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

/* ===== MOBILE ===== */
@media (max-width: 575.98px) {
  .bp-gauge-wrap {
    width: 240px;
    height: 135px;
  }
  .bp-gauge-outer {
    width: 240px;
    height: 120px;
    border-radius: 120px 120px 0 0;
  }
  .bp-gauge-inner {
    width: 150px;
    height: 150px;
    top: 45px;
    left: 45px;
  }
  .bp-gauge-needle {
    height: 85px;
  }
  .bp-gauge-center-value {
    font-size: 1rem;
  }
  .bp-metrics-row {
    grid-template-columns: 1fr;
  }
  .bp-avg-grid {
    grid-template-columns: 1fr;
  }
  .bp-chip-group {
    gap: 0.375rem;
  }
}
