* {
  box-sizing: border-box;
}

html {
  margin: 0;
  height: 100dvh;
  --corner-radius: 12px;
}

body, input, select, button {
  font-family: "IBM Plex Sans", -apple-system, SF Pro Text, SF UI Text, Roboto, system-ui, Helvetica, sans-serif;
}

body {
  margin: 0;
  height: 100dvh;
  background-color: #f1f1f1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.flexContainer {
  display: flex;
  justify-content: flex-start;
  flex: 0 0 auto;
  height: calc(100% - 29px);
  /* background-image: linear-gradient(#ff8a00, #00b4d8); */
}

.column {
  padding-top: 0px;
  
  &:first-child {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    /* align-items: center; */
    background-color: white;
    box-shadow: 2px 0 4px lightgray;
    overflow-y: auto;
    /* min-width: 470px; */
    /* scrollbar-gutter: stable; */

    fieldset.scenarios {
      display: flex;
      flex-direction: column;
      height: calc(100% - 126px);
      margin-top: 10px;
      margin-left: 10px;
      margin-right: 10px;
      border: none;
      
      .header {
        background-color: #f9f9f9;
        border-bottom: 1px solid lightgray;
        padding: 0;
        display: flex;

        button {
          margin: 0;
          padding: 0;
          height: 40px;
          flex-grow: 1;
          border: none;
          cursor: pointer;
          background-color: #eee;
          font-size: 14px;

          i {
            width: 1em;
            margin-right: 6px;
          }
          
          &:first-child {
            border-top-left-radius: calc(var(--corner-radius) - 1px);
            border-right: 1px solid lightgray;
          }

          &:last-child {
            border-top-right-radius: calc(var(--corner-radius) - 1px);
            border-left: 1px solid lightgray;
          }

          &:hover {
            background-color: #ddd;
          }

          &:active {
            background-color: #e2e2e2;
          }
        }
      }
    }

    .footer {
      border-top: 1px solid lightgray;
      margin-top: auto;
      padding: 6px 20px;
      font-size: 14px;

      label {
        margin-left: auto;
        cursor: pointer;
      }
      
      .toggle {
        position: relative;
        display: inline-block;
        width: 30px;
        height: 17px;
      }
      
      /* Hide default HTML checkbox */
      .toggle input {
        opacity: 0;
        width: 0;
        height: 0;
      }
      
      /* The slider */
      .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #ccc;
        border-radius: 17px;
        -webkit-transition: .4s;
        transition: .4s;
      }
      
      .slider:before {
        position: absolute;
        content: "";
        height: 13px;
        width: 13px;
        left: 2px;
        bottom: 2px;
        background-color: white;
        border-radius: 50%;
        -webkit-transition: .2s;
        transition: .2s;
      }
      
      input:checked + .slider {
        background-color: #34C759;
      }
      
      input:focus + .slider {
        box-shadow: 0 0 1px #2196F3;
      }
      
      input:checked + .slider:before {
        -webkit-transform: translateX(13px);
        -ms-transform: translateX(13px);
        transform: translateX(13px);
      }
    }
  }

  &:last-child {
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-gutter: stable;
    padding-bottom: 25px;
    /* background-color: rgba(240, 240, 240, 0.9); */
  }
}

.pageHeader {
  margin-top: 20px;
  display: flex;
  font-size: 1.7rem;
  /* background-color: #0b58b4; */
  /* background-color: #00539b; */
  /* color: white; */
  /* color: #04316c; */
  /* border-bottom: 1px solid darkgray; */
  padding-bottom: 10px;
  margin-bottom: 10px;

  .circle {
    width: 1.7em;
    height: 1.7em;
    border-radius: 50%;
    background-color: #03045e;
    /* background-color: white; */
    margin-left: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* border: 2px solid #03045e; */
  }
  
  i {
    color: #03045e;
    color: white;
    padding: 10px;
    /* font-size: 1em; */
  }

  h1 {
    font-size: 1em;
    margin: auto;
    font-weight: 700;
    text-align: left;
    margin-left: 12px;
    color: #03045e;
  }
}

