/* 
 * 購物點數與折扣系統外掛 - 前端展示樣式
 */

.tw-points-balance {
  margin-bottom: 30px;
  padding: 15px;
  background-color: #f8f8f8;
  border-radius: 5px;
}

.tw-points-balance h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.tw-points-redeem-form {
  margin-bottom: 30px;
  padding: 15px;
  background-color: #f8f8f8;
  border-radius: 5px;
}

.tw-points-redeem-form h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.tw-points-redeem-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.tw-points-redeem-field input[type="number"] {
  width: 100px;
}

.tw-points-message {
  margin-top: 5px;
  width: 100%;
}

.points-earned {
  color: green;
  font-weight: bold;
}

.points-used {
  color: red;
  font-weight: bold;
}

.woocommerce-table--points-history {
  width: 100%;
  margin-bottom: 20px;
  border-collapse: collapse;
}

.woocommerce-table--points-history th,
.woocommerce-table--points-history td {
  text-align: left;
  padding: 10px;
  border: 1px solid #e5e5e5;
}

.woocommerce-table--points-history th {
  background-color: #f8f8f8;
}

.woocommerce-table.points_info {
  width: 100%;
  margin-bottom: 20px;
  border-collapse: collapse;
}

.woocommerce-table.points_info th,
.woocommerce-table.points_info td {
  text-align: left;
  padding: 10px;
  border: 1px solid #e5e5e5;
}

.woocommerce-table.points_info th {
  width: 200px;
  background-color: #f8f8f8;
}

.tw-points-pagination {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.tw-points-pagination .page-numbers {
  display: inline-block;
  padding: 5px 10px;
  margin: 0 3px;
  border: 1px solid #ddd;
  background-color: #f1f1f1;
  color: #333;
  text-decoration: none;
  border-radius: 3px;
}

.tw-points-pagination .page-numbers.current {
  background-color: #0073aa;
  color: white;
  border-color: #0073aa;
}

.tw-points-pagination .page-numbers:hover:not(.current) {
  background-color: #ddd;
}

.cart-discount.points-discount td {
  color: #4caf50;
}

@media screen and (max-width: 768px) {
  .tw-points-redeem-field {
    flex-direction: column;
    align-items: flex-start;
  }

  .tw-points-redeem-field input[type="number"],
  .tw-points-redeem-field button {
    margin-bottom: 10px;
  }

  .tw-points-redeem-field button {
    width: 100%;
  }

  .woocommerce-table--points-history,
  .woocommerce-table--points-history thead,
  .woocommerce-table--points-history tbody,
  .woocommerce-table--points-history th,
  .woocommerce-table--points-history td,
  .woocommerce-table--points-history tr {
    display: block;
  }

  .woocommerce-table--points-history thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .woocommerce-table--points-history tr {
    margin-bottom: 15px;
    border: 1px solid #e5e5e5;
  }

  .woocommerce-table--points-history td {
    position: relative;
    padding-left: 45%;
    border: none;
    border-bottom: 1px solid #e5e5e5;
  }

  .woocommerce-table--points-history td:before {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40%;
    padding-right: 10px;
    font-weight: bold;
    content: attr(data-title);
  }

  .woocommerce-table--points-history td:last-child {
    border-bottom: 0;
  }
}
