/* ===========================================================
   Workshare Performance module
   Palette sourced from RH_Workshare_NEW.pbix spec
   =========================================================== */

:root {
  --ws-navy:       #1A5B77;  /* spec: 3 uses — deep teal-navy */
  --ws-slate:      #415671;  /* spec: 6 uses — primary slate blue */
  --ws-blue:       #118DFF;  /* spec: 7 uses — brand blue */
  --ws-teal:       #007EAC;  /* spec: 2 uses — mid teal */
  --ws-red:        #EE6B6E;  /* spec: 6 uses — negative / alert */
  --ws-red-soft:   #fca5a5;
  --ws-green:      #6FC276;  /* spec: 12 uses — positive / on-target */
  --ws-green-soft: #C8EFC9;
  --ws-green-dark: #34B233;  /* spec: 3 uses — deeper positive */
  --ws-bg:         #EFF4F9;  /* spec page background wash */
  --ws-surface:    #E4E7EC;  /* spec: 17 uses — neutral surface */
  --ws-table-head: #415671;  /* slate for table headers */
}

/* ---- Landing page ---- */
.workshare-landing-body {
  margin: 0;
  background: #0a1d34;
  min-height: 100vh;
  color: #fff;
}

/* Landing page: keep the loading spinner but drop the page dim so the
   full-bleed hero shows through while data loads. */
.workshare-landing-body #rhLoadingOverlay { background: transparent; }

.workshare-landing-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
}

/* WS-2: show the shared Reporting Hub landing image (as on every other landing)
   under a translucent brand tint so the white hero text stays readable. */
.workshare-landing-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(15, 42, 68, 0.82), rgba(28, 75, 124, 0.62) 40%, rgba(15, 42, 68, 0.7) 85%),
    url("../Image/Reporting_hub_background.png") center center / cover no-repeat;
  filter: saturate(1.05);
  z-index: 0;
}

.workshare-landing-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 44px 48px 44px;
}

.workshare-kbr-logo {
  position: absolute;
  top: 26px;
  right: 44px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.workshare-landing-top {
  margin-top: 14vh;
}

.workshare-landing-controls {
  display: flex;
  gap: 22px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.workshare-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.workshare-control label {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.2px;
}

/* Portfolio picker is the shared SearchableSelect combobox (.ss-combo, styles
   injected by js/components/searchable-select.js). The native <select> below is
   hidden by the component; these rules only apply before enhancement. */
.workshare-control select {
  min-width: 220px;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid var(--kbr-border);
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}

.workshare-landing-nav {
  margin-top: 28px;
}

.workshare-nav-link {
  display: inline-block;
  padding: 10px 36px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.5px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.workshare-nav-link:hover:not(.disabled) {
  background: rgba(255,255,255,0.2);
  border-color: #fff;
  color: #fff;
}

.workshare-nav-link:active:not(.disabled) {
  transform: translateY(1px);
}

.workshare-nav-link.disabled {
  color: rgba(255,255,255,0.45);
  border-color: rgba(255,255,255,0.2);
  background: transparent;
  cursor: not-allowed;
}

.workshare-landing-title {
  margin-top: auto;
  margin-left: auto;
  text-align: right;
  padding-bottom: 56px;
  padding-right: 20px;
}

.workshare-corner-logo {
  position: absolute;
  top: 22px;
  left: 44px;
  height: clamp(28px, 3vw, 40px);
  width: auto;
  z-index: 2;
}

.workshare-landing-title h1 {
  font-size: 64px;
  line-height: 1.05;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: -0.5px;
}

.workshare-landing-title .thin {
  font-weight: 300;
}

/* ---- Overview page layout ---- */
.workshare-body {
  padding: 4px 20px 20px 20px;
  background: var(--ws-bg);
}

/* Three stacked rows: target cards → charts → KPI cards */
.workshare-rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.workshare-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

/* ---- Target Rate cards (row 1) ----
   Plan rate as the headline, "To Date:" + delta beneath it, trend arrow at right. */
.ws-target-card {
  padding: 12px 14px 14px;
}

.ws-tc-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--kbr-text);
  margin-bottom: 6px;
}

.ws-tc-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ws-tc-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.ws-tc-plan {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--kbr-text);
}

.ws-tc-todate {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ws-tc-label {
  font-size: 12px;
  color: var(--kbr-text-muted);
}

.ws-tc-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--kbr-text);
}

.ws-tc-delta {
  font-size: 13px;
  font-weight: 700;
}

.ws-tc-icon {
  flex: none;
  font-size: 30px;
  line-height: 1;
}

/* ---- Chart panels (row 2) ---- */
.workshare-chart-panel {
  padding: 0;
  overflow: hidden;
}

.workshare-chart-panel .ws-chart-head {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--kbr-border);
}

.workshare-chart-panel h4 {
  margin: 0 0 1px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  color: var(--kbr-text);
}


.workshare-chart-panel .chart-box {
  height: 214px;
  padding: 10px 12px 12px;
}

/* Fixed legend, outside .ws-chart-scroll so the scrollbar sits above it and the
   entries never scroll out of view. Populated by workshare/overview.js. */
.ws-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  padding: 4px 12px 10px;
}

.ws-chart-legend:empty { display: none; }

.ws-lg-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--kbr-text);
}

