@import "variables";

:root, .light-theme  {
  --bg-color: #f9f9f9;
  --text-color: #444;
  --link-color: #02a8f3;
  --head-bg-panel: #212121;
  --head-text-color: #fff;
  --code-bg-color: rgba(0,0,0,0.04);
  --code-text-color: inherit;
  --content-font-size: 18px;
  --content-line-height: 36px;
  --search-panel-bg-color: #fff;
  --search-panel-shadow: 0 0 2px rgba(0,0,0,.2);
  --search-panel-shadow-fixed: 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.2);
  --search-text-color: #434343;
  --grid-header-text-color: #555;
  --grid-text-color: #555;
  --grid-border-top: 1px solid rgba(0,0,0,0.08);
  --no-result-text-color: #666;
  --item-border: 2px solid transparent;
  --item-border-hover: 2px solid transparent;
  --item-border-active: 2px solid #03a9f4;
  --item-bg-hover: #f2f2f2;
  --item-bg-active: transparent;
  --item-badge-bg-color: #fe6363;
  --item-badge-text-color: #fff;
  --item-icon-color: #555;
  --item-text-color: var(--item-icon-color);
  --item-search-match-bg-color: #FFFF4F;
  --item-search-match-text-color: var(--item-text-color);
  --snackbar-header-text-color: #fff;
  --snackbar-header-bg-color: #03a9f4;
  --snackbar-body-bg-color: #eee;
  --snackbar-code-text-color: #434343;
  --snackbar-content-shadow: 0 -2px 5px rgba(0,0,0,.1);
  --snackbar-title-text-color: #02a8f3;
  --snackbar-comment-text-color: #434343;
  --footer-bg-color: #eee;
  --grid-container-margin: 25px;
  --grid-block-margin: 15px;
  --grid-item-margin: 0px;
  --grid-item-margin-bottom: 0px;
  --grid-item-padding: 6px;
  --grid-item-width: 90px;
  --snackbar-content-padding: 0;
  --container-padding: 25px;
}

.dark-theme {
  --dark2: #0d1117;
  --dark1: #141921;
  --bg-color: var(--dark1);
  --head-bg-panel: var(--dark1);
  --search-panel-bg-color: var(--dark2);
  --footer-bg-color: var(--dark2);
  --snackbar-body-bg-color: var(--dark2);
  --text-color: #c9d1d9;
  --head-text-color: #c9d1d9;
  --item-icon-color: #c9d1d9;
  --code-bg-color: rgba(255,255,255,0.04);
  --snackbar-comment-text-color: #ccc;
  --link-color: #07b1ff;
  --code-text-color: inherit;
  --search-panel-shadow: 0 0 2px rgba(0,0,0,.2);
  --search-panel-shadow-fixed: 0 4px 5px 0 rgba(0,0,0,0.14), 0 1px 10px 0 rgba(0,0,0,0.12), 0 2px 4px -1px rgba(0,0,0,0.2);
  --search-text-color: #f0f6fc;
  --grid-header-text-color: #f0f6fc;
  --grid-text-color: #c9d1d9;
  --grid-border-top: 1px solid rgba(255,255,255,0.06);
  --no-result-text-color: #f0f6fc;
  --item-border-active: 2px solid #03a9f4;
  --item-bg-hover: rgba(255,255,255,0.05);
  --item-badge-bg-color: #fe6363;
  --item-badge-text-color: #fff;
  --item-text-color: var(--item-icon-color);
  --item-search-match-bg-color: #0089ff;
  --item-search-match-text-color: var(--item-text-color);
  --snackbar-header-text-color: #fff;
  --snackbar-header-bg-color: #0089ff;
  --snackbar-code-text-color: #f0f6fc;
  --snackbar-content-shadow: 0 -2px 5px rgba(0,0,0,.1);
  --snackbar-title-text-color: #07b1ff;
  --sidebar-link-color: #f0f6fc;
  --sidebar-link-active-color: #03a9f4;
}

