/* ================= CSS VARIABLES ================= */
:root {
  /* Colors - Microsoft Design Language */
  --color-brand-primary: #0078D4;
  --color-brand-hover: #106EBE;
  --color-brand-active: #005A9E;
  --color-link: #0F6CBD;
  
  --color-neutral-50: #FAFAFA;
  --color-neutral-100: #F9FAFB;
  --color-neutral-150: #F4F5F7;
  --color-neutral-200: #F3F2F1;
  --color-neutral-300: #EDEBE9;
  --color-neutral-400: #E1DFDD;
  --color-neutral-500: #DFE1E6;
  --color-neutral-600: #8A8886;
  --color-neutral-700: #605E5C;
  --color-neutral-800: #323130;
  --color-neutral-900: #242424;
  
  --color-status-operational: #006644;
  --color-status-degraded: #FFAB00;
  --color-status-partial: #FF8B00;
  --color-status-major: #DE350B;
  --color-status-maintenance: #0052CC;
  
  --color-accent-blue: #0052CC;
  --color-accent-light-blue: #DEECF9;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 40px;
  
  /* Typography */
  --font-family: "Segoe UI", Arial, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 13px;
  --font-size-md: 14px;
  --font-size-lg: 18px;
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Border & Shadows */
  --border-radius-sm: 2px;
  --border-radius-md: 4px;
  --border-radius-lg: 8px;
  --border-radius-xl: 16px;
  --border-radius-full: 999px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.15);
  --shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ================= GLOBAL RESET ================= */
body {
  font-family: var(--font-family);
  background-color: var(--color-neutral-200);
  color: var(--color-neutral-800);
}

.powered-by a,
.page-status,
.scheduled-maintenances-container > h2.font-largest {
  display: none !important;
}

/* ================= HEADER ================= */
.hls-header {
  background: #fff;
  border-bottom: 1px solid var(--color-neutral-400);
  padding: var(--space-md) var(--space-2xl);
}

.hls-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ms-logo {
  height: var(--space-2xl);
  margin-right: var(--space-md);
}

.hls-title {
  display: flex;
  flex-direction: column;
}

.hls-product {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
}

.hls-sub {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

.hls-subscribe {
  margin-left: auto;
}

/* ================= LAYOUT ================= */
.layout-content {
  max-width: 1200px;
  margin: auto;
  padding: var(--space-2xl);
}

/* ================= BUTTONS ================= */
#show-updates-dropdown,
.subscribe-button,
a.button.subscribe-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  
  background-color: #4F5BD5 !important;
  color: #fff !important;
  
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  
  padding: 10px var(--space-lg);
  border: none;
  border-radius: 6px;
  
  box-shadow: var(--shadow-md);
  transition: all 0.15s ease;
  cursor: pointer;
}

#show-updates-dropdown:hover,
.subscribe-button:hover,
a.button.subscribe-button:hover {
  background-color: #3F4ACB !important;
  box-shadow: var(--shadow-hover);
}

#show-updates-dropdown:active,
.subscribe-button:active {
  background-color: #373FB0 !important;
  box-shadow: var(--shadow-inset);
}

/* ================= TABS ================= */
#component-tabs {
  display: flex;
  justify-content: flex-start;
  gap: var(--space-2xl);
  padding: 0 var(--space-xs);
  margin: var(--space-xl) 0 10px 0;
  border-bottom: 1px solid #e6e6e6;
  position: relative;
  z-index: 10;
}

#product-bar {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  padding: 10px 0 6px 0;
  margin-bottom: 6px;
}

.product-tab {
  padding: 6px 10px;
  border: 1px solid var(--color-neutral-400);
  border-radius: var(--border-radius-xl);
  background: #fff;
  font-size: var(--font-size-base);
  color: var(--color-neutral-800);
  cursor: pointer;
  transition: all 0.2s ease;
}

.product-tab.active {
  background: var(--color-accent-blue);
  border-color: var(--color-accent-blue);
  color: #fff;
}

/* ================= REGION NAVIGATION ================= */
#region-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  
  background: var(--color-neutral-150);
  border-bottom: 4px solid var(--color-accent-blue);
  margin: 10px 0 0 0;
}

.region-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-md);
  color: #253858;
  
  border-right: 1px solid var(--color-neutral-500);
  background: #EBECF0;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s ease;
}

.region-tab:hover {
  background: var(--color-neutral-500);
}

.region-tab.active {
  background: var(--color-accent-blue);
  color: #fff;
  font-weight: var(--font-weight-semibold);
}

.region-tab.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
  filter: grayscale(1);
}

