@import 'general';

$warning: hsl(355, 86%, 49%);
$ok: hsl(120, 77%, 27%);
$info: hsl(33, 100%, 50%);

%is-loading {
  pointer-events: none;
  opacity: 0.5;
  position: relative;

  &::before {
    content: '';
    z-index: 1;
    position: absolute;
    display: block;
    width: 1em;
    height: 1em;
    left: 50%;
    top: 50%;
    margin-top: -0.5em;
    margin-left: -0.5em;
    background-repeat: no-repeat;
    background-size: contain;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24'%3E%3Cpath d='M13.75 22a1.75 1.75 0 11-3.5 0 1.75 1.75 0 013.5 0zM12 0a2 2 0 10.001 4.001A2 2 0 0012 0zm10 10.75a1.25 1.25 0 010 2.5 1.249 1.249 0 110-2.5zM0 12a2 2 0 104 0 2 2 0 00-4 0zm19-8a1 1 0 11.002 2.002A1 1 0 0119 4zm0 13.5a1.5 1.5 0 11-.001 3.001A1.5 1.5 0 0119 17.5zM5 3a2 2 0 11-.001 4.001A2 2 0 015 3zm0 14a2 2 0 11-.001 4.001A2 2 0 015 17z'/%3E%3C/svg%3E");
    animation: rotate-center 600ms ease-in-out infinite both;
  }
}

%with-svg {
  background-color: #f7f7f7;
  border: 0;
  font-weight: normal;
  font-size: 18px;
  line-height: 1;
  position: relative;
  display: flex;
  align-items: center;
  padding: 6px;
  border-radius: 4px;
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 5%);

  &:hover {
    background-color: #dedede;
  }


  &.is-loading {
    opacity: 0.5;
    pointer-events: none;
  }

  span {
    display: none;
  }

  svg {
    display: inline-block;
    height: 1em;
    vertical-align: -0.125em;
    width: 1em;
  }
}

.dcaw-btn-w-icon {
  @extend %with-svg;

  &[data-action='delete'] {
    color: $warning;
  }

  &[data-action='share'] {
    color: #2362d5;
  }

  @at-root .is-default & {
    &[data-action='default'] {
      color: $info;
    }
  }
}

[class*='dcaw-'] {
  box-sizing: border-box;
}

.dcaw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;

  &__title {
    font-size: 26px;
    line-height: 1.25;
    color: #333;
  }

  .dcaw-btn-w-icon {
    span {
      font-size: 13px;
      margin-left: 4px;
      display: inline-block;
    }
  }
}

.dcaw-table-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  padding: 10px;
  //box-shadow: rgba(33, 35, 38, 0.1) 0 10px 10px -10px;

  &__title {
    margin: 0;
    color: #333;

    span {
      font-size: 12px;
      line-height: 16px;
      border-radius: 50%;
      display: inline-block;
      width: 16px;
      text-align: center;
      background-color: #108510;
      color: #fff;
      font-weight: normal;
      pointer-events: none;
    }

    em {
      font-size: 13px;
      opacity: 0.825;
      pointer-events: none;
    }
  }

  &__actions {
    margin-left: auto;
    display: grid;
    grid-auto-flow: column;
    gap: 6px;
  }
}

.dcaw-compare-btn,
.dcaw-wishlist-btn {
  display: inline-block;
  position: relative;

  svg {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    display: inline-block;
  }

  &.is-loading {
    @extend %is-loading;
    background: #eee;
    color: #eee;
  }

  &.is-active {
    svg {
      display: none;
    }

    &::after {
      content: '';
      display: inline-block;
      height: 1em;
      width: 1em;
      vertical-align: -0.125em;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='h-6 w-6' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 13l4 4L19 7'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: center;
      background-size: contain;
    }
  }
}

.dcaw-compare-count,
.dcaw-wishlist-count {
  font-size: 0.875em;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  &.is-empty {
    display: none;
  }
}

.dcaw-compare,
.dcaw-wishlist {
  &.is-loading {
    @extend %is-loading;
  }
}