html, body {
  background-color: var(--bg-color);
  border: 0;
  padding: 0;
  margin: 0;
  height: 100%;
  width: 100%;
  color: var(--text-color);
  font-family: RobotoDraft, Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

*, *:before, *:after {
  box-sizing: border-box;;
}

* {
  font-family: RobotoDraft, Roboto, sans-serif;
}

a {
  color: var(--link-color);
  text-decoration: none;
  &:hover {
    text-decoration: underline;
  }
  &, &:hover {
    outline: 0;
  }
}

#head-panel h1, #head-panel .repo-link {
  font-family: 'Rubik', sans-serif;
}

#head-panel {
  background-color: var(--head-bg-panel);
  padding: 14px 0 9px;
  overflow: hidden;
  h1 {
    color: var(--head-text-color);
    font-size: 33px;
    font-weight: normal;
    line-height: 37px;
    margin: 0px;
    display: inline-block;
    &:after {
      letter-spacing: 0.5em;
      content: "\00a0";
    }
  }
  .logo {
    width: 40px;
    display: inline-block;
    vertical-align: sub;
    margin-right: 14px;
  }
  .buttons {
    display: inline-block;
    color: transparent;
  }
  .repo-link {
    color: var(--head-text-color);
    font-size: 15px;
    margin-left: 54px;
    text-decoration: none;
    &:hover {
      text-decoration: underline;
    }
  }
}

@media (max-width: $media-md) {
  #head-panel {
    h1 {
      display: block;
      white-space: nowrap;
      overflow: visible;
      font-size: 30px;
      margin: 0 0 7px;
    }
    .buttons {
      margin-right: 5px;
    }
    .repo-link-wrap {
      display: inline-block;
      vertical-align: top;
      .repo-link {
        margin-left: 0;
      }
    }
  }
}

.container {
  width: 100%;
  padding: 0 var(--container-padding);
  height: 100%;
}

.wrap {
  min-height: 100%;
  height: auto;
  margin: 0 auto -120px;
  padding: 0 0 160px;
}

.content {
  margin: 100px 0 40px;
  p {
    line-height: var(--content-line-height);
    font-size: var(--content-font-size);
    margin-top: 2px;
    margin-bottom: 10px;
  }
  code {
    padding: 0.2em 0;
    margin: 0;
    font-size: 85%;
    background-color: var(--code-bg-color);
    color: var(--code-text-color);
    border-radius: 3px;
    &:before, &:after {
      letter-spacing: -0.2em;
      content: "\00a0";
    }
  }
}

.clear-icon {
  cursor: pointer;
}

@media (max-width: $media-md) {
  .clear-icon {
    margin: -10px!important;
    padding: 10px!important;
    box-sizing: content-box!important;
  }
}

#search-panel {
  height: $search-panel-height;
  width: 100%;
  background-color: var(--search-panel-bg-color);
  box-shadow: var(--search-panel-shadow);
  position: absolute;
  z-index: 7;
  &.top-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: var(--search-panel-shadow-fixed);
  }
  .container {
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -ms-flex-direction: row;
    -webkit-flex-direction: row;
    flex-direction: row;
    -ms-flex-align: center;
    -webkit-align-items: center;
    align-items: center;
    height: 100%;
  }
  .search-icon {
    display: inline-block;
    vertical-align: middle;
    background-repeat: no-repeat;
    fill: currentcolor;
    position: relative;
    opacity: 0.5;
    &, .mdi {
      height: 24px;
      width: 24px;
      font-size: 24px;
    }
    &.search-magnify {
      pointer-events: none;
      position: absolute;
      margin-left: 10px;
    }
    &.clear-icon {
      &:hover {
        opacity: 1;
      }
    }
  }
  #search {
    background-color: var(--search-panel-bg-color);
    color: var(--search-text-color);
    font-size: 20px;
    padding: 8px 0 8px 54px;
    width: auto;
    border: none;
    outline: none;
    -ms-flex: 1 1 0.000000001px;
    -webkit-flex: 1;
    flex: 1;
    -webkit-flex-basis: 0.000000001px;
    flex-basis: 0.000000001px;
  }
}

