/* Header Styles ******************************/
.header {
  display: grid;
  grid-template-columns: 1fr 400px 1fr 1fr;
  grid-template-rows: 100px;
  background-color: black;
}

.derg-container {
  grid-column: 1 / span 1;
  grid-row: 1 / span 1;
  place-self: start;
}

.byu-container {
  grid-column: 4 / span 1;
  grid-row: 1 / span 1;
  place-self: center;
}

h1 {
  grid-column: 2 / span 2;
  grid-row: 1 / span 1;
  color: white;
  text-align: center;
  margin-top: 30px;
}

/* Body and Selection Style ******************************/
body {
  margin: 30px;
  padding: 0;
  text-indent: 20px;
}

/* Top Buttons *******************************/
.button-container {
  margin-left: 25px;
  display: flex;
  align-items: center;
  width: auto;
  gap: 10px;
}

/* Selection + Output Layout *******************************/
.select-container {
  margin-left: 30px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.example-container {
  flex: 1;
  min-width: 0;
}

/* Checkbox List: scrollable "frame" like original <select size=20> */
.checkbox-list {
  width: auto;
  margin-right: 20px;

  height: 420px;
  overflow-y: auto;

  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px;

  text-indent: 0;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 4px;
  text-indent: 0;
}

.checkbox-item input {
  margin-top: 2px;
}

/* Submit + CSV Buttons *******************************/
.submit-container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: 100px;
  text-indent: 0;
}

.submit-container-Relationship {
  grid-column-start: 2;
  grid-column-end: span 1;
  place-self: center start;
}

.downloadcsv-container {
  grid-column-start: 3;
  grid-column-end: span 1;
  place-self: center start;
}

/* Pivot / Matrix Viewer **********************************/
.matrix-wrap{
  max-width: 100%;
  overflow: auto;
  padding: 6px 0;
}