.dcaw-wishlist-table {
  .dcaw-wishlist-btn {
    display: none;
  }
}

.dcaw-compare-table {
  .dcaw-compare-btn {
    display: none;
  }
}

.dcaw-products-grid {
  display: grid;
  list-style: none;
  padding: 0;
  margin: 0 0 16px;

  @media (min-width: 375px) {
    grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  }

  li {
    border-bottom: 1px solid #e9e9e9;
    border-right: 1px solid #e9e9e9;
  }
}

.dcaw-product-tile {
  padding: 16px;
  display: flex;
  flex-direction: column;
  position: relative;
  align-items: center;
  text-align: center;
  height: 100%;

  &__link {
    display: block;
    margin-bottom: 16px;

    img {
      height: 200px;
      width: auto;
      object-fit: contain;
    }
  }

  &__title {
    font-size: 18px;
    margin-bottom: 16px;

    a {
      text-decoration: none;

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

  &__buy {
    margin-top: auto;
  }

  &__compare,
  &__wishlist {
    position: absolute;
    right: 16px;
    top: 16px;
    padding: 0;
    border: 0;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: 50%;
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 5%);
    cursor: pointer;

    &.is-loading {
      @extend %is-loading;
      background: #eee;
      color: #eee;
      position: absolute;
    }
  }

  &__select {
    .dcaw-checkbox {
      position: absolute;
      left: 16px;
      top: 16px;
      background: #fff;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 5%);
      padding: 0;
      margin: 0;

      input:checked + span::before {
        left: 50%;
        transform: translate(-50%, -55%) rotate(42deg);
      }

      span::before {
        left: 50%;
        transform: translate(-50%, -50%);
      }
    }
  }
}

.dcaw-attributes-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.dcaw-attribute {
  $root: &;

  &__title {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9e9e9;
    cursor: pointer;
    position: relative;
    line-height: 1.5em;

    &::after {
      content: '';
      position: absolute;
      top: 0;
      right: 16px;
      width: 1em;
      height: 1.5em;
      display: block;
      background-repeat: no-repeat;
      background-position: center;
      background-size: contain;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' class='h-6 w-6' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
      transition: transform 250ms ease-in-out;
    }
  }

  &__values {
    padding-right: 8px;
  }

  dl {
    display: grid;
    grid-row-gap: 16px;
    margin-bottom: 16px;
    padding: 0;
    max-height: 9999px;
    transition: all 250ms ease-in-out;

    @media (min-width: 375px) {
      grid-template-columns: repeat(auto-fit, minmax(275px, 1fr));
    }
  }

  dt {
    font-weight: inherit;
    margin-bottom: 8px;
    font-size: 12px;
    color: #797878;
  }

  dd {
    display: block;
    margin-bottom: 4px;
  }

  &.is-collapse {
    dl {
      transition: all 250ms ease-in-out;
      opacity: 0;
      max-height: 0;
      overflow: hidden;
    }

    #{$root}__title {
      &::after {
        transform: scale(-1);
      }
    }
  }
}

.dcaw-messages-wrapper {
  position: fixed;
  top: 32px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;

  .dcaw-message {
    padding: 8px 16px;
    border-radius: 4px;
    background-color: #fff;
    box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 5%);
    margin-bottom: 16px;
    cursor: pointer;
    border-left: 6px solid $ok;
    animation: slide-left 100ms ease-in-out both;

    &.is-warning {
      border-left-color: $warning;
    }

    &.is-info {
      border-left-color: $info;
    }
  }
}

.dcaw-dropdown {
  $root: &;
  position: relative;
  z-index: 10;

  &__toggle {
    @extend %with-svg;
  }

  &__content {
    opacity: 0;
    visibility: hidden;
    z-index: -1;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px;

    #{$root}.is-active & {
      opacity: 1;
      visibility: visible;
      z-index: 1;
    }
  }
}