#grid-container {
  padding: 0 0 70px;
  min-height: 900px;
  margin-top: var(--grid-container-margin);
  .grid {
    margin: var(--grid-block-margin) calc(-1 * var(--grid-item-margin)) 0 calc(-1 * var(--grid-item-margin));
    &:after {
      clear: both;
      display: table;
      content: " ";
    }
  }
  &:after {
    clear: both;
    display: table;
    content: " ";
  }
  h2 {
    color: var(--grid-header-text-color);
    font-size: 16px;
    font-weight: normal;
    display: block;
    padding: var(--grid-container-margin) 0 0;
    margin: 10px 0;
    position: relative;
    &:before {
      content: '';
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      border-top: var(--grid-border-top);
    }
  }
  .no-results {
    text-align: center;
    color: var(--no-result-text-color);
    font-size: 24px;
    padding: 150px 0;
  }
  .item-container {
    display: block;
    width: var(--grid-item-width);
    height: 110px;
    margin: 0 var(--grid-item-margin) var(--grid-item-margin-bottom);
    padding: 15px 0 0;
    cursor: pointer;
    background: transparent;
    float: left;
    transition: background 200ms ease-out;
    border-radius: 2px;
    border: var(--item-border);
    &:hover {
      background: var(--item-bg-hover);
      border: var(--item-border-hover);
    }
    &.selected {
      background: var(--item-bg-active);
      border: var(--item-border-active);
    }
    .item {
      -ms-flex-align: center;
      -webkit-align-items: center;
      align-items: center;
      -ms-flex-direction: column;
      -webkit-flex-direction: column;
      flex-direction: column;
      display: -ms-flexbox;
      display: -webkit-flex;
      display: flex;
      position: relative;
      .item-badge {
        position: absolute;
        right: 8px;
        top: -12px;
        padding: 2px 3px;
        border-radius: 2px;
        background: var(--item-badge-bg-color);
        color: var(--item-badge-text-color);
        font-size: 10px;
        font-weight: 500;
      }
      > i {
        font-size: 48px;
        width: 48px;
        height: 48px;
        color: var(--item-icon-color);
      }
      .caption {
        color: var(--item-text-color);
        font-size: 11px;
        margin-top: 16px;
        overflow: hidden;
        text-align: center;
        text-overflow: ellipsis;
        white-space: nowrap;
        word-break: break-all;
        width: calc(var(--grid-item-width) - var(--grid-item-padding) * 2);
        z-index: 1;
        > i {
          position: relative;
          z-index: 1;
          color: var(--item-search-match-text-color);
          background: var(--item-search-match-bg-color);
          padding: 0 1px;
          font-size: 11px;
          margin: 0px -2px;
          line-height: 11px;
          border-radius: 2px;
          border: 1px solid var(--item-search-match-bg-color);
          display: inline;
          font-style: normal;
        }
        > span {
          position: relative;
          z-index: 2;
          display: inline;
        }
      }
    }
  }
}

#snackbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  .snackbar-header {
    color: var(--snackbar-header-text-color);
    height: $search-panel-height;
    background-color: var(--snackbar-header-bg-color);
    padding: 19px var(--container-padding) 20px;
    line-height: 26px;
    overflow: hidden;
    .left-side i {
      width: 24px;
      height: 24px;
      font-size: 24px;
      float: left;
    }
    .caption {
      font-size: 16px;
      margin-left: 15px;
    }
    .right-side {
      //float: right;
      .mdi {
        font-size: 22px;
        margin-top: 1px;
      }
      .caption {
        font-weight: 500;
        margin-left: 10px;
        text-transform: uppercase;
        font-size: 14px;
      }
    }
  }
  .clear-icon {
    float: right!important;
    margin-left: 10px;
  }
  p, p a, .code {
    font-family: 'Roboto Mono', monospace;
    font-size: 13px;
    line-height: 24px;
    background-color: var(--snackbar-body-bg-color);
  }
  .code {
    color: var(--snackbar-code-text-color);
    border: 0;
    cursor: default;
    display: block;
    outline: none;
    padding: 0;
    height: 24px;
    resize: none;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    &.comment {
      opacity: 0.5;
    }
  }
  .snackbar-content {
    background-color: var(--snackbar-body-bg-color);
    padding: var(--snackbar-content-padding) 24px;
    overflow: hidden;
    -webkit-transition: -webkit-transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--snackbar-content-shadow);
    h2, p {
      font-size: 13px;
      line-height: 24px;
      font-family: 'Roboto Mono', monospace;
    }
    h2 {
      color: var(--snackbar-title-text-color);
      display: inline-block;
      font-weight: 500;
      margin: 0;
    }
    p {
      margin: 0;
      color: var(--snackbar-comment-text-color);
    }
    .col {
      margin: 16px 0;
    }
  }
  .snackbar-header, .snackbar-content {
    margin: 0 calc(-1 * var(--container-padding)) 0;
  }
}

