@charset "UTF-8";
@import "../../../../../../lib/craftcms-sass/mixins";
@import "modal";
@import "./upgrade-craft";

/* General */

$sidebarWidth: 225px;
$detailsWidth: 350px;
$minFullUiWidth: 1224px;
$minHorizontalUiWidth: $minFullUiWidth - $sidebarWidth;
$minLargeScreenWidth: 1824px;

#main-container {
  position: relative;
}

#main-content #content {
  position: relative;
}

.input.success input {
  border-color: $successColor;
}

.input.errors .select:not(.selectize) select {
  box-shadow: inset 0 0 0 1px transparent, 0 0 0 1px $errorColor, 0 1px 1px rgba(0, 0, 0, 0.1);
}

/* Lightswitch */

.pluginstore-lightswitch {
  position: relative;
  display: block;
  user-select: none;
  width: 34px;
  height: 22px;

  input {
    position: absolute;
    opacity: 0;
  }

  .slider {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    cursor: pointer;
    background-color: #9da5af;
    -webkit-transition: .4s;
    transition: .4s;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
  }

  .slider:before {
    position: absolute;
    background-color: #fff;
    content: "";
    height: 20px;
    width: 20px;
    left: 1px;
    bottom: 1px;
    -webkit-transition: .1s;
    transition: .1s;
  }

  input:checked + .slider {
    background-color: #00b007;
  }

  input:focus + .slider,
  input:active + .slider {
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(51, 170, 255, 0.5), 0 0 2px #33aaff;
  }

  input:checked + .slider:before {
    -webkit-transform: translateX(12px);
    -ms-transform: translateX(12px);
    transform: translateX(12px);
  }

  .slider.round {
    border-radius: 34px;
  }

  .slider.round:before {
    border-radius: 50%;
  }
}

/* Plugin Store actions */

#pluginstore-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;

  & > * {
    margin-left: 18px !important;
  }

  #cart-button {
    svg {
      display: inline-block;
      width: 18px;
      height: 18px;
      vertical-align: middle;
      line-height: 0;
      margin-right: 3px;
    }

    svg {
      @include svg-mask($secondarySubmitColor);
    }

    &:hover svg {
      @include svg-mask($secondarySubmitHoverColor);
    }

    .badge {
      @include margin(0, 0, 0, -6px);
      position: relative;
      top: -1px;
      display: inline-block;
      flex-shrink: 1;
      padding: 0 6px;
      font-size: 11px;
      line-height: 16px;
      border-radius: 1em;
      background: $submitColor;
      color: #fff;
      box-shadow: 0 0 0 2px $bgColor;
    }
  }

  #craftid-account {
    &:hover {
      text-decoration: none;
    }

    .photo {
      svg {
        margin-right: 2px;
        width: 22px;
        height: 22px;
        border-radius: 100%;
        vertical-align: middle;
      }
    }

    &:hover .label {
      text-decoration: underline;
    }
  }

  #craftid-connect-form {
    .ssl-status {
      display: inline-block;
    }
  }
}

/* Graphic & Status */

#graphic {
  &.error {
    background-image: url(../images/error.png);
  }

  &.success {
    background-image: url(../images/success.png);
  }
}

#content {
  #graphic {
    display: block;
    margin: 200px auto 0;
  }

  #status {
    margin: 20px auto 250px;
    text-align: center;
    font-size: 16px;
    line-height: 20px;
    color: #666;
  }
}

@media only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (-moz-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min-device-pixel-ratio: 1.5),
only screen and (min-resolution: 1.5dppx) {
  #graphic {
    &.error {
      background-image: url(../images/error_2x.png);
      background-size: 48px;
    }
    &.success {
      background-image: url(../images/success_2x.png);
      background-size: 48px;
    }
  }
}

/* Grids */

.ps-grid-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  grid-gap: 40px;
}

.ps-grid-wrapper.has-sidebar {
  grid-template-columns: 1fr 4fr;
}

.ps-grid-plugins {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-auto-rows: 1fr;
  grid-gap: 20px;
  color: #444;
  margin-bottom: 20px;
}

.ps-grid-plugins-4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
}

.ps-grid-box {
  background-color: #fff;
  overflow: hidden;
}

@media only screen and (max-width: $minFullUiWidth - 1px) {
  .ps-grid-plugins-4 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media only screen and (min-width: $minLargeScreenWidth) {
  .ps-grid-plugins {
    grid-template-columns: 1fr 1fr 1fr 1fr;
  }

  .ps-grid-plugins-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  }
}

