/* ──────────────────────────────────────────
   Microsoft Service Health Tracker
   Accent: #EA580C (burnt orange)
   Namespace: .shealth-*
   Status: green #22C55E / yellow #EAB308 / red #EF4444
   ────────────────────────────────────────── */

:root {
  --sh-accent: #EA580C;
  --sh-accent-dim: rgba(249, 115, 22, 0.15);
  --sh-accent-hover: #FB923C;
  --sh-bg: #141118;
  --sh-card: #1e1b24;
  --sh-card-hover: #252230;
  --sh-border: #2a2733;
  --sh-text: #e0dce6;
  --sh-text-dim: #9e98a8;
  --sh-green: #22C55E;
  --sh-yellow: #EAB308;
  --sh-red: #EF4444;
  --sh-orange: #EA580C;
}

/* ── Container ── */
.shealth-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

/* ── Tabs ── */
.shealth-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.shealth-tabs::-webkit-scrollbar { display: none; }
.shealth-tab {
  background: none;
  border: 1px solid transparent;
  color: var(--sh-text-dim);
  font-family: var(--font-heading, 'Inter', sans-serif);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 14px;
  transition: all 0.2s ease;
  flex: 1;
  text-align: center;
}
.shealth-tab:hover {
  color: var(--sh-text);
  background: rgba(255, 255, 255, 0.06);
}
.shealth-tab.active {
  color: #000;
  background: var(--sh-accent);
  border-color: var(--sh-accent);
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.3);
}
.shealth-tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.3em; height: 1.3em; padding: 0 0.35em; margin-left: 0.4em;
  border-radius: 10px; font-size: 0.72rem; font-weight: 800;
  background: #EF4444; color: #fff; line-height: 1;
}
.shealth-panel { display: none; }
.shealth-panel.active { display: block; }

/* ── Summary Banner ── */
.shealth-summary {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 16px;
  font-size: 0.82rem;
  color: var(--sh-text-dim);
}
.shealth-summary-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.shealth-summary-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--sh-text);
}
.shealth-summary-value.shealth-red { color: var(--sh-red); }
.shealth-summary-value.shealth-green { color: var(--sh-green); }
.shealth-summary-value.shealth-accent { color: var(--sh-accent); }

.shealth-all-ok {
  text-align: center;
  padding: 0.8rem;
  color: var(--sh-green);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ── Grid Header ── */
.shealth-grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}
.shealth-grid-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.shealth-grid-hint {
  font-size: 0.7rem;
  color: var(--sh-text-dim);
  opacity: 0.6;
}

/* ── Section Headers ── */
.shealth-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.2rem 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sh-text);
}
.shealth-section-active { color: var(--sh-red); }
.shealth-active-count {
  font-size: 0.75rem;
  background: var(--sh-red);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 16px;
  font-weight: 700;
}

/* ── Active Incidents Section ── */
.shealth-active-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.shealth-active-list .shealth-incident {
  border-left: 3px solid var(--sh-red);
  background: rgba(239, 68, 68, 0.04);
}

/* ── Clear Filters Button ── */
.shealth-clear-btn {
  background: none;
  border: 1px solid var(--sh-border);
  color: var(--sh-text-dim);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
}
.shealth-clear-btn:hover {
  border-color: var(--sh-accent);
  color: var(--sh-accent);
}

/* ── Month Dividers ── */
.shealth-month-divider {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.shealth-month-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--sh-border);
}

