// CartPage.module.scss
.cartContainer {
  display: flex;
  gap: 2rem;
  max-width: 1366px;
  margin: 0 auto;
  padding: 2.1rem;
  box-sizing: border-box;
  @media screen and (max-width: 720px) {
    padding: 0.5rem;
  }
}

.cartItems {
  flex: 1;
  .cartHeader {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    justify-content: space-between;
    background-color: #f3f4f6;
    padding-bottom: 15px;
    h2 {
      font-size: 24px;
      font-weight: 700;
      margin: 0;
      @media screen and (max-width: 768px) {
        font-size: 16px;
        font-weight: 500;
      }
    }
  }
}

.cartProducts {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  @media screen and (max-width: 1023px) {
    flex-direction: column;
  }
}

.storesContainer {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.storeSection {
  display: flex;
  border-radius: 10px;
  gap: 16px;
  justify-content: space-between;
  width: 100%;

  @media screen and (max-width: 1023px) {
    flex-direction: column;
  }
}

.storeHeader {
  padding: 12px 16px;
  border-bottom: 1px solid #f0f1f3;

  h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    @media screen and (max-width: 768px) {
      font-size: 16px;
    }
  }
}

.cartItemContainer {
  display: flex;
  flex-direction: column;
}

.cartItem {
  display: flex;
  gap: 1.5rem;
  margin: 1.5rem;
  padding-bottom: 20px;
  border-bottom: 1px solid #f0f1f3;

  &:last-child {
    border-bottom: none;
  }

  @media screen and (max-width: 720px) {
    gap: 0.5rem;
    margin: 0.5rem;
  }

  .itemImage {
    width: 144px;
    height: 144px;

    img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
    @media screen and (max-width: 340px) {
      width: 95px;
      height: 95px;
    }
  }

  .itemInfo {
    flex: 1;
    display: flex;
    justify-content: space-between;
    gap: 15px;
    @media screen and (max-width: 720px) {
      flex-direction: column;
      position: relative;
    }
    h1{
      font-size: 1.2rem;
      @media screen and (max-width: 720px) {
        font-size: 16px;
      }
    }
    h3 {
      font-size: 1.2rem;
      margin-bottom: 0.5rem;
      @media screen and (max-width: 720px) {
        font-size: 14px;
      }
    }

    p {
      color: #666;
      margin-bottom: 1rem;
      @media screen and (max-width: 720px) {
        font-size: 12px;
      }
    }
  }
}

.priceQuantity {
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  @media screen and (max-width: 720px) {
    flex-direction: row-reverse;
    justify-content: space-between;
  }

  .price {
    font-weight: 700;
    font-size: 18px;
    margin-bottom: 8px;
    @media screen and (max-width: 720px) {
      font-size: 14px;
      font-weight: 500;
    }
  }
}

.quantityControls {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  background-color: #888888;
  border-radius: 5px;
  min-width: 160px;

  span {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    display: flex;
    width: 100%;
    justify-content: center;
  }

  .quantityBtn {
    width: 100%;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    @media screen and (max-width: 720px) {
      width: auto;
    }
    svg {
      fill: #fff;
      @media screen and (max-width: 720px) {
        width: 14px;
      }
    }

    &:hover {
      background: #aaaaaa;
      height: 100%;
    }
  }
  @media screen and (max-width: 720px) {
    min-width: 110px;
    gap: 0.5rem;
    min-height: 33px;
    height: 36px;
  }
}

.storeSummary {
  width: 300px;
  position: sticky;
  top: 5rem;
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 300px;
  @media screen and (max-width: 1023px) {
    width: 100%;
    position: static;
    margin-top: 16px;
  }

  h3 {
    margin-bottom: -0.5rem;
    font-size: 18px;
    margin-top: 0;
    font-weight: 500;
  }
}

.cartContent {
  background: white;
  padding: 8px;
  border-radius: 8px;
  @media screen and (max-width: 1023px) {
    flex: 1;
  }
}

.summaryRow span:nth-of-type(2) {
  color: #888888;
  font-weight: 600;
}

