$main-blue: rgb(0, 121, 191);
$light-gray: rgb(204, 204, 204);
$dark-gray: rgb(60, 60, 60);
$light-green: rgb(46, 204, 113);
$dark-green: rgb(39, 174, 96);
$bold-yellow: rgb(230, 198, 55);

$base-size: 10px;
$button-margin: 1.5rem;
$panel-margin: 3rem;
$panel-padding: 1.5rem;
$task-card-height: 8.5rem;
$task-card-padding: 1rem;
$task-card-margin-bottom: 1.5rem;
$topbar-height: 5rem;

// TODO(jrbotros): use variable from bootstrap-sass?
$bootstrap-md: "(min-width: 992px)";

$sqrt-2: 1.4142;

@mixin vendor-prefix($name, $argument) {
  -webkit-#{$name}: #{$argument};
  -ms-#{$name}: #{$argument};
  -moz-#{$name}: #{$argument};
  -o-#{$name}: #{$argument};
  #{$name}: #{$argument};
}

html, body {
  font-size: $base-size;
}

.wrapper {
  margin-top: 52px;
}

#main-content {
  margin-left: 0;
  color: $dark-gray;
}

header.header {
  background: darken($main-blue, 10);
  box-shadow: 0 1px 3px black;
  min-height: 0;
}

h1, h2, h3, h4, h5, h6, p {
  margin: 0;
  padding: 0
}

a {
  color: $main-blue;
  text-decoration: none;
  &:hover, &:focus, &:visited {
    color: $main-blue;
    text-decoration: underline;
  }
}

a.logo {
  font-size: 2rem;
  color: white;
  margin: 12px 30px;
  &:hover, &:focus, &:visited {
    color: white;
  }
}

#nav-options {
  cursor: pointer;
  font-size: 2rem;
  color: white;
  float: right;
  margin: 12px 30px;
  z-index: 1003;
  .dropdown-menu {
    a {
      color: $main-blue;
      &:hover {
        color: $main-blue;
        text-decoration: underline;
      }
    }
  }
}

.section-panel {
  margin: $panel-margin;
  box-shadow: 0 1px 3px black;
  background-color: white;
  .section-header {
    margin-top: 0;
    color: white;
    background-color: $main-blue;
    h3 {
      margin: 1.3rem 0;
      font-size: 1.8rem;
    }
    .btn {
      display: inline-block;
      color: white;
      background-color: $light-green;
      &:first-child {
        margin-left: $button-margin;
      }
      &:hover:not(.disabled) {
        border: 1px solid white;
      }
      &.disabled {
        color: $light-gray;
        background-color: rgba($light-green, 0.6);
      }
    }
  }
  .row:not(.section-header) {
    &.padded {
      > [class*="col-"] {
        padding-top: $panel-padding;
        padding-bottom: $panel-padding;
      }
    }
    .iframe-wrapper {
      border: 1px solid $light-gray;
    }
  }
}

.tasks-section {
  .section-header {
    .warning-message {
      font-style: italic;
      margin-left: 1.5rem;
      font-size: 1.5rem;
    }

    // New task buttons
    .btn-new-task {
      width: 150px;
      margin: 0 5px;
    }
    .btn-new-entry-task {
      @extend .btn-new-task;
      background-color: $dark-green;
      &.disabled {
        background-color: rgba($dark-green, 0.6);
      }
    }
    .btn-new-review-task {
      @extend .btn-new-task;
      background-color: $light-green;
      &.disabled {
        background-color: rgba($light-green, 0.6);
      }
    }
  }

  .col-task {
    h4 {
      padding-bottom: 0.5rem;
      margin-bottom: 1.5rem;
      border-bottom: 2px solid $light-gray;
    }
    &.col-waiting {
      background-color: #eee;
      opacity: 0.6;
    }

    .tasks-inactive {
      opacity: 0.6;
      a, a:hover, a:focus, a:visited {
        pointer-events: none;
        cursor: default;
      }
      .task-card {
        &:hover {
          background-color: blue;
        }
      }
    }

    .task-cards {
      min-height: $task-card-height;
      // Divs created by ng-repeat
      > div:not(:last-child) {
        margin-bottom: $task-card-margin-bottom;
        [class*="col-"] {
          margin-bottom: $task-card-margin-bottom;
        }
      }
      .task-card-wrapper {
        width: 100%;
        padding: $task-card-padding;
        height: $task-card-height;
        text-align: left;
        background-color: white;

        // Colored border to left of task card; use :before to avoid diagonal
        // artifact with border-left
        $card-border-width-small: 0.1rem;
        $card-border-width-large: 1.5rem;
        position: relative;
        padding-left: $task-card-padding + $card-border-width-large;
        border: $card-border-width-small solid $light-gray;
        &:before {
          content: '';
          width: $card-border-width-large;
          position: absolute;
          top: -$card-border-width-small;
          bottom: -$card-border-width-small;
          left: -$card-border-width-small;
          background: $main-blue;
        }

        &:hover {
          background-color: rgba($bold-yellow, 0.2);
        }
        a {
          color: $dark-gray;
          &:hover, &:visited, &:focus {
            color: $dark-gray;
            text-decoration: none;
          }
          .task-card {
            // Cut task descriptions off after two lines
            height: $task-card-height - 2 * $task-card-padding;
            overflow: hidden;
            .task-type {
              // border-bottom: 2px solid $main-blue;
              h5 {
                text-transform: uppercase;
                color: $main-blue;
                width: 100%;
                font-size: 1.6em;
                margin: 5px 0;
                font-weight: bold;
              }
            }
            .task-detail {
              margin: 5px 0;
              font-size: 1.2em;
              line-height: 1.5em;
            }
          }
        }
      }
    }
  }

  .active-tasks {
    margin-top: 0;
    @media #{$bootstrap-md} {
      .task-cards {
        min-height: $task-card-height * 4 + $task-card-margin-bottom * 3;
      }
    }
  }

  .completed-tasks {
    padding-bottom: $panel-padding;
  }
}