// Rearrange #main-content to flow vertically at < 999
@media only screen and (max-width: $minHorizontalUiWidth - 1px) {
  .ps-grid-wrapper.has-sidebar {
    grid-template-columns: 1fr;
  }
  .ps-grid-plugins {
    grid-template-columns: 1fr 1fr;
  }
  .ps-grid-plugins-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media only screen and (max-width: 673px) {
  .ps-grid-plugins {
    grid-gap: 10px;
  }

  .ps-grid-plugins {
    grid-template-columns: 1fr;
  }
  .ps-grid-plugins-4 {
    grid-template-columns: 1fr;
  }
}

/* Categories */

ul.categories {
  li {
    position: relative;

    &:before,
    &:last-child:after {
      position: absolute;
      border-top: 1px solid #eee;
      content: '';
      left: 0;
      right: 0;
    }

    &:before {
      top: 0;
    }

    &:last-child:after {
      bottom: 0;
    }

    a {
      display: block;
      position: relative;
      padding: 10px;
      padding-left: 31px;
      border-top: 1px solid transparent;
      border-bottom: 1px solid transparent;

      img {
        position: absolute;
        top: 7px;
        left: 0;
        width: 24px;
      }

      &:hover {
        text-decoration: none;
        z-index: 1;
        background: #fafafa;
        border-color: #eee;
      }
    }
  }

  li:hover + li:before {
    border-color: transparent;
  }
}

/* Category Selector */

.category-selector-btn {
  display: none;
  background: $lightBgColor;
  border: 1px solid $hairlineColor;
  padding: 10px 20px;
  border-radius: 4px;
  margin-bottom: 24px;
  position: relative;
  color: $secondarySubmitColor;

  &:before {
    @include icon;
    position: absolute;
    top: calc(50% - 10px);
    right: 0;
    font-size: 16px;
    width: 43px;
    line-height: 20px;
    content: 'downangle';
  }

  &:hover {
    text-decoration: none;
  }
}

.category-selector {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  background: #fff;
  z-index: 1000;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;

  .category-selector-header {
    a {
      padding: 14px 24px;
      display: block;
      color: #000;
      background: #fafafa;
      border-bottom: 1px solid #eee;

      &:hover {
        text-decoration: none;
      }
    }
  }

  .category-selector-body {
    overflow: auto;
    height: 100%;
    box-sizing: border-box;

    ul.categories {
      li {
        &:first-child a {
          border-top: 0;
        }

        &:first-child:before {
          display: none;
        }

        &:before,
        &:after {
          left: 1rem;
          right: 1rem;
        }

        a {
          padding-left: 55px;

          img {
            left: 24px;
          }
        }
      }
    }
  }
}

@media only screen and (max-width: $minHorizontalUiWidth - 1px) {
  .category-selector-btn {
    display: block;
  }

  .category-selector {
    display: flex;
  }

  .categories-wrapper {
    display: none;
  }
}

/* Plugin card */

.plugin-card {
  display: flex;
  padding: 20px;
  border: 1px solid #E3E5E8;
  border-radius: 5px;
  box-sizing: border-box;
  position: relative;

  &:hover {
    cursor: pointer;
    background: #fafafa;
  }

  .plugin-icon {
    margin-right: 14px;
  }

  .installed {
    position: absolute;
    top: 14px;
    right: 18px;
    color: #ccc;
  }
}

.ps-grid-plugins {
  .plugin-card {
    height: 100%;
  }
}

/* Plugin icon */

.plugin-icon,
.plugin-icon img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.plugin-icon-large,
.plugin-icon-large img {
  width: 72px;
  height: 72px;
  border-radius: 6px;
}

.plugin-icon .default-icon {
  display: inline-block;
  background: #eee;
  overflow: hidden;
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

/* Plugin search */

#container {
  position: static !important; /* #container hack required for modal overlays */
}

/* License status */

.license-status {
  &:before {
    border: 1px solid;
    border-radius: 9px;
    width: 17px;
    height: 17px;
    line-height: 17px;
    margin-right: 5px;
  }

  &.installed {
    color: $successColor;

    &:before {
      border-color: $successColor;
    }
  }

  &.licensed {
    color: $noticeColor;

    &:before {
      border-color: $noticeColor;
    }
  }
}

/* Developer card */

.developer-card {
  text-align: center;

  .spinner {
    margin-top: 48px;
  }

  .avatar {
    width: 120px;
    height: 120px;
    border-radius: 100%;
    background: #fafafa;
    display: inline-block;
    margin-top: 24px;
    margin-bottom: 12px;
    overflow: hidden;

    img {
      width: 100%;
    }
  }

  ul.links {
    margin-top: 36px;

    li {
      margin-bottom: 1em;

      a {
        display: block;
      }
    }
  }
}
