/* Life OS · Health Tab Styles
   Biometrics, Heart Rate Zones, Workout History & Trends (Synced from Health Connect) */

.health-master-card {
  margin-bottom: 20px;
  gap: 16px;
}

/* 1. Topbar & Horizon Switcher (Aligned with Planner) */
.health-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.health-topbar::-webkit-scrollbar {
  display: none;
}

.health-sync-indicator-group,
.btn-health-sync-action,
#btn-health-sync-modal {
  display: none !important;
}

.btn-health-sync-action:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: #16a34a;
  transform: translateY(-1px);
}

.health-pulse-dot {
  width: 7px;
  height: 7px;
  background-color: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: healthPulse 2s infinite;
}

@keyframes healthPulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  }
  70% {
    transform: scale(1.1);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

/* 2. Key Metrics Summary Grid */
.health-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.health-metric-card {
  background: var(--bg-card-elevated, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 10px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.health-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.health-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.health-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.health-metric-icon {
  font-size: 1.1rem;
}

.health-metric-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
  font-family: var(--font-mono, monospace);
  line-height: 1.2;
}

.health-metric-sub {
  font-size: 0.72rem;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 4px;
}

.health-delta-badge {
  font-size: 0.70rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.health-delta-badge.positive {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.health-delta-badge.neutral {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-secondary, #94a3b8);
}

.health-delta-badge.alert {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* 3. Section Containers */
.health-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg, 12px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.health-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.health-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.health-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.health-section-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.health-view-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card-elevated, rgba(255, 255, 255, 0.05));
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

.health-view-pill {
  background: transparent;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.health-view-pill.active {
  background: var(--accent-indigo, #6366f1);
  color: #ffffff;
}

/* 4. Detailed Charts Canvas & Visuals */
.health-chart-wrapper {
  width: 100%;
  min-height: 220px;
  position: relative;
  background: var(--bg-card-elevated, rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md, 8px);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.health-chart-svg {
  width: 100%;
  height: 210px;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--border-subtle);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.chart-axis-label {
  font-size: 10px;
  fill: var(--text-muted);
  font-family: var(--font-mono, monospace);
}

.chart-tooltip-box {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -100%);
  transition: opacity 0.1s ease;
  display: none;
}

.health-chart-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-secondary);
  padding-top: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* 5. Heart Rate Zones (5-Zone Stacked Visualizer) */
.hr-zones-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hr-zones-stacked-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hr-zones-stacked-bar {
  display: flex;
  height: 22px;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
  background: rgba(148, 163, 184, 0.1);
}

.hr-zone-segment {
  height: 100%;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
}

.hr-zone-segment:hover {
  filter: brightness(1.15);
}

.hr-zones-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.hr-zone-card {
  border: 1px solid var(--border-subtle);
  border-left-width: 4px;
  border-radius: var(--radius-md, 8px);
  padding: 10px 12px;
  background: var(--bg-card-elevated, rgba(255, 255, 255, 0.02));
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease;
}

.hr-zone-card:hover {
  transform: translateY(-1px);
}

.hr-zone-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hr-zone-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hr-zone-bpm-pill {
  font-size: 0.70rem;
  font-family: var(--font-mono, monospace);
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  color: var(--text-secondary);
}

.hr-zone-time-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.hr-zone-time-val {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--text-primary);
}

.hr-zone-pct-val {
  font-size: 0.8rem;
  font-weight: 600;
}

.hr-zone-desc-text {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.35;
}