.buttonBar {
  margin: 11px 30px 0;
  display: flex;

  button {
    margin: 0;
    padding: 0;
    height: 30px;
    flex-grow: 1;
    border: 1px solid lightgray;
    cursor: pointer;
    background-color: #eee;
    font-size: 14px;

    i {
      width: 1em;
      margin-right: 6px;
    }
    
    &:first-child {
      border-top-left-radius: 50px;
      border-bottom-left-radius: 50px;
    }

    &:last-child {
      border-top-right-radius: 50px;
      border-bottom-right-radius: 50px;
    }

    &:not(:last-child) {
      border-right: none;
    }

    &:hover {
      background-color: #ddd;
    }

    &:active {
      background-color: #e2e2e2;
    }
  }
}

table.scenarios {
  table-layout: fixed;
  /* min-width: 420px; */
  align-self: end;

  th {
    padding-top: 8px;
    padding-bottom: 3px;
    /* border-bottom: 1px solid #ddd; */
    
    &:last-child {
      padding-right: 0px;
    }
  }

  td {
    padding-top: 1px;
    padding-bottom: 5px;
  }
  
  th, td {
    text-align: right;
    padding-left: 20px;
    padding-right: 0px;

    &:nth-child(2) {
      padding-left: 0;
      padding-right: 5px;
      text-align: center;
      width: 30px;
    }
    &:nth-child(3) {
      text-align: left;
      padding-left: 0px;
      padding-right: 20px;
    }
    &:nth-child(4) {
      padding-left: 0;
      width: 45px;
    }
    &:nth-child(5) {
      width: 60px;
    }
    &:nth-child(6) {
      width: 60px;
      text-align: right;
      padding-right: 7px;
    }
    &:nth-last-child(2) {
      display: none;
      
      input {
        text-align: right;
      }
    }
    &:last-child {
      /* width: 97px; */
    }
  }

  tr.scenario {
    .radio {
      cursor: pointer;
    }

    td:not(:first-child) {
      /* border-top: 1px solid #f1f1f1; */
    }
    
    &:not(.active) {
      td:not(:nth-child(2)):not(:nth-last-child(2)) {
        opacity: 0.6;
      }

      td:nth-child(2), td:nth-child(3) {
        cursor: pointer;
      }

      input.scenarioName {
        border: 2px solid transparent;
        pointer-events: none;
      }
      
      td.replacement {
        opacity: 1;
      }
    }
  
    &.active {
      cursor: auto;
    }
    
    .scenarioName {
      text-align: left;
      font-weight: 600;
      field-sizing: content;
      min-width: 104px;
    }
  }

  &.replacements {
    th:nth-last-child(2), td:nth-last-child(2), tfoot {
      display: revert;
    }

    th:last-child, td:last-child {
      width: 0px;
    }
  }
  
  tfoot {
    display: none;
    vertical-align: bottom;

    td {
      padding-top: 10px;
      padding-bottom: 10px;
      
      &:nth-child(3) {
        font-size: 0.9em;
        font-weight: 600;
        text-transform: uppercase;
        text-align: right;
      }
  
      &:nth-child(4), &:nth-child(5), &:nth-child(6), &:nth-child(7) {
        border-top: 1px solid #ddd;
      }
    }

    #replacementD {
      padding-right: 10px;

      &.invalid {
        color: red;
        position: relative;

        /* &::before {
          content: "(15 < )";
          color: gray;
          font-weight: normal;
          font-size: 14px;
          position: absolute;
          top: 30%;
          left: 10%;
        } */
      }
    }
  }
}

.releaseWrapper {
  position: relative;
}
label.release::after {
  content: "%";
  position: absolute;
  right: 6px;
  top: 20%;
}