/* ---- Matrix styling knobs ---- */
.pase-matrix{
  --cell: 22px;               /* relationship cell size (square) */
  --outer-border: 2px;        /* heavier outer border */
  --grid-border: 1px;         /* inner grid thickness */
  --grid-color: #2f2f2f;       /* darker lines */
  --header-bg: #ffffff;
  --strategy-label-col: 26px; /* column 1 width */

  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;

  border-collapse: collapse;
  border: var(--outer-border) solid var(--grid-color);

  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.pase-matrix th,
.pase-matrix td{
  border: var(--grid-border) solid var(--grid-color);
  background: #ffffff;
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.2;
}

/* Header rows */
.pase-matrix thead th{
  font-weight: 600;
  background: var(--header-bg);
}

/* Merged top header: "Effects of Interest" */
.matrix-head-1 .effects-label{
  text-align: center;
  letter-spacing: 0.2px;
  padding: 6px 0;
}

/* Corner header cells align with the two left pinned columns */
.matrix-head-1 th.corner:first-child,
.matrix-head-2 th.corner:first-child{
  width: var(--strategy-label-col);
  min-width: var(--strategy-label-col);
  max-width: var(--strategy-label-col);
  padding: 0;
  background: #ffffff;
}

.matrix-head-1 th.corner:nth-child(2),
.matrix-head-2 th.corner:nth-child(2){
  padding: 0;
  background: #ffffff;
}

/* Effect column headers */
.matrix-head-2 .effect-col{
  writing-mode: vertical-rl;
  transform: rotate(180deg);

  width: var(--cell);
  min-width: var(--cell);
  max-width: var(--cell);

  height: auto;
  white-space: nowrap;

  vertical-align: bottom;
  text-align: left;
  padding: 6px 0;

  font-size: 13px;
  line-height: 1.2;
  font-weight: 600;
}

/* Column 1 body cell ("Strategies of Interest") */
.pase-matrix th.strategies-label{
  width: var(--strategy-label-col);
  min-width: var(--strategy-label-col);
  max-width: var(--strategy-label-col);

  padding: 4px 2px;

  writing-mode: vertical-rl;
  transform: rotate(180deg);

  text-align: center;
  vertical-align: middle;

  background: #ffffff;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* Column 2 body cells (strategy names) */
.pase-matrix th.strategy-name{
  width: max-content;
  min-width: 260px;
  white-space: nowrap;

  text-align: left;
  background: #ffffff;
  font-weight: 400;

  padding: 6px 10px;
}

/* Relationship cells: FORCE SQUARE */
.pase-matrix td.matrix-cell{
  width: var(--cell);
  min-width: var(--cell);
  max-width: var(--cell);

  height: var(--cell);
  min-height: var(--cell);

  padding: 0;
  text-align: center;
  vertical-align: middle;

  font-weight: 700;
  font-size: 12px;
  line-height: var(--cell);
}

/* Remove striping */
.pase-matrix tbody tr:nth-child(even) td,
.pase-matrix tbody tr:nth-child(even) th.strategy-name{
  background: #ffffff;
}

/* =========================================================
   STICKY HEADERS + PIN COLUMNS 1 & 2 (NO OVERLAY BY X CELLS)
   ========================================================= */

/* Sticky headers */
.pase-matrix thead th{
  background: #fff;
  z-index: 100;                 /* already high */
  outline: 1px solid var(--grid-color); /* draws an always-visible border */
  outline-offset: -1px;
}

.pase-matrix thead tr.matrix-head-1 th{
  top: 0;
  z-index: 80;
}

.pase-matrix thead tr.matrix-head-2 th{
  top: 31px;
  z-index: 75;
}

/* Ensure all normal body cells remain BELOW pinned columns */
.pase-matrix tbody td{
  position: relative;
  z-index: 1;
}

/* Column 1 pinned: above all body cells */
.pase-matrix tbody th.strategies-label{
  position: sticky;
  left: 0;
  z-index: 60;
  background: #ffffff; /* opaque */
}

/* Column 2 pinned: above all body cells */
.pase-matrix tbody th.strategy-name{
  position: sticky;
  left: var(--strategy-label-col);
  z-index: 50;
  background: #ffffff; /* opaque */
}

/* Safety: if any tbody row uses td in column 2 */
.pase-matrix tbody td.strategy-name{
  position: sticky;
  left: var(--strategy-label-col);
  z-index: 50;
  background: #ffffff;
}

/* Top-left corner intersections: keep them above everything */
.pase-matrix thead tr.matrix-head-1 th.corner,
.pase-matrix thead tr.matrix-head-2 th.corner{
  position: sticky;
  z-index: 90;
  background: #ffffff;
}

/* First corner cell pinned at left:0 */
.pase-matrix thead tr.matrix-head-1 th.corner:first-child,
.pase-matrix thead tr.matrix-head-2 th.corner:first-child{
  left: 0;
}

/* Second corner cell pinned at left offset of col 1 width */
.pase-matrix thead tr.matrix-head-1 th.corner:nth-child(2),
.pase-matrix thead tr.matrix-head-2 th.corner:nth-child(2){
  left: var(--strategy-label-col);
}

/* Empty state */
.matrix-empty{
  padding: 10px 0;
}

/* Buttons ********************************/
button,
input[type="submit"],
input[type="button"] {
  background-color: #ffffff;
  border: 1px solid #666;
  border-radius: 4px;
  color: #222;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.05s ease;
}

button:hover,
button:focus,
input[type="submit"]:hover,
input[type="submit"]:focus,
input[type="button"]:hover,
input[type="button"]:focus {
  background-color: #FFC378;   /* DesX-related orange hover */
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  outline: none;
}

button:active,
input[type="submit"]:active,
input[type="button"]:active {
  background-color: #EB7300;   /* full DesX orange when pressed */
  color: #fff;                 /* ensure contrast */
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.2);
  transform: translateY(1px);
}


/* Footer Styles *******************************/
footer{
  background-color: black;
  align-items: center;
}

.footer {
  background-color: black;
  height: auto;
  width: auto;
  display: flex;
}

h2 {
  align-items: center;
  color: white;
  margin: 10px;
}

/* PASE Matrix clickable X cells ********************************/
.matrix-cell--has-x {
  cursor: pointer;
}