@import '../../variables.scss';

.teletext-list__panel__item {
  position: relative; 
  // width: 100%;
  display: flex;
  gap: 5px;
  // padding-bottom: 10px;
  justify-content: flex-start;
  background-color: #f8f9fb;
  
  .teletext-list__panel__item_image {
    width: 100px;
    height: 100px;
    border-radius: 5px;
    flex: 0 0 auto;
    overflow: hidden;
    object-fit: cover;

    & > img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

  }

  .teletext-list__panel__item__text {
    display: flex;
    flex-direction: column;
    gap: 3px;

    .teletext-list__panel__item__text__item {
      -webkit-line-clamp: 1;
      overflow: hidden;
      color: #686868;
      -webkit-box-orient: vertical;
      display: -webkit-box;
      font-size: 12px;
      text-overflow: ellipsis;
    }
    .teletext-list__panel__item__text__title {
      font-size: 14px;
      font-weight: 600;
      color: #222222;
      -webkit-line-clamp: 1;
      overflow: hidden;
      -webkit-box-orient: vertical;
      display: -webkit-box;
      text-overflow: ellipsis;
    }

    .teletext-list__panel__item__text__description {
      -webkit-line-clamp: 1;
      overflow: hidden;
      color: #777777;
      -webkit-box-orient: vertical;
      display: -webkit-box;
      font-size: 13px;
      text-overflow: ellipsis;
    }

    .teletext-list__panel__item__text__tags {
      display: flex;
      gap: 6px; 
    }
  }
  .teletext-list__panel__item__switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    .teletext-list__panel__item__switch__title {
      font-size: 14px;
      font-weight: 600;
      color: #222222;
      -webkit-line-clamp: 1;
      overflow: hidden;
      -webkit-box-orient: vertical;
      display: -webkit-box;
      text-overflow: ellipsis;
    }
    // ─── 原生 toggle switch ────────────────────────────────────────────────────────
    .teletext-list__panel__item__switch__toggle {
      position: relative;
      display: inline-block;
      width: 44px;
      height: 24px;
      flex-shrink: 0;
      cursor: pointer;

      input {
        opacity: 0;
        width: 0;
        height: 0;
        position: absolute;
      }

      .teletext-list__panel__item__switch__slider {
        position: absolute;
        inset: 0;
        background-color: #cccccc;
        border-radius: 24px;
        transition: background-color 0.2s;

        &::before {
          content: '';
          position: absolute;
          width: 18px;
          height: 18px;
          left: 3px;
          top: 3px;
          background-color: #fff;
          border-radius: 50%;
          transition: transform 0.2s;
        }
      }

      input:checked + .teletext-list__panel__item__switch__slider {
        background-color: #4c84ff;
        &::before {
          transform: translateX(20px);
        }
      }
    }
  }
  // ─── 购物车 select 下拉菜单 ──────────────────────────────────────────────────────
  .teletext-list__panel__item__select {
    padding: 4px 8px;
    border: 1px solid #dddddd;
    border-radius: 4px;
    font-size: 12px;
    background: #fff;
    color: #333333;
    outline: none;
    cursor: pointer;
  }
  .shopping-cart-select {
    display: flex;
    flex-direction: column;
    gap: 5px;
    .select-box {
      display: flex;
      align-items: center;
      gap: 10px;
    }
    .shopping-cart-select__btn {
      display: flex;
      align-items: center;
      font-size: 13px;
      line-height: 1.3;
      color: #000000;
      gap: 5px;
      padding-right: 5px;
      .shopping-cart-select__btn__item {
        display: flex;
        align-items: center;
        border-right: 1px solid #000000;
        gap: 6px;
        font-size: 13px;
        line-height: 1.3;
        color: #000000;
        padding-right: 5px;
        .shopping-cart-select-img {
          width: 15px;
          height: 15px;
        }
      }
      .remove-box {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        line-height: 1.3;
        color: #000000;
        .shopping-cart-select-img {
          width: 13px;
          height: 13px;
        }
      }
    }
  }

  .shopping-cart-select__btn {
    display: flex;
    align-items: center;
    font-size: 13px;
    line-height: 1.3;
    color: #000000;
    gap: 5px;
    padding-right: 5px;
    .shopping-cart-select__btn__item {
      display: flex;
      align-items: center;
      border-right: 1px solid #000000;
      gap: 6px;
      font-size: 13px;
      line-height: 1.3;
      color: #000000;
      padding-right: 5px;
      .shopping-cart-select-img {
        width: 15px;
        height: 15px;
      }
    }
    .remove-box {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 13px;
      line-height: 1.3;
      color: #000000;
      .shopping-cart-select-img {
        width: 13px;
        height: 13px;
      }
    }
  }
  
  &.image-left, &.image-right {
    flex-direction: row;
  }
  
  &.image-top, &.image-bottom {
    flex-direction: column;
  }
}

.image-top,
.image-bottom {
  flex-direction: column; // 图片在上下时，切换为列布局
  align-items: start; // 居中对齐
  .teletext-list__panel__item_image {
    width: 100%;
    height: 172px;
    border-radius: 5px;
    flex: 0 0 auto;
    overflow: hidden;
    object-fit: cover;

    & > img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

  }
}

.teletext-list__panel__item:not(:last-child) {
  // border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
