/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

body {
  background: var(--blue);
  color: #f7fafc;
  font-family: Verdana;
  margin: 0;
  padding: 0;
}

a {
  cursor: pointer;
  text-decoration: none;
}

header {
  background: var(--light-blue);

  h1 {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    color: #e2e8f0;
  }
}

nav {
  background: var(--dark-blue);
  
  &> div {
    display: flex;
    align-items: center;

    &> div {
      display: flex;
      flex-grow: 1;
      align-items: center;
    }
  }
}

.no-js .js-only {
  display: none;
}

.link {
  color: #f6e05e;
  text-decoration: none;
  border-bottom: 1px solid #f6e05e;
}

.alert {
  background: #c53030;
  color: #fff;
  font-weight: 700;
  padding: 10px;
  text-align: center;
}
.notice {
  background: #ccc;
  color: #000;
  font-weight: 700;
  padding: 10px;
  text-align: center;
}

.navlink {
  border-radius: 6px;
  font-weight: 700;
  padding: 4px 12px;
  margin: 8px 4px;
  color: #e2e8f0;
  font-size: 16px;
  text-transform: uppercase;

  &.active {
    color: #fff;
    background: var(--blue);

    &:hover {
      color: #fff;
      background: var(--blue);
    }
  }

  &:hover {
    background: #2c5282;
  }

  &:focus {
    outline: none;
  }
}

.registration,
.login {
  main {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 320px;
    margin: auto;

    form {
      padding: 20px;
      width: 100%;
    }
  }
}

.graph {
  margin: 0.5rem 0;
  white-space: nowrap;

  .bar {
    margin: 1px;
    min-width: 40px;
    padding: 6px 4px;
    display: inline-block;
    position: relative;
    vertical-align: bottom;
    color: #fff;
    font-size: 10px;
    text-align: center;
    line-height: 10px;
    overflow: hidden;
    background: var(--light-blue);
    font-family: var(--font-mono);

    &:hover {
      text-decoration: none;
    }

    &.active {
      background: #123658;
    }
  }

  .graph-label {
    display: none;
  }
}

.svg {
  display: inline-block;
}

svg.barbell {
  line {
    fill: none;
    stroke: #fff;
  }
  .plate-5 {
    stroke-width: 6px;
  }
  .plate-25 {
    stroke-width: 8px;
  }
  .plate-45 {
    stroke-width: 10px;
  }
  .bar {
    stroke-width: 8px;
  }
}

svg.chain {
  display: inline;
  color: #fff;

  line {
    fill: none;
    stroke: #fff;
    stroke-width: 6px;
    stroke-linecap: round;
  }
}

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

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

.float-right {
  float: right;
}

.field {
  margin-top: 24px;

  &.error {
    font-weight: 700;

    .label {
      color: #feb2b2;
      font-weight: 900;
    }

    .input {
      background: #feb2b2;
      border-color: #feb2b2;
    }
  }
}

.input {
  appearance: none;
  border-width: 1px;
  border-color: #e2e8f0;
  border-radius: 6px;
  color: #1a202c;
  display: block;
  margin-top: 4px;
  padding: 8px 12px;
  width: 100%;
  transition: all 150ms ease-in-out;

  &::placeholder {
    color: #1a202c;
  }

  &:focus {
    background: #fefcbf;
    outline: none;
  }
}

input.number {
  background: transparent;
  outline: none;
  padding-top: 12px;
  padding-bottom: 12px;
  text-align: center;
  width: 100%;

  &:focus {
    background: var(--light-blue);
  }
}

input.transparent {
  background: transparent;
  outline: 0;
}

div.note {
  color: #a0aec0;
  display: inline-block;
  padding: 12px 16px 12px 32px;
}

textarea.note {
  background: transparent;
  border: 1px solid #a0aec0;
  color: #a0aec0;
  margin: 6px 6px 6px 32px;
  outline: 0;
  padding: 8px;
}

.label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.button {
  border-width: 1px;
  border-color: #fff;
  background: #fff;
  font-weight: 700;
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  color: #2c5282;
  font-size: 14px;
  text-transform: uppercase;
  white-space: nowrap;

  svg {
    display: inline-block;
    margin-right: 4px;
  }

  &:hover {
    background: #2c5282;
    color: #fff;
  }

  &:focus {
    outline: none;
  }

  &.delete {
    color: #c53030;

    &:hover {
      background: #c53030;
      color: #fff;
    }
  }
}