fieldset {
  background-color: white;
  border-radius: var(--corner-radius);
  border: 1px solid lightgray;
  margin-top: 20px;
  margin-left: 20px;
  max-width: 588px;
  padding: 0;

  .header {
    border-top-left-radius: var(--corner-radius);
    border-top-right-radius: var(--corner-radius);
    padding: 7px 30px;
    text-align: center;
    font-size: 20px;
    font-weight: bold;
  }
  .footer {
    border-bottom-left-radius: calc(var(--corner-radius) - 1px);
    border-bottom-right-radius: calc(var(--corner-radius) - 1px);
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    margin-top: 24px;
    padding: 8px 10px 8px 10px;
  }
}

fieldset.userInput {
  min-width: 576px;
}

#fall {
  .header {
    background: #ff8d00 url(noise.png);
    color: white;
    margin: -1px -1px;
  }
}

#winter .header {
  background: #00b4d8 url(noise.png);
  color: white;
  margin: -1px -1px;
}

input, select {
  font-size: 1em;
  padding: 4px 8px;
  border-radius: 4px;
  border: 2px solid #ddd;

  &:focus:focus-visible {
    border: 2px solid transparent;
  }

  &.release {
    padding-right: 20px;
    padding-left: 0px;
    text-align: right;
  }
}

table {
  border-collapse: collapse;
  table-layout: fixed;
  font-variant-numeric: lining-nums tabular-nums;

  th {
    font-size: 0.75em;
    /* font-size: 14px; */
    font-weight: 600;
    padding-bottom: 4px;
    padding-top: 6px;
    text-transform: uppercase;
    /* border-bottom: 1px solid #ddd; */
    vertical-align: bottom;
    opacity: 0.7;
  }

  th, td {
    padding-left: 5px; /* Space between columns */
    padding-right: 5px; /* Space between columns */
    line-height: 1;
    white-space: nowrap;
  }
}

table.courses {
  table-layout: fixed;
  vertical-align: middle;

  /* Hide course table header if no courses */
  thead:last-child {
    display: none;
  }
  
  tbody:not(:first-of-type) .rowHeader td {
    padding-top: 20px; /* Space between courses */
  }
  
  th {
    &:first-child {
      padding-left: 30px;
    }
    
    &:nth-child(4) {
      padding-left: 12px;
    }
    
    &:nth-child(5) {
      padding-right: 8px;
    }

    &:nth-child(6) {
      padding-right: 2px;
    }
    
    &:last-child {
      padding-right: 30px;
    }
  }
  
  th, td {
    &:nth-child(5), &:nth-child(6) {
      text-align: right;
    }
  }

  tr.rowHeader td {
    text-align: left;
    padding-left: 0px;
    /* padding-top: 8px; */
    
    input {
      field-sizing: content;
      min-width: 130px;
      font-weight: 600;
    }
    
    .fa {
      font-size: 20px;
      padding-left: 5px;
      /* opacity: 0.8; */
      transition: scale 0.2s, color 0.2s;
      position: relative;
      top: 1px;
      color: gray;
      backface-visibility: hidden;
      transform: translateZ(0);
      will-change: transform;
      
      &:hover {
        cursor: pointer;
        color: #009900;
        opacity: 1;
        scale: 1.3; 
        translate: -1px 0;
      }
      &:active {
        opacity: 0.7;
        /* transform: scale(1.5) translateX(-1px); */
      }
    }
  }
  
  tr.section td {
    padding-top: 6px; /* Space between rows */
    
    &:nth-child(2) {
      padding-left: 40px; /* Section indent */
      padding-right: 0;
      text-align: right;
    }

    &:nth-child(3) {
      padding-left: 10px;
      
      input {
        field-sizing: content;
        min-width: 105px;
        font-weight: 500;
      }
    }

    &:nth-child(5) {
      input {
        text-align: right;
      }
    }

    &:nth-last-child(3) {
      padding-right: 0;

      input {
        text-align: right;
      }
    }
    
    &:nth-last-child(2) {
      padding-left: 14px;
      padding-right: 14px;
    }
  }

  select {
    appearance: none;
    font-size: 1em;
    padding-right: 28px;
    background-color: white;
  }
  
  .dropdown {
    position: relative;
  
    &::after {
      content: "";
      position: absolute;
      top: 55%;
      right: 15px;
      pointer-events: none;
      display: inline-block;
      width: 0;
      height: 0;
      margin-left: 2px;
      vertical-align: middle;
      border-top: 5px solid;
      border-right: 5px solid transparent;
      border-left: 5px solid transparent;
    }
  }
}