/* ── Status Grid ── */
.shealth-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.shealth-svc-card {
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 16px;
  padding: 0.65rem 0.6rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.15s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.shealth-svc-card:hover {
  border-color: var(--sh-accent);
  transform: translateY(-1px);
}
.shealth-svc-card[data-severity="0"] { border-left: 3px solid var(--sh-green); }
.shealth-svc-card[data-severity="1"] { border-left: 3px solid var(--sh-yellow); }
.shealth-svc-card[data-severity="2"] { border-left: 3px solid var(--sh-orange); }
.shealth-svc-card[data-severity="3"] { border-left: 3px solid var(--sh-red); }

.shealth-svc-icon { font-size: 1.3rem; margin-bottom: 0.2rem; }
.shealth-svc-name { font-size: 0.72rem; color: var(--sh-text); font-weight: 500; line-height: 1.2; }
.shealth-svc-status {
  font-size: 0.65rem;
  margin-top: 0.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.shealth-svc-status[data-severity="0"] { color: var(--sh-green); }
.shealth-svc-status[data-severity="1"] { color: var(--sh-yellow); }
.shealth-svc-status[data-severity="2"] { color: var(--sh-orange); }
.shealth-svc-status[data-severity="3"] { color: var(--sh-red); }

/* ── Controls ── */
.shealth-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.shealth-search {
  flex: 2;
  min-width: 200px;
  padding: 0.6rem 1rem;
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 14px;
  color: var(--sh-text);
  font-size: 0.9rem;
}
.shealth-search:focus {
  outline: none;
  border-color: var(--sh-accent);
  box-shadow: 0 0 0 2px var(--sh-accent-dim);
}
.shealth-search::placeholder { color: var(--sh-text-dim); }

.shealth-select {
  flex: 1;
  min-width: 130px;
  padding: 0.6rem 0.75rem;
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 14px;
  color: var(--sh-text);
  font-size: 0.84rem;
  cursor: pointer;
}
.shealth-select:focus { outline: none; border-color: var(--sh-accent); }

/* ── Meta line ── */
.shealth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  font-size: 0.78rem;
  color: var(--sh-text-dim);
  flex-wrap: wrap;
  gap: 0.5rem;
}
.shealth-meta-count { font-weight: 600; color: var(--sh-text); }

/* ── Timeline / Incident Cards ── */
.shealth-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shealth-incident {
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  transition: border-color 0.2s;
  cursor: pointer;
}
.shealth-incident:hover { border-color: var(--sh-accent); }
.shealth-incident[data-active="true"] { border-left: 3px solid var(--sh-red); }

.shealth-incident-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.shealth-incident-left { flex: 1; min-width: 0; }

.shealth-incident-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sh-text);
  margin: 0 0 0.3rem;
  line-height: 1.3;
}

.shealth-incident-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.75rem;
  color: var(--sh-text-dim);
}

.shealth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  white-space: nowrap;
}
.shealth-badge-service {
  background: rgba(249, 115, 22, 0.12);
  color: var(--sh-accent);
  border: 1px solid rgba(249, 115, 22, 0.25);
}
.shealth-badge-status {
  border: 1px solid var(--sh-border);
}

.shealth-incident-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  flex-shrink: 0;
}

.shealth-incident-time {
  font-size: 0.72rem;
  color: var(--sh-text-dim);
  white-space: nowrap;
}
.shealth-incident-duration {
  font-size: 0.68rem;
  color: var(--sh-accent);
  font-weight: 600;
}

.shealth-incident-impact {
  font-size: 0.78rem;
  color: var(--sh-text-dim);
  margin-top: 0.4rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Load More ── */
.shealth-load-more { text-align: center; margin-top: 1rem; }
.shealth-load-btn {
  padding: 0.6rem 2rem;
  background: transparent;
  border: 1px solid var(--sh-accent);
  color: var(--sh-accent);
  border-radius: 14px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.shealth-load-btn:hover { background: var(--sh-accent); color: #000; }

/* ── Footer ── */
.shealth-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--sh-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.shealth-footer-links { display: flex; gap: 1rem; }
.shealth-footer-links a {
  color: var(--sh-text-dim);
  text-decoration: none;
  font-size: 0.8rem;
}
.shealth-footer-links a:hover { color: var(--sh-accent); }
.shealth-freshness { font-size: 0.75rem; color: var(--sh-text-dim); }

/* ── Modal ── */
.shealth-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  overflow-y: auto;
  padding: 2rem 1rem;
}
.shealth-modal-overlay.active { display: flex; justify-content: center; align-items: flex-start; }

.shealth-modal {
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 14px;
  max-width: 700px;
  width: 100%;
  padding: 1.5rem;
  position: relative;
  margin-top: 2rem;
}
.shealth-modal-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: none;
  border: none;
  color: var(--sh-text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.shealth-modal-close:hover { background: var(--sh-card-hover); color: var(--sh-text); }

.shealth-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--sh-text);
  margin: 0 0 0.5rem;
  padding-right: 2rem;
}
.shealth-modal-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--sh-text-dim);
}
.shealth-modal-impact {
  font-size: 0.85rem;
  color: var(--sh-text);
  line-height: 1.5;
  margin-bottom: 1.2rem;
  padding: 0.75rem;
  background: rgba(249, 115, 22, 0.06);
  border-radius: 14px;
  border-left: 3px solid var(--sh-accent);
}

