/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

/* Enduser color palette
============================================================================= */
/* https://coolors.co/718a99-6a93ba-9cc9e7-a3ccf7-b9d8f7 */
$palette_darker: #BD2130;
$palette_dark: #6a93ba;
$palette_base: #dc3545;
$palette_light: #a3ccf7;
$palette_lighter: #b9d8f7;
$palette_white: #ffffff;

$palette_error: #f79999;
$palette_warning: #f7c899;
$palette_disabled: rgba(189, 201, 206, 0.73);


/* SCSS Methods
============================================================================= */

@mixin shadow($args...) {
  -moz-box-shadow: $args;
  -webkit-box-shadow: $args;
  -o-box-shadow: $args;
  box-shadow: $args;
}

@mixin flex() {
  display: -ms-flexbox;
  display: -webkit-flex;
  display: flex;
}

@mixin flex_align_items($value) {
  -ms-flex-align: $value;
  -webkit-align-items: $value;
  -webkit-box-align: $value;
  align-items: $value;
}

@mixin transition($args...) {
  -webkit-transition: $args;
  -moz-transition: $args;
  -ms-transition: $args;
  -o-transition: $args;
  transition: $args;
}

@mixin transform($args...) {
  -webkit-transform: $args;
  -moz-transform: $args;
  -ms-transform: $args;
  -o-transform: $args;
  transform: $args;
}


/* Breakpoints */
$tablet-width: 768px;
$desktop-width: 1024px;

@mixin phone {
  @media (max-width: #{$tablet-width - 1px}) {
    @content;
  }
}

@mixin tablet {
  @media (min-width: #{$tablet-width}) and (max-width: #{$desktop-width - 1px}) {
    @content;
  }
}

@mixin desktop {
  @media (min-width: #{$desktop-width}) {
    @content;
  }
}


/* General
============================================================================= */

body, html {
  width: 100%;
  background-image: linear-gradient($palette_darker, $palette_dark);
}

body {
  overflow-x: hidden;
  overflow-y: auto;

  > .wrapper {
    height: 100%;
    max-width: 1280px;

    margin: 0 auto;
    @include flex;
    @include flex_align_items(center);
  }

  > .wrapper .content-wrapper {
    width: 100%;
    margin: 0 2rem;
  }
}


/* Login
============================================================================= */

.btn {
  &.btn-signin {
    background-color: $palette_base !important;

    &:hover, &:active, &:focus {
      background-color: $palette_darker !important;
    }
  }

  &.btn-sso {
    &:hover, &:active, &:focus {
      background-color: $palette_white !important;
    }
  }
}

.form-signin {
  .form-control:focus {
    border-color: $palette_base;
    @include shadow(inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px $palette_dark);
  }
}

.login_link {
  margin: 8px 0;

  a {
    text-decoration: none;
  }
}


/* Wizard layout
============================================================================= */

.content-wrapper {
  .wizard-form {
    height: auto;
    /*min-height: 446px;*/
    min-height: 530px;

    form {
      height: 530px;
    }

    .captcha_block {
      text-align: center;
      padding-top: 8rem;

      div {
        padding-bottom: 15px;
      }

      #captcha_image {
        font-size: 1.6rem;
      }

      #captcha_message {
        font-size: 1.45rem;
      }
    }

    .wizard-header {
      padding: 10px;

      a {
        text-decoration: none;
        color: $palette_dark !important;
      }
    }

    .wizard-view {
      .box-body {
        overflow-y: auto;
        max-height: 355px;
        padding: 0 10px 20px 0;
      }
    }
  }

}

form .wizard-buttons {
  display: table;
  height: 65px;
  width: 100%;
  padding: 6px 0px 5px 0px;

  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;

  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  background-color: $palette_darker;

  > div {
    display: table-cell;
    vertical-align: middle;
  }

  .float-start {
    padding-left: 15px;
  }

  .float-end {
    padding-right: 15px;
  }
}

.btn-primary {
  &:not(.btn-signin) {
    color: inherit;
    background-color: $palette_light;
    border-color: $palette_lighter;

    &:hover,
    &.focus,
    &:focus,
    &.active,
    &:active {
      color: inherit;
      background-color: $palette_lighter;
      border-color: transparent;
    }
  }
}


.callout-warning {
  background-color: $palette_warning;
  padding: 15px;
  margin-bottom: 10px;
}

.callout-warning label {
  margin-bottom: 0;
}

/* From AdminLTE */
.box {
  position: relative;
  border-radius: 3px;
  background: #ffffff;
  border-top: 3px solid #d2d6de;
  margin-bottom: 20px;
  width: 100%;
  @include shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.box.box-primary {
  border-top-color: $palette_dark;
}


/* Form elements
============================================================================= */

/* 
* Disabled elements
* ------------------------------ */
.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
  background-color: $palette_disabled;
}


/* 
* Select / Dropdown
* ------------------------------ */
.bootstrap-select {
  > .dropdown-toggle {
    background: rgba(106, 147, 186, 0.34);
  }

  > .dropdown-menu {
    li.selected {
      background: rgba(106, 147, 186, 0.34) !important;
    }
  }
}