.buttons {
  display: inline-flex;

  .text {
    border-width: 1px;
    border-color: #fff;
    background: #fff;
    font-weight: 700;
    padding: 8px;
    font-size: 14px;
    line-height: 20px;
    color: #2c5282;
  }

  .button {
    margin: 0;
    border-radius: 0;
  }

  *:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
  }

  *:last-child,
  .last_child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
  }
}

header,
.padded,
.intro {
  padding: 16px;
}

.intro {
  font-size: 18px;
}

.dashboard {
  .history {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
  }

  .calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    text-align: center;
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.1em;
    margin: 8px 16px;

    .header {
      grid-column: span 7 / span 7;
      padding: 8px;
      text-transform: uppercase;
    }

    .day_header {
      border-bottom-width: 2px;
      border-color: #bee3f8;
      grid-column: span 1 / span 1;
      padding: 4px;
      text-transform: uppercase;
    }

    .day {
      grid-column: span 1 / span 1;
    }
  }
}

.workout {
  .exercises {
    &> * + * {
      border-top-width: 1px;
      border-bottom-width: 0px;
      border-color: #bee3f8;
    }
  }

  .grid {
    display: grid;

    &.grid-w-header {
      grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    &.grid-e-header {
      border-width: 2px;
      border-color: #bee3f8;
      grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    &.grid-e-body {
      grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .row_name {
      grid-column: span 7 / span 7;
    }

    .row_buttons {
      grid-column: span 5 / span 5;
    }

    .col-exercise {
      font-size: 12px;
      font-weight: 700;
      grid-column: span 6 / span 6;
      letter-spacing: 0.05em;
      line-height: 16px;
      padding: 12px 16px;
      text-transform: uppercase;
    }

    .col-weight,
    .col-reps,
    .col-time {
      font-size: 12px;
      font-weight: 700;
      grid-column: span 2 / span 2;
      letter-spacing: 0.05em;
      line-height: 16px;
      padding: 12px 0;
      text-align: center;
      text-transform: uppercase;
    }

    .col-e-index {
      grid-column: span 6 / span 6;
      position: relative;

      div.index {
        position: absolute;
        font-family: var(--font-mono);
        color: #a0aec0;
        font-size: 12px;
        text-align: right;
        width: 24px;
        padding-top: 16px;
      }

      svg.note {
        top: 16px;
        position: absolute;
        right: 8px;
        color: #a0aec0;
        pointer-events: none;

        path {
          stroke: #fff;
          stroke-width: 2;
          stroke-linecap: round;
          stroke-linejoin: round;
        }
      }

      /* delete exercise form */
      form {
        position: absolute;
        color: #a0aec0;
        text-align: right;
        width: 24px;
        padding-top: 16px;

        button {
          &:hover {
            color: #c53030;
          }
        }
      }

      input.keyboard {
        background: transparent;
        outline: none;
        padding: 12px 16px 12px 32px;
        width: 100%;

        &:focus {
          background: var(--light-blue);
        }
      }
    }

    .col-e-weight,
    .col-e-reps,
    .col-e-secs {
      grid-column: span 2 / span 2;
    }
  }
}

.hidden {
  display: none !important;
}

.workouts {
  &> * + * {
    border-top-width: 1px;
    border-bottom-width: 0px;
    border-color: #bee3f8;
  }

  a.grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    color: #ecc94b;

    &:hover {
      background: var(--light-blue);
    }

    .name {
      grid-column: span 9 / span 9;
      padding: 12px 16px;

      .exercises {
        color: #cbd5e0;
        font-size: 14px;
        line-height: 20px;
        font-family: var(--font-mono);
      }
    }

    .started_at {
      grid-column: span 3 / span 3;
      padding: 12px 16px;
      text-align: center;
      color: #f7fafc;
      font-size: 12px;
      line-height: 16px;
      text-transform: uppercase;
    }
  }
}

.pagination {
  padding: 12px 16px;
  text-align: center;
}

.exercise_graph {
  grid-column: span 12 / span 12;
}

.delete_exercise_form {
  grid-column: span 12 / span 12;
  padding: 12px;
}

.delete_workout {
  position: fixed;
  z-index: 10;
  inset: 0px;
  overflow-y: auto;

  .overlay {
    position: fixed;
    inset: 0;
    transition-property: opacity;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;

    div {
      position: absolute;
      inset: 0;
      background: #90cdf4;
      opacity: 0.75;
    }
  }

  .container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    padding-bottom: 80px;
    text-align: center;

    .center-modal {
      display: hidden;
    }
  }

  .content {
    display: inline-block;
    vertical-align: bottom;
    background: var(--blue);
    border-radius: 8px;
    text-align: left;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    transform: translateX(0) translateY(0) rotate(0) skewX(0) skewY(0) scaleX(1) scaleY(1);
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;

    .inner {
      background: var(--light-blue);
      padding: 16px;
      padding-top: 20px;

      .items {
        .icon {
          margin-left: auto;
          margin-right: auto;
          display: flex;
          flex-shrink: 0;
          align-items: center;
          justify-content: center;
          height: 48px;
          width: 48px;
          border-radius: 9999px;
          background: #fff5f5;
        }
      }

      .body {
        margin-top: 12px;
        text-align: center;
      }
    }

    .footer {
      padding: 12px 16px;
      text-align: center;
    }
  }
}

@media (min-width: 640px) { /* sm */
  input.number {
    padding-left: 16px;
    padding-right: 16px;
  }

  .delete_workout {
    .container {
      display: block;
      padding: 0;

      .center-modal {
        display: inline-block;
        vertical-align: middle;
        height: 100vh;
      }
    }

    .content {
      margin-top: 32px;
      margin-bottom: 32px;
      vertical-align: middle;
      max-width: 512px;
      width: 100%;

      .inner {
        padding: 24px;
        padding-bottom: 16px;

        .items {
          display: flex;
          align-items: flex-start;

          .icon {
            margin-left: 0;
            margin-right: 0;
            height: 40px;
            width: 40px;
          }
        }

        .body {
          margin-top: 0;
          margin-left: 16px;
          text-align: left;
        }
      }

      .footer {
        text-align: right;
      }
    }
  }

  .workouts {
    margin-left: 8px;
    margin-right: 8px;

    .name {
      grid-column: span 10 / span 10;
    }

    .started_at {
      grid-column: span 2 / span 2;
    }
  }

  .sm-block {
    display: block;
  }

  .sm-hidden {
    display: none;
  }

  header,
  .padded,
  .intro {
    padding: 24px;
  }

  .dashboard {
    .calendar {
      margin-left: 24px;
      margin-right: 24px;
    }

    .history {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  .workout main {
    margin: 8px;
  }

  .workout .grid {
    &.grid-w-header {
      grid-template-columns: repeat(12, minmax(0, 1fr));
    }

    .row_name {
      grid-column: span 8 / span 8;
    }

    .row_buttons {
      grid-column: span 4 / span 4;
    }

    .col-exercise {
      grid-column: span 6 / span 6;
    }

    .col-weight,
    .col-reps,
    .col-time {
      grid-column: span 2 / span 2;
      padding-left: 16px;
      padding-right: 16px;
    }
  }
}

@media (min-width: 768px) { /* md */
  .workouts {
    margin-left: 16px;
    margin-right: 16px;
  }

  header,
  .padded,
  .intro {
    padding: 32px;
  }

  .workout main {
    margin: 16px;
  }

  .dashboard {
    .calendar {
      margin-left: 32px;
      margin-right: 32px;
    }
    .history {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  .workout .grid {
    .row_name {
      grid-column: span 9 / span 9;
    }

    .row_buttons {
      grid-column: span 3 / span 3;

      .buttons {
        float: right;
      }
    }
  }
}

@media (min-width: 1024px) { /* lg */
  .dashboard {
    .history {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
}

@media (min-width: 1280px) { /* xl */
  .workouts {
    .name {
      grid-column: span 11 / span 11;
    }

    .started_at {
      grid-column: span 1 / span 1;
    }
  }
}