.dcaw-form {
  margin: 0;
  padding: 8px;
  border-radius: 4px;
  background-color: #fff;
  display: grid;
  align-items: center;
  gap: 6px;
  grid-auto-flow: column;
  border: 1px solid #f5f5f5;

  &[data-name=move_products] {
    grid-auto-flow: row;

    .dcaw-btn-w-icon {
      justify-content: center;
    }
  }

  input {
    font-size: 14px;
    line-height: 1;
    font-weight: normal;
    box-shadow: none;
    border: 0;
    background-color: transparent;
    padding: 6px;
    border-radius: 4px;
    height: 30px;
  }

  button {
    background-color: #108510;
    color: #fff;
  }
}

.dcaw-radio,
.dcaw-checkbox {
  margin: 0;
  font-size: 14px;
  padding-left: 24px;
  position: relative;
  white-space: nowrap;
  cursor: pointer;

  &:hover {
    opacity: 0.825;
  }

  input {
    display: none;
  }

  span {
    &::after,
    &::before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      border: 1px solid #232425;
      width: 12px;
      height: 12px;
      transition: all 50ms linear;
    }
  }
}

.dcaw-radio {
  input:checked + span {
    &::after {
      background-color: $ok;
      border-color: $ok;
      width: 4px;
      height: 4px;
      left: calc(12px / 2 - 4px / 2);
    }
  }

  span {
    &::before,
    &::after {
      border-radius: 50%;
    }
  }
}

.dcaw-checkbox {
  input {
    &:checked + span {
      &::before {
        left: calc(16px / 2 - 4px / 2);
        transform: translateY(-55%) rotate(42deg);
        width: 4px;
        height: 12px;
        border-radius: 0;
        border-top: 0;
        border-left: 0;
        border-bottom: 2px solid $ok;
        border-right: 2px solid $ok;
      }
    }
  }

  span {
    &::before {
      border-radius: 3px;
    }

    &::after {
      content: none;
    }
  }
}

@keyframes rotate-center {
  0% {
    transform: rotate(0);
  }

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

@keyframes slide-left {
  0% {
    transform: translateX(100%);
    opacity: 0;
  }

  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes loading {
  to {
    background-position: 315px 0, 0 0, 0 190px, 50px 195px;
  }
}

.out-of-stock{
  color:red;
}
.in-stock{
  color:green;
}
.dcaw-attribute__value{
  text-align:center !important;
  width:0px;
}


.dcaw-compare {
  width: 100%;
  border-collapse: collapse;
}

.dcaw-compare th,
.dcaw-compare td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.dcaw-compare thead th {
  position: sticky;
  top: 0;
  background-color: #f9f9f9;
  z-index: 2;
}

.dcaw-attribute__title {
  position: sticky;
  left: -1px;
  background-color: #f9f9f9 !important;
  z-index: 1;
}

.dcaw-product-tile__header {
  text-align: center;
}

.dcaw-product-tile__link img {
  max-width: 100px;
  height: auto;
}

.out-of-stock {
  color: red;
  font-weight: bold;
}

@media (min-width: 768px) {
  .dcaw-compare th,
  .dcaw-compare td {
    padding: 16px;
  }

  .dcaw-product-tile__header img {
    max-width: 150px;
  }
}

.dcaw-popup-content .dcaw-table-header{
  position:fixed;
  top:30px;
  right: 10px;
}
.dcaw-attribute__title:after{
  display:none !important;
}
.bold{
  font-weight: 800;
}
.dcaw-table-header__title.bold{
  align-self:start;
}
@media (max-width: 768px) {
  .dcaw-table-header__title.bold {
    display:none
  }
}
.dcaw-compare .nice-select.dcaw-select {
  float: unset !important;
  margin-top: 10px;
}
.dcaw-popup-content .dcaw-table-header__title.bold{
  align-self:unset !important;
  margin-right:10px;
}
.dcaw-select.wide {
  margin-bottom: 20px;

}

.dcaw-compare-wrapper{
  overflow:auto
}
.dcaw-popup-body > .dcaw-compare-table > .dcaw-compare-wrapper{
  overflow: visible;
}