/* 
* Checkbox, Radio 
* ------------------------------ */
/* Basic styles */
.checkbox label,
.radio label {
  position: initial;
  display: inline-block;
  padding: 0 0 0 2em;
  height: 1.5em;
  line-height: 1.5;
  cursor: default;
}

.checkbox label::before,
.checkbox label::after,
.radio label::before,
.radio label::after {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 1.5em;
  height: 1.5em;
}

.checkbox label::before,
.radio label::before {
  content: " ";
  border: 2px solid #bdc3c7;
  border-radius: 20%;
}

.checkbox input[type=checkbox],
.checkbox-inline input[type=checkbox],
.radio input[type=radio],
.radio-inline input[type=radio] {
  margin-left: 0;
}

input {
  &[type="checkbox"],
  &[type="radio"] {
    position: absolute;
    opacity: 0;

    z-index: 1;
    width: 50px;
    height: 20px;
    cursor: pointer;
  }

  /* Checkbox */
  &[type="checkbox"] + label::after {
    content: "\2713";
    color: #ffffff;
    line-height: 1.5;
    text-align: center;
  }

  &[type="radio"] + label::before {
    border-radius: 50%;
  }

  &[type=radio] + label::after {
    content: " ";
    top: .25em;
    left: .25em;
    width: 1em;
    height: 1em;
    background: #fff;
    border: .2em solid #2c3e50;
    border-radius: 50%;
  }

  /* Radio */
  /* :checked */
  &[type="checkbox"]:checked + label::before, &[type="radio"]:checked + label::before {
    background: $palette_dark;
    border-color: $palette_base;
  }

  &[type="checkbox"] + label::after, &[type=radio] + label::after {
    @include transform(scale(0));
  }

  &[type="checkbox"]:checked + label::after, &[type=radio]:checked + label::after {
    @include transform(scale(1));
  }
}

/* Transition */
.checkbox {
  label {
    &::before, &::after {
      @include transition(.25s all ease);
    }
  }
}

.radio {
  label {
    &::before, &::after {
      @include transition(.25s all ease);
    }
  }
}


/* 
* Select
* ------------------------------ */
option {
  &:focus, &:active, &:checked {
    color: $palette_base !important;
    background: $palette_base !important;
  }
}


/* Navbar
============================================================================= */

.enduser_navbar {
  position: absolute;
  width: 100%;
  z-index: 10;
  align-self: flex-start;
  /*max-width: 768px;*/
  min-width: 415px;
  /*width: auto;*/
  /*padding-right: 20px;*/
  background-color: $palette_dark;
  border-color: $palette_base;

  .dropdown-menu {
    a {
      height: auto;
    }

    > li {
      > a {
        &:focus,
        &:hover {
          background-color: $palette_light;
        }
      }
    }
  }

  .navbar-brand {
    padding: 2px 26px 2px 15px;

    img {
      width: 50px;
      height: 55px;
    }
  }

  .navbar-nav > .active > a,
  .navbar-nav > .active > a:focus,
  .navbar-nav > .active > a:hover,
  .navbar-nav > li > a:focus,
  .navbar-nav > li > a:hover,
  .navbar-toggle:focus,
  .navbar-toggle:hover {
    background-color: $palette_lighter;
  }

  .navbar-nav {
    > .open > a,
    > .open > a:focus,
    > .open > a:hover {
      background-color: $palette_light;
    }

    > li {
      &:not(.active):not(:hover):not(.open) {
        > a {
          &:not(:focus) {
            color: #ffffff;
          }

          @include transition(.25s all ease);
        }
      }
    }

    @include phone {
      .dropdown {
        a {
          &.dropdown-toggle {
            &:not(:focus) {
              color: #ffffff;
            }
          }
        }

        &.open {
          .dropdown-menu {
            > li > a {
              color: #ffffff;
            }
          }
        }
      }
    }
  }

  &::before {
    content: "";
    display: inline-block;
    position: absolute;
    border: 28px solid black;
    border-color: transparent $palette_base transparent transparent;
    top: 0px;
    right: 0;
  }

  &::after {
    content: "";
    display: inline-block;
    position: absolute;
    border: 28px solid white;
    border-color: transparent $palette_darker transparent transparent; /* use the background color here */
    top: 0px;
    right: -1px; /* 1px less than the other "before" element */
  }

  @include phone {
    min-width: 290px;

    a {
      height: 45px;
    }

    .navbar-toggle {
      margin-right: 6rem;

      &:not(:focus) {
        .icon-bar {
          background-color: #ffffff;
        }
      }
    }

    .navbar-brand {
      img {
        height: 50px;
      }
    }
  }

  .subnav {
    a {
      padding-left: 30px;
    }
  }

  .navbar-right {
    padding-right: 4rem;

    .btn-navbar-right {
      i {
        font-size: 26px;
      }

      &:hover {
        cursor: pointer;
      }
    }
  }
}


/* Accessibility
============================================================================= */


/* Password Reset / Confirm Password Reset / Must Change Password
============================================================================= */

.password_reset_wrapper {

  @include desktop {
    padding-top: 25px;
    padding-bottom: 25px;
  }

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

  form {
    text-align: center;

    .password_reset_buttons {
      padding-top: 30px;
    }
  }
}

.enduser_fieldset {
  padding: 0 10px;
}

#mcp_logo {
  padding-top: 20px;
  padding-bottom: 15px;
}