#region-subheader {
  white-space: nowrap;
  overflow-x: auto;
  background: var(--color-neutral-150);
  border-bottom: 1px solid var(--color-neutral-500);
  padding: var(--space-sm) 10px;
}

.sub-region {
  display: inline-block;
  padding: 0 var(--space-md);
  font-size: var(--font-size-sm);
}

/* ================= STATUS CARDS ================= */
.component-container {
  background: #fff;
  border: 1px solid var(--color-neutral-400);
  border-radius: var(--border-radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.component-status.operational {
  color: var(--color-status-operational);
}

.component-status.degraded {
  color: var(--color-status-degraded);
}

.component-status.partial_outage,
.component-status.major_outage {
  color: var(--color-status-major);
}

/* ================= INCIDENTS & MAINTENANCE (Shared Styles) ================= */
.incident,
.unresolved-incident,
.scheduled-maintenance {
  background: #fff !important;
  border: 1px solid #e1e1e1 !important;
  border-radius: var(--border-radius-lg) !important;
  box-shadow: var(--shadow-sm) !important;
  margin: var(--space-md) 0 var(--space-lg) 0 !important;
  overflow: hidden !important;
}

.incident-title,
.scheduled-maintenance .incident-title {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: var(--space-md) var(--space-lg) !important;
  background: var(--color-neutral-50) !important;
  border-bottom: 1px solid #e1e1e1 !important;
  position: relative !important;
}

/* Left accent bar */
.incident-title::before,
.scheduled-maintenance .incident-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--color-link);
}

.incident-title a,
.scheduled-maintenance .incident-title a.color-primary {
  font-size: var(--font-size-md) !important;
  font-weight: var(--font-weight-semibold) !important;
  color: var(--color-link) !important;
  text-decoration: none !important;
}

.incident-title .label {
  font-size: var(--font-size-xs) !important;
  font-weight: var(--font-weight-semibold) !important;
  padding: 2px var(--space-sm) !important;
  border-radius: var(--space-md) !important;
  background: var(--color-accent-light-blue) !important;
  color: var(--color-brand-active) !important;
}

.scheduled-maintenance .incident-title a.color-primary {
  flex: 1 1 auto;
}

.scheduled-maintenance .incident-title small.pull-right {
  float: none !important;
  margin-left: auto !important;
  white-space: nowrap;
  line-height: 1;
  position: relative;
  top: -1px;
}

.updates-container,
.scheduled-maintenance .updates-container {
  padding: var(--space-md) var(--space-lg) !important;
}

.update,
.scheduled-maintenance .update {
  font-size: var(--font-size-base) !important;
  color: var(--color-neutral-700) !important;
  line-height: 1.5 !important;
  margin-bottom: var(--space-md) !important;
}

.scheduled-maintenance .update {
  font-size: var(--font-size-md) !important;
  color: var(--color-neutral-900) !important;
}

.update small {
  display: block !important;
  margin-top: 6px !important;
  font-size: var(--font-size-sm) !important;
  color: var(--color-neutral-600) !important;
}

.incidents-container,
.unresolved-incidents {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.scheduled-maintenances-container {
  margin-top: var(--space-md) !important;
  padding: 0 !important;
  font-family: var(--font-family);
  color: var(--color-neutral-900);
}

/* ================= IMPACTED COMPONENTS FOOTER ================= */
.hls-impacted-components {
  margin: 10px var(--space-lg) var(--space-lg) var(--space-lg);
  padding: 10px var(--space-md);
  border: 1px solid #e1e1e1;
  border-radius: var(--border-radius-lg);
  background: #fff;
  color: var(--color-neutral-700);
  font-size: 12.5px;
  line-height: 1.4;
}

.hls-impacted-components[data-state="empty"] {
  display: none;
}

.hls-impacted-components[data-state="loading"] {
  color: var(--color-neutral-600);
  font-style: italic;
}

.hls-impacted-title {
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  color: #201F1E;
  margin: var(--space-md) 0 var(--space-sm) 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-neutral-300);
}

.hls-impacted-subregion {
  display: inline-block;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  padding: 3px var(--space-sm);
  border-radius: var(--border-radius-full);
  background-color: var(--color-neutral-200);
  color: var(--color-neutral-800);
  border: 1px solid var(--color-neutral-400);
  white-space: nowrap;
}

/* ================= MATRIX ================= */
#hls-matrix-wrap {
  margin: var(--space-md) 0;
}

#hls-matrix-scroll {
  overflow-x: auto;
  border-top: 4px solid var(--color-accent-blue);
  background: #fff;
}