.ws-lg-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

/* WS-8: horizontal scroll for a long period series. .ws-chart-inner is the
   positioned ancestor the canvas fills and MUST keep a definite height — these
   charts run maintainAspectRatio:false, and a content-derived height makes the
   canvas grow on every resize observation. overview.js sets the width. */
.workshare-chart-panel .chart-box.ws-chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}
.ws-chart-scroll > .ws-chart-inner {
  position: relative;
  height: 100%;
  min-width: 100%;   /* short series still fill the panel; JS widens past it */
}
.ws-chart-scroll > .ws-chart-inner > canvas {
  position: absolute;
  inset: 0;
}

/* ---- KPI cards (row 3) ---- */
.workshare-kpi-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.workshare-kpi-card h4 {
  margin: 0;
  padding: 9px 14px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--kbr-text);
  background: var(--ws-surface);
  text-align: center;
  border-bottom: 1px solid var(--kbr-border);
}

/* Budget / EAC / ITD — 2-column list: label on left, value on right */
.kpi-totals {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--kbr-border);
}

.kpi-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 14px;
  border-bottom: 1px solid #eef2f6;
}

.kpi-total-row:last-child { border-bottom: none; }

.kpi-total-row .t-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--kbr-text);
}

.kpi-total-row .t-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--ws-navy);
}

/* ---- Diverging bar metrics ----
   Column header row: % HO on left, % IOC on right (matching the axis). */
.ws-div-col-heads {
  display: flex;
  justify-content: space-between;
  padding: 6px 14px 5px;
  background: var(--ws-surface);
  border-bottom: 1px solid var(--kbr-border);
  font-size: 10px;
  font-weight: 700;
  color: var(--kbr-text);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ws-div-metrics { padding: 2px 0; }

.ws-div-metrics .metric-row {
  padding: 6px 12px 7px;
  border-bottom: 1px solid #eef2f6;
}

.ws-div-metrics .metric-row:last-child { border-bottom: none; }

/* Row label centered above the bar */
.div-label {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--ws-slate);
  margin-bottom: 5px;
}

/* Two half-tracks + center axis */
.div-bar {
  display: flex;
  align-items: center;
  gap: 3px;
}

.div-half {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

/* Left half: value at far left, track fill anchors at the right edge (axis side) */

.div-track {
  flex: 1;
  height: 8px;
  background: var(--ws-surface);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
}

/* Left track: align fill to the right end so it grows left from the axis */
.div-half.left  .div-track { justify-content: flex-end; }
/* Right track: align fill to the left end so it grows right from the axis */
.div-half.right .div-track { justify-content: flex-start; }

.div-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.25s ease;
}

/* Thin vertical axis line at center = "0" reference */
.div-axis {
  width: 2px;
  height: 16px;
  background: #c0c8d4;
  border-radius: 1px;
  flex-shrink: 0;
}

/* Percentage labels flanking the bar */
.div-val {
  font-size: 10px;
  font-weight: 700;
  color: var(--ws-slate);
  min-width: 26px;
  text-align: center;
  flex-shrink: 0;
}

/* Fill color per row type */
.metric-row.row-target    .div-fill { background: var(--ws-slate); }
.metric-row.row-cumtodate .div-fill { background: var(--ws-red); }
.metric-row.row-togo      .div-fill { background: var(--ws-green); }
.metric-row.row-eac       .div-fill { background: var(--ws-green-dark); }

/* ---- Responsive ---- */
@media (max-width: 1399px) {
  .workshare-landing-title h1 { font-size: 56px; }
}

@media (max-width: 1199px) {
  .workshare-row { grid-template-columns: 1fr 1fr; }
  .workshare-landing-title h1 { font-size: 52px; }
  .workshare-landing-content { padding: 24px 32px 40px 32px; }
  .workshare-kbr-logo { right: 32px; }
}

@media (max-width: 1199px) {
  .workshare-row { grid-template-columns: 1fr 1fr; }
  .workshare-landing-title h1 { font-size: 52px; }
  .workshare-landing-content { padding: 24px 32px 40px 32px; }
  .workshare-kbr-logo { right: 32px; }
}

@media (max-width: 991px) {
  .workshare-row { grid-template-columns: 1fr; }
  .workshare-chart-panel .chart-box { height: 280px; }
  .workshare-landing-title h1 { font-size: 44px; }
  .workshare-landing-title { padding-right: 0; padding-bottom: 40px; }
  .workshare-landing-top { margin-top: 10vh; }
  .workshare-control select { min-width: 0; width: 100%; }
}

@media (max-width: 767px) {
  .workshare-landing-content { padding: 20px 24px 32px 24px; }
  .workshare-kbr-logo { right: 24px; top: 20px; }
  .workshare-landing-controls { flex-direction: column; align-items: stretch; gap: 12px; width: 100%; }
  .workshare-control { width: 100%; }
  .workshare-nav-link { display: block; text-align: center; }
  .workshare-landing-title h1 { font-size: 38px; }
}

@media (max-width: 575px) {
  .workshare-landing-title h1 { font-size: 32px; }
  .workshare-landing-top { margin-top: 8vh; }
  .ws-tc-plan { font-size: 24px; }
  .ws-tc-icon { font-size: 24px; }
}