.summaryRow {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 14px;

  &:last-of-type {
    border-top: 1px solid #eee;
    padding-top: 5px;
    margin-top: 10px;
  }
  &:first-of-type {
    padding-top: 5px;
    margin-top: 10px;
    border-top: 1px solid #eee;
  }
}

.checkoutBtn {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  height: 40px;
  background: #d32824;
  color: #ffffff;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  cursor: pointer;
  @media screen and (max-width: 1023px) {
    flex: 1;
  }

  &:hover {
    background: #e86064;
  }
}

.deleteBtnContainer {
  @media screen and (max-width: 720px) {
    position: absolute;
    top: 0;
    right: 0;
  }
}

.deleteBtn {
  display: flex;
  align-items: center;
  background-color: #888888;
  gap: 5px;
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  border-radius: 5px;
  cursor: pointer;
  svg {
    fill: #fff;
  }

  &:hover {
    background: #aaaaaa;
  }
}

// mobile sticky
.container {
  margin-bottom: 25px;
  position: sticky;
  bottom: 60px;
  -webkit-tap-highlight-color: transparent;
  z-index: 9;
  @media screen and (min-width: 1023px) {
    display: none;
  }
}

.summaryCard {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.titleWrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  width: 50%;
  padding: 12px;
  background-color: #fff;
  -webkit-tap-highlight-color: transparent;

  span {
    display: flex;
    align-items: center;
  }

  @media screen and (max-width: 426px) {
    font-size: 12px;
  }

  @media screen and (max-width: 375px) {
    font-size: 12px;
    padding: 6.8px 12px;
  }
  @media screen and (max-width: 334px) {
    padding: 14.5px 12px;
  }

  outline: none !important;
  -webkit-touch-callout: none;

  &:focus {
    outline: none !important;
  }

  &:active {
    background-color: #fff;
  }
}

.amount {
  color: #888888;
  font-weight: 500;
  font-size: 16px;

  @media screen and (max-width: 375px) {
    font-size: 12px;
  }
}

.actionWrapper {
  display: flex;
  align-items: center;
  padding: 12px;
  height: 100%;
  width: 50%;
  background-color: #d32824;
  justify-content: center;
  cursor: pointer;
  outline: none !important;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;

  &:focus {
    outline: none !important;
  }

  &:active {
    background-color: #4bac43;
  }

  @media screen and (max-width: 375px) {
    padding: 8px;
  }
}

.button {
  background-color: transparent;
  color: white;
  box-shadow: none;
  border: none;
  transition: background-color 0.2s;
  font-size: 16px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  outline: none !important;
  -webkit-touch-callout: none;

  &:hover {
    background-color: transparent;
  }

  &:focus {
    outline: none !important;
  }

  &:active {
    background-color: transparent;
  }

  @media screen and (max-width: 426px) {
    font-size: 12px;
  }
}

.expandedContent {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  border: 1px solid #e5e7eb;
  border-bottom: none;
  background-color: white;
  opacity: 0;
  transition: all 0.2s ease-out;
  pointer-events: none;
  z-index: 10;

  &.visible {
    opacity: 1;
    pointer-events: auto;
  }
}

.details {
  padding: 1rem;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.cartDeleteModal {
  :global {
    .ant-modal-content {
      top: 50%;
      transform: translateY(-30%);
    }

    .ant-modal-header {
      text-align: center;
      border-bottom: none;
    }

    .ant-modal-title {
      font-size: 16px;
      font-weight: 600;
    }

    .ant-modal-body {
      text-align: center;

      font-size: 14px;
    }

    .ant-modal-footer {
      border-top: none;
      .ant-btn {
        min-width: 65px;
        height: 32px;
        font-size: 14px;
        background-color: #ff0000;
        border-color: #ff0000;
        color: #ffffff;

        &-primary {
          background-color: #4bac43;
          border-color: #4bac43;

          &:hover {
            background-color: rgb(126 210 111);
            border-color: rgb(126 210 111);
          }
        }
      }
    }
  }
}