#hls-matrix {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-base);
}

#hls-matrix th,
#hls-matrix td {
  padding: 10px var(--space-md);
  border-bottom: 1px solid #EBECF0;
  white-space: nowrap;
}

#hls-matrix thead th {
  background: var(--color-neutral-150);
  font-weight: var(--font-weight-semibold);
  text-align: left;
  border-bottom: 1px solid var(--color-neutral-500);
}

#hls-matrix td.svc {
  min-width: 260px;
  font-weight: var(--font-weight-medium);
}

/* ================= MATRIX HIERARCHY ================= */
/* Parent row */
#hls-matrix tr.svc-group td {
  background: var(--color-neutral-100);
  border-bottom: 1px solid var(--color-neutral-500);
}

#hls-matrix tr.svc-group td.svc.group {
  position: relative !important;
  padding-left: 44px !important;
  white-space: nowrap;
  font-weight: var(--font-weight-semibold);
  color: #172B4D;
}

#hls-matrix tr.svc-group td.svc.group::before {
  content: "▾";
  position: absolute;
  left: var(--space-md);
}

#hls-matrix tr.svc-group.is-collapsed td.svc.group::before {
  content: "▸";
}

#hls-matrix tr.svc-group {
  border-top: var(--space-sm) solid #fff;
}

/* Child rows */
#hls-matrix tr.svc-sub td {
  background: #fff;
}

#hls-matrix tr.svc-sub td.svc {
  padding-left: var(--space-3xl) !important;
  font-weight: var(--font-weight-normal);
  color: #42526E;
  position: relative;
}

#hls-matrix tr.svc-sub td.svc::before {
  content: "";
  position: absolute;
  left: var(--space-2xl);
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--color-neutral-500);
}

#hls-matrix tr.svc-sub.is-hidden {
  display: none;
}

/* Hover effects */
#hls-matrix tr.svc-sub:hover td {
  background: var(--color-neutral-150);
}

#hls-matrix tr.svc-group:hover td {
  background: #F1F2F4;
}

/* ================= MATRIX STATUS CELLS ================= */
#hls-matrix td.svc-cell {
  text-align: left;
  vertical-align: middle;
  position: relative;
}

#hls-matrix td:not(:first-child) {
  padding-left: var(--space-xl) !important;
}

#hls-matrix td:not(:first-child) i,
#hls-matrix td:not(:first-child) .fa {
  margin-left: 5px !important;
}

#hls-matrix td.svc-cell::before {
  font-family: FontAwesome;
  font-size: var(--font-size-md);
  line-height: 1;
  display: inline-block;
}

#hls-matrix td.svc-cell[data-status="operational"]::before {
  content: "\f00c"; /* fa-check */
  color: var(--color-status-operational);
}

#hls-matrix td.svc-cell[data-status="degraded_performance"]::before {
  content: "\f146"; /* fa-minus-square */
  color: var(--color-status-degraded);
}

#hls-matrix td.svc-cell[data-status="partial_outage"]::before {
  content: "\f071"; /* fa-exclamation-triangle */
  color: var(--color-status-partial);
}

#hls-matrix td.svc-cell[data-status="major_outage"]::before {
  content: "\f00d"; /* fa-times */
  color: var(--color-status-major);
}

#hls-matrix td.svc-cell[data-status="under_maintenance"]::before {
  content: "\f0ad"; /* fa-wrench */
  color: var(--color-status-maintenance);
}

/* ================= LEGEND ================= */
#hls-legend.component-statuses-legend,
.component-statuses-legend {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-3xl);
  white-space: nowrap;
}

.component-statuses-legend .breaker {
  display: none !important;
}

.component-statuses-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Legend color utilities */
.hls-green {
  color: var(--color-status-operational);
}

.hls-yellow {
  color: var(--color-status-degraded);
}

.hls-orange {
  color: var(--color-status-partial);
}

.hls-red {
  color: var(--color-status-major);
}

.hls-blue {
  color: var(--color-status-maintenance);
}

/* ================= FOOTER ================= */
.custom-footer {
  margin-top: var(--space-3xl);
  padding: var(--space-xl) 0;
  border-top: 1px solid #e1e1e1;
  font-size: var(--font-size-sm);
  color: #616161;
  text-align: center;
}

.custom-footer a {
  color: #0067B8;
  margin: 0 10px;
  text-decoration: none;
  transition: text-decoration 0.2s ease;
}

.custom-footer a:hover {
  text-decoration: underline;
}

.custom-footer-logo {
  font-weight: var(--font-weight-semibold);
  color: #000;
  margin-bottom: 6px;
}