.removeSection, .delete {
  cursor: pointer;
  opacity: 0.3;
  transition: all 0.2s;
  
  &:hover {
    opacity: 100%;
    color: red;
    transform: scale(1.3);
  }
  
  &:active {
    opacity: 50%;
  }
}

.rowCap {
    width: 4px;
    height: 29px;
    margin-right: 0;
    margin-left: auto;
    padding-right: 0;
  
    &.blue {
      background-color: #247abd;
    }
    &.green {
      background-color: #009900;
    }
    &.orange {
      background-color: #FF5F15;
    }
    &.purple {
      background-color: purple;
    }
  }

.stageDrawer {
  margin: 30px 0px 0px;
  padding: 0;
  /* border-top: 1px solid #ddd; */
}
table:has(thead:last-child) + .stageDrawer {
  border-top: none; /* Hide divider if no courses */
  margin-top: 0;
}

table.stages {
  th {
    vertical-align: top;
    padding-bottom: 1px;
    border-bottom: none;

    &:first-child {
      padding-left: 74px;
    }
    
    &:nth-child(3) {
      text-transform: none;
      padding-right: 10px;
    }

    &:nth-child(4) {
      padding-right: 1px;
    }

    &:last-child {
      padding-right: 191;
    }
  }

  td, th {
    &:nth-child(3) {
      text-align: right;
    }
    &:nth-child(4) {
      text-align: right;
    }
    &:nth-child(5) {
      padding-left: 14px;
      padding-right: 0;
    }
  }

  td {
    padding-bottom: 6px;

    &:first-child {
      padding-right: 0px; /* Row cap */
    }
    
    &:nth-child(2) {
      padding-left: 10px;

      input {
        field-sizing: content;
        min-width: 105px;
        font-weight: 500;
      }
    }

    &:nth-child(3) {
      text-align: right;

      input {
        text-align: right;
      }
    }
    
    &:nth-child(4) {
      padding-right: 0;
      text-align: right;

      input {
        text-align: right;
      }
    }
  }
}

.footer {
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  text-align: left;
  align-items: center;

  button {
    margin-right: 8px;
    cursor: pointer;
    height: 30px;
    width: auto;
    font-size: 14px;
    padding: 0 20px;
    border-radius: 6px;
    border: 1px solid lightgray;
    background-color: #eee;
    
    &:hover {
      background-color: #ddd;
    }
    &:active {
      background-color: #e2e2e2;
    }
  }
}


.duplicate {
  opacity: 0.3;
  transition: transform 0.1s;
  &:hover {
    cursor: pointer;
    opacity: 1;
    transform: scale(1.1);
    color: green;
  }
  &:active {
    opacity: 0.5;
  }
}

footer {
  width: 100%;
  text-align: center;
  border-top: 1px solid gray;
  padding: 5px 16px;
  font-size: 14px;
  /* background-color: #04316c; */
  /* background-color: #0b58b4; */
  /* background-color: #00539b; */
  background-color: #666;
  color: white;

  a {
    /* color: #FFE271; */
    color: white;
    /* color: black; */
  }
}

.collapse {
  visibility: collapse;
}

.hide {
  display: none;
}

.floatR {
  float: right;
}

.bold {
  font-weight: bold;
}

.italic {
  font-style: italic;
}

.gray {
  color: #444444;
}

.centered, .center {
  text-align: center;
}

.left {
  text-align: left;
}

.right {
  text-align: right;
}

.middle {
  vertical-align: middle;
}

.greyBG {
  background-color: #eee;
}

.unselectable {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}