#footer {
  background: var(--footer-bg-color);
  padding: 20px 0;
  min-height: 120px;
}

#sidebar {
  display: none;
  width: $sidebar-width;
  background: #12171e;
  position: absolute;
  height: 100%;
  overflow: auto;
  z-index: 2;
  right: 0;
  border-left: 1px solid #0d1016;
  margin-top: $search-panel-height;
  font-size: 14px;
  padding-bottom: 100%;
  box-sizing: content-box;

  .sidebar-block {
    margin: 24px 0;
    border-bottom: 1px solid #0d1117;
    padding-bottom: 8px;
    > h4 {
      padding: 0 24px;
      margin-bottom: 8px;
      text-transform: uppercase;
      font-size: 11px;
      color: #999;
    }
  }
  ul {
    display: block;
    padding: 4px 0;
    margin: 0;
    list-style: none;
    li {
      list-style: none;
      display: flex;
      flex-direction: row;
      padding: 12px 24px;
      line-height: 24px;
      margin: 0;
      color: var(--sidebar-link-color);
      fill: var(--sidebar-link-color);
      cursor: pointer;
      .label {
        margin-left: 10px;
      }
      .icon {
        width: 24px;
        height: 24px;
        text-align: center;
        line-height: 24px;
        font-size: 23px;
      }
      &:hover, &.active {
        background: rgba(0,0,0,0.1);
      }
      &.active {
        color: var(--sidebar-link-active-color);
        fill: var(--sidebar-link-active-color);
      }
    }
  }
}

.top-fixed + #sidebar {
  position: fixed;
  top: 0;
}

@media (min-width: $media-md) {
  #sidebar {
    display: block;
  }

  #sidebar + .container {
    width: calc(100% - #{$sidebar-width});
    margin-right: $sidebar-width;
    padding-right: calc(var(--container-padding) / 2);

    #grid-container {
      h2 {
        &:before {
          right: calc(var(--container-padding) / 2);
        }
      }
    }
  }
}

@media (max-width: #{$media-md - 1}) {
  .hide-mobile {
    display: none!important;
  }
}

@media (max-width: 606px) {
  .grid {
    display: block;
    .item-container {
      display: block;
      overflow: hidden;
    }
  }
}

@media (min-width: $media-sm) and (max-width: 606px) {
  .grid {
    .item-container {
      width: 20%!important;
      max-width: 20%;
    }
  }
}

@media (min-width: $media-xs) and (max-width: #{$media-sm - 1}) {
  .grid {
    .item-container {
      width: 25%!important;
      max-width: 25%;
    }
  }
}

@media (max-width: #{$media-xs - 1}) {
  .grid {
    .item-container {
      width: 33%!important;
      max-width: 33%;
    }
  }
}

@media (min-width: $media-md) {
  .flex-snackbar {
    flex-direction: row;
    display: flex;
  }
  .col {
    width: 50%;
  }
  .container {
    margin: 0 auto;
  }
  .snackbar-header, .snackbar-content {
    margin: 0 -10px 0;
    .col:first-child {
      p {
        max-width: 510px;
        padding-right: 30px;
      }
    }
  }
}

.uppercase {
  text-transform: uppercase;
}

.d-flex {
  display: -ms-flexbox !important;
  display: flex !important;
}

.justify-content-between {
  -ms-flex-pack: justify !important;
  justify-content: space-between !important;
}

.flex-row {
  -ms-flex-direction: row !important;
  flex-direction: row !important;
}