.btn.review-doc {
  float: right;
  margin-right: 15px;
}

.navbar-submit {
  padding-left: 10px;
}

.step-interface {
  margin-top: $topbar-height + $panel-margin;
}

/* Login/account-related pages */
.login-wrap {
  font-size: 1.3rem;
  .error-non-field {
    padding: 0px 0px 10px 10px;
    color: red;
  }
  .error-field {
    padding: 5px 0px 0px 10px;
    color: red;
  }
}

/* Confirmation modals */

.modal-confirm-submit {
  padding-top: 200px;
}

.modal-confirm-header {
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}

.modal-header {
  background: $main-blue;
}

.modal-confirm-body {
  overflow: auto;
  width: 300px;

  hr {
    margin: 0px 0px 3px 0px;
  }

  .time-error-message {
    color: red;
    text-align: right;
    font-size: 1.2rem;
    padding-right: 9px;
  }

  .time-question {
    margin-bottom: 3px;
  }

  .time-summary {
    overflow: auto;
    padding-bottom: 3px;
    .form-control {
      width: 30px;
      padding: 2px;
      height: 23px;
      text-align: right;
    }

    .time-label {
      float: left;
    }

    .time-report {
      float: right;

      .time-unit-group {
        float: left;
        width: 70px;
        .time-value-float {
          width: 30px;
          overflow: auto;
          margin-right: 4px;
          float: left;
          .time-value {
            float: right;
            padding-right: 2px;
          }
        }
        .time-unit {
          font-size: 1.2rem;
        }
      }
    }
  }
}

.modal-confirm-text {
  margin-bottom: 10px;
  font-size: 1.5rem;
}

/* Fixed-location informational boxes */

.fixed-infobox-outer {
  margin: 20px auto;
  position: fixed;
  top: 160px;
  left: 0;
  right: 0;
  z-index: 1009;
}

.fixed-infobox {
  display: block;
  text-align: center;
  width: 40%;
  margin: 0 auto;
  padding: 10px;
  border-radius: 5px;
}

.website-iframe {
  width: 100%;
  height: 400px;
}

.iframe-title {
  font-size: 18px;
  padding-right: 10px;
}

.iframe-header {
  margin-bottom: 10px;
}

.save-message {
  display: inline-block;
  position: relative;
  left: 15px;
  color: white;
}

/* Task view */
.task-view {
  font-size: 1.5rem;
  position: relative;
  /* Task view*/
  .topbar-overview {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-size: 1.8rem;
    line-height: 2rem;
    background-color: $light-gray;
    box-shadow: 0 1px 3px $light-gray;
    color: lighten($dark-gray, 10);
    height: $topbar-height;
    .topbar-leader {
      float: left;
      background-color: lighten($dark-gray, 10);
      position: relative;
      color: white;
      z-index: 2;
      .arrow-wrapper {
        position: absolute;
        right: -$topbar-height;
        .arrow-with-shadow {
          width: $topbar-height;
          height: $topbar-height;
          position: relative;
          right: 0;
          overflow: hidden;
        }
        .arrow-with-shadow:after {
          content: "";
          position: absolute;
          width: $topbar-height / $sqrt-2;
          height: $topbar-height / $sqrt-2;
          @include vendor-prefix(transform, rotate(45deg));
          top: 0.25 * $topbar-height / $sqrt-2;
          left: -0.5 * $topbar-height / $sqrt-2;
          box-shadow: 1px -1px 3px darken($light-gray, 5);
          background-color: lighten($dark-gray, 10);
        }
      }
      .project-overview {
        padding: $panel-padding;
        margin-left: $panel-margin;
        background-color: lighten($dark-gray, 10);
        float: left;
        .workflow {
          float: left;
          font-weight: bold;
          padding-right: $panel-padding;
        }
      }
    }
    .topbar-follower {
      z-index: 1;
      padding-top: $panel-padding;
      padding-bottom: $panel-padding;
      float: left;
      .task-overview {
        font-weight: bold;
        margin-left: $topbar-height / 2;
        padding-left: $topbar-height / 2;
      }
    }
  }
  .iframe-header {
    a {
      color: $main-blue;
      &:hover, &:focus, &:visited {
        color: $main-blue;
        text-decoration: underline;
      }
    }
  }
  .reminders-title {
    padding: 10px 0;
    font-weight: bold;
  }
  .task-actions-wrapper {
    position: absolute;
    left: 0;
    right: 0;
    background-color: rgb(128, 128, 128);
    .task-actions {
      margin-left: $panel-margin;
      margin-right: $panel-margin;
      font-size: 1.3em;
      .btn {
        font-size: 1em;
        &:not(:first-child) {
          margin-left: $button-margin;
        }
      }
    }
  }
}
