@use 'sass:math';

$bg-color: #fff;
$basic-dark-color: #56aa1c;
$border-width: 4px;
$basic-spinner-dimensions: 50px;
$main-spinner-dimensions: $basic-spinner-dimensions - $border-width * 2;
$small-spinner-dimensions: $main-spinner-dimensions * 0.7;

html, body, #app, .app-container {
  width: 100%;
  min-height: 100%;
  background: $bg-color;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
}

a {
  text-decoration: none;
  color: $basic-dark-color;

  &:hover {
    color: darken($color: $basic-dark-color, $amount: 10%)
  }
}

.app-container {
  flex: 1;
  position: relative;
}

.app-notifications {
  position: fixed;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  right: 2em;
  top: 1em;
}

.app-container, #app {
  display: flex;
  flex-direction: column;
}

.app-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  padding: 0 2em;
}

.app-header {
  display: flex;
  flex-direction: column;
  padding: 0 2em;
  margin-bottom: 1em;
}

.app-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
}

.app-footer {
  font-size: 0.8em;
  text-align: center;
  margin: 1em 0;
}

ul.app-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: row;
  align-content: space-between;

  > li {
    flex: 1;
    text-align: center;
  }
}

.spinner {
  position: relative;
  width: $basic-spinner-dimensions;
  height: $basic-spinner-dimensions;
  font-size: 0;

  &:before,
  &:after {
    content: "";
    display: block;
    position: absolute;
    border-width: 4px;
    border-style: solid;
    border-radius: 50%;
  }
}

.spinner.circles {
  @keyframes rotate-animation {
    0% {
      transform: rotate(0deg);
    }

    100% {
      transform: rotate(360deg);
    }
  }

  @keyframes anti-rotate-animation {
    0% {
      transform: rotate(0deg);
    }

    100% {
      transform: rotate(-360deg);
    }
  }

  &:before {
    width: $main-spinner-dimensions;
    height: $main-spinner-dimensions;
    border-bottom-color: $basic-dark-color;
    border-right-color: $basic-dark-color;
    border-top-color: rgba($basic-dark-color, 0);
    border-left-color: rgba($basic-dark-color, 0);
    top: 0;
    left: 0;
    animation: rotate-animation 1s linear 0s infinite;
  }

  &:after {
    width: $small-spinner-dimensions;
    height: $small-spinner-dimensions;
    border-bottom-color: $basic-dark-color;
    border-right-color: $basic-dark-color;
    border-top-color: rgba($basic-dark-color, 0);
    border-left-color: rgba($basic-dark-color, 0);
    top: math.div($main-spinner-dimensions - $small-spinner-dimensions, 2);
    left: math.div($main-spinner-dimensions - $small-spinner-dimensions, 2);
    animation: anti-rotate-animation 0.85s linear 0s infinite;
  }
}

.tiles {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  margin: -1em;

  .tile {
    width: 200px;
    height: 150px;
    border: 1px solid #ccc;
    box-shadow: 0 5px 5px #000;
    margin: 1em;
    padding: 1em;
    display: flex;
    flex-direction: column;
  }
}

.notification {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  padding: 0.8em;
  background-color: $bg-color;
  max-width: 500px;
  position: relative;
  box-shadow: 1px 7px 14px -5px rgba(0,0,0,0.2);

  &+& {
    margin-top: 1em;
  }

  &.success:before {
    background-color: #2BDE3F;
  }

  &.error:before {
    background-color: #e7431a;
  }

  &.info:before {
    background-color: #1D72F3;
  }

  &.warning:before {
    background-color: #FFC007;
  }

  &:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
  }

  .notification-content {
    .notification-title {
      color: #3e3e3e;
      font-weight: 700;
      margin-top: 0;
      margin-bottom: 8px;
    }

    .notification-message {
      font-size: 14px;
      margin-top: 0;
      margin-bottom: 0;
      color: #878787;
    }
  }

  .notification-close {
    width: 14px;
    cursor: pointer;
    height: 14px;
    fill: #878787;
    margin-left: 1.2em;
    margin-right: 1em;
  }
}

.search {
  margin-bottom: 2em;
  position: relative;

  input[type=search] {
    font-size: 1em;
    border: 1px solid transparent;
    background-color: #f1f1f1;
    padding: 10px;
    font-size: 16px;
    width: 250px;
    box-sizing: border-box;
  }

  input[type=search]:focus + .search-results {
    display: block;
  }

  .search-results {
    display: none;
    position: absolute;
    z-index: 99;
    top: 100%;
    width: 250px;
    left: 0;
    box-sizing: border-box;
    background: #f0f0f0;
    padding: 1px;
  }

  .search-results-item {
    padding: 10px;
    cursor: pointer;
    background-color: #fff;
    border-bottom: 1px solid #d4d4d4;
  }

  .search-results-item:hover {
    background-color: #e9e9e9;
  }

  .search-results-loading {
    padding: 30px;
    background-color: #fff;
  }
}

.form-row {
  margin: 1em;

  label {
    display: block;
    margin-bottom: 0.2em;
  }

  input {
    padding: 0.3rem;
    font-size: 1rem;
  }

  button {
    padding: 0.5em 1em;
    border: 1px solid black;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
  }

  button:disabled {
    border: 1px solid #ccc;
    color: #ccc;
    cursor: default;
  }
}