/* Modal update timeline */
.shealth-updates-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sh-accent);
  margin-bottom: 0.6rem;
}
.shealth-update {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--sh-border);
  font-size: 0.8rem;
  color: var(--sh-text);
  line-height: 1.5;
}
.shealth-update:last-child { border-bottom: none; }
.shealth-update-time {
  font-size: 0.72rem;
  color: var(--sh-accent);
  font-weight: 600;
  margin-bottom: 0.2rem;
}
.shealth-update-content { color: var(--sh-text-dim); }

/* ── Skeleton ── */
.shealth-skeleton { display: flex; flex-direction: column; gap: 0.5rem; }
.shealth-skeleton-row {
  height: 60px;
  background: linear-gradient(90deg, var(--sh-card) 25%, var(--sh-card-hover) 50%, var(--sh-card) 75%);
  background-size: 200% 100%;
  animation: shealth-shimmer 1.5s infinite;
  border-radius: 16px;
}
@keyframes shealth-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Analytics Section ── */
.shealth-analytics { margin-bottom: 0.5rem; }

/* Trend Chart */
.shealth-trend {
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.shealth-trend-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-text-dim);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.shealth-trend-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 80px;
}
.shealth-trend-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
  justify-content: flex-end;
}
.shealth-trend-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: var(--sh-accent);
  min-height: 2px;
  transition: height 0.4s ease;
  position: relative;
}
.shealth-trend-bar:hover { opacity: 0.8; }
.shealth-trend-bar-val {
  font-size: 0.65rem;
  color: var(--sh-text);
  font-weight: 600;
}
.shealth-trend-bar-label {
  font-size: 0.6rem;
  color: var(--sh-text-dim);
  white-space: nowrap;
}

/* Insights Grid */
.shealth-insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

/* Most Affected Widget */
.shealth-most-affected {
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 16px;
  padding: 1rem;
}
.shealth-ma-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-text-dim);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.shealth-ma-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.8rem;
}
.shealth-ma-rank {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}
.shealth-ma-rank.shealth-r1 { background: var(--sh-red); color: #fff; }
.shealth-ma-rank.shealth-r2 { background: var(--sh-orange); color: #fff; }
.shealth-ma-rank.shealth-r3 { background: var(--sh-yellow); color: #000; }
.shealth-ma-rank.shealth-r4,.shealth-ma-rank.shealth-r5 { background: var(--sh-border); color: var(--sh-text-dim); }
.shealth-ma-name { flex: 1; color: var(--sh-text); }
.shealth-ma-count { font-weight: 700; color: var(--sh-accent); }
.shealth-ma-bar-track {
  width: 60px;
  height: 5px;
  background: var(--sh-border);
  border-radius: 3px;
  overflow: hidden;
}
.shealth-ma-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--sh-accent);
  transition: width 0.5s ease;
}

/* Scorecard */
.shealth-scorecard {
  background: var(--sh-card);
  border: 1px solid var(--sh-border);
  border-radius: 16px;
  padding: 1rem;
}
.shealth-sc-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--sh-text-dim);
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.shealth-sc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--sh-border);
}
.shealth-sc-item:last-child { border-bottom: none; }
.shealth-sc-label { color: var(--sh-text-dim); }
.shealth-sc-value { font-weight: 700; color: var(--sh-text); }

/* Date Lookup */
.shealth-date-lookup {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}
.shealth-date-lookup input[type="date"] {
  flex: 1;
  min-width: 140px;
}
.shealth-date-result {
  margin-bottom: 1rem;
}
.shealth-date-result-msg {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.85rem;
  line-height: 1.5;
}
.shealth-date-result-ok {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: var(--sh-green);
}
.shealth-date-result-bad {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--sh-text);
}

/* Duration Bar */
.shealth-duration-bar {
  height: 4px;
  background: var(--sh-border);
  border-radius: 2px;
  margin-top: 0.4rem;
  overflow: hidden;
}
.shealth-duration-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .shealth-status-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 0.4rem; }
  .shealth-svc-card { padding: 0.5rem 0.4rem; }
  .shealth-svc-icon { font-size: 1.1rem; }
  .shealth-svc-name { font-size: 0.65rem; }
  .shealth-incident-header { flex-direction: column; }
  .shealth-incident-right { flex-direction: row; align-items: center; gap: 0.5rem; }
  .shealth-controls { flex-direction: column; }
  .shealth-select { min-width: unset; }
  .shealth-insights-grid { grid-template-columns: 1fr; }
  .shealth-date-lookup { flex-direction: column; }
}

@media (max-width: 480px) {
  .shealth-status-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); }
  .shealth-modal { padding: 1rem; margin-top: 1rem; }
  .shealth-trend-bars { gap: 2px; }
}
