@layer productWidget, desktop, base, mobile;

@import url(style.css) layer(base);
@import url(product-widget.css) layer(productWidget);

@layer desktop {
  .charact-header {
    margin-top: 40px;
  }
  section {
    position: relative;
  }
  main h1 {
    text-align: center;
    margin: 0;
    margin-top: 40px;
    font-size: 32px;
  }
  main h2 {
    padding: 20px 0;
    font-size: 20px;
  }
  main h3 {
    font-size: 14px;
    font-weight: 400;
    color: #666;
  }
  label[for="only-difference"] {
    font-size: 16px;
    color: #666;
  }
  #compare-products {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-top: 20px;
    padding: 13px;
  }
  #compare-products .product-widget__product .product-widget__button_compare {
    display: none;
  }
  #compare-products .product-widget__product .product-widget__count-controler {
    justify-content: flex-start;
  }
  #slide-left {
    left: 20px;
  }
  #slide-right {
    left: calc(100% - 68px);
  }
  #slide-left,
  #slide-right {
    top: calc(50% - 50px);
    position: absolute;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    z-index: 2;
    border: 1px solid #dedede;
    color: #777;
    opacity: 0.5;
    cursor: pointer;
    font-size: 20px;
    transition: 0.3s;
  }
  #slide-left:hover,
  #slide-right:hover {
    color: white;
    background-color: #f2af2a;
    opacity: 1;
  }
  .product-widget__product .product-widget__count-controler input {
    width: 2.6vw;
  }
  .product-widget__button_buy {
    padding: 0.5vw 1.3vw;
  }
  .product-widget__product .product__percents {
    left: calc(120px - 100%);
  }
  label[for="only-difference"] .switch {
    margin-left: 5px;
  }
  .switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
  }

  /* Hide default HTML checkbox */
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }

  /* The switch-switch-slider */
  .switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: 0.4s;
    transition: 0.4s;
  }

  .switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: 0.4s;
    transition: 0.4s;
  }

  input:checked + .switch-slider {
    background-color: #f2af2a;
  }

  input:focus + .switch-slider {
    box-shadow: 0 0 1px #f2af2a;
  }

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

  /* Rounded switch-sliders */
  .switch-slider.round {
    border-radius: 34px;
  }

  .switch-slider.round:before {
    border-radius: 50%;
  }
  .with-circle {
    position: relative;
  }
  .with-circle::before {
    content: "";
    position: absolute;
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 100%;
    background-color: #f2af2a;
    left: -17px;
    top: calc(50% - 6px);
  }
  .charact-item {
    padding: 13px;
    transition: 0.3s;
  }
  .charact-item__values {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
  }
  .charact-item__values span {
    text-align: center;
    padding-top: 5px;
    padding-bottom: 5px;
    border-right: 2px dashed #e4e4e4;
  }
  .charact-item__values span:last-child {
    border-right: none;
  }
  .charact-item:nth-child(2n) {
    background-color: #f8f8f8;
  }
  .charact-item:hover {
    background-color: #fffdeb;
  }
  .product-widget__remove {
    position: absolute;
    justify-content: center;
    display: flex;
    width: 44px;
    height: 44px;
    border-radius: 100%;
    font-size: 20px;
    border: none;
    background: #f2af2a;
    color: white;
    cursor: pointer;
    top: 1%;
    left: calc(99% - 45px);
    align-items: center;
    opacity: 0;
    transition: 0.3s;
  }
  .product-widget__remove:hover {
    background: red;
  }
  .product-widget__product:hover .product-widget__remove {
    opacity: 1;
  }

  .product-widget__image {
    height: 257px;
  }
}

@layer mobile {
  @media (max-width: 1500px) {
    #compare-products,
    .charact-item__values {
      grid-template-columns: repeat(4, 1fr);
    }
  }
  @media (max-width: 1000px) {
    .product-widget__product .product-widget__count-controler input {
      width: 50px;
    }
    #compare-products,
    .charact-item__values {
      grid-template-columns: repeat(2, 1fr);
    }
  }
  @media (max-width: 500px) {
    #compare-products {
      padding: 0;
    }
    label[for="only-difference"] {
      flex-direction: column;
      align-items: flex-start;
    }
    .product-widget__product img {
      max-height: 200px;
    }
    .product-widget__image {
      height: 200px;
    }
    .product-widget__count-controler {
      display: none;
    }
    .product-widget__controls .flex {
      width: 100%;
    }
    .product-widget__button_buy {
      width: 100%;
      padding: 4svh;
    }
    #slide-left,
    #slide-right {
      left: 0;
      top: 0;
      position: relative;
      margin-top: 20px;
      color: white;
      background-color: #f2af2a;
      opacity: 1;
    }
    .product-widget__product .product__percents {
      left: -30%;
      top: 10%;
    }
  }
}
