/* ==================== 三步驟進度條 ==================== */
.checkout-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  transition: all 0.3s;
}

.step.active .step-number {
  background: #333;
  color: #fff;
}

.step.completed .step-number {
  background: #27ae60;
  color: #fff;
}

.step-label {
  font-size: 14px;
  color: #999;
  white-space: nowrap;
}

.step.active .step-label,
.step.completed .step-label {
  color: #333;
  font-weight: 500;
}

.step-line {
  width: 80px;
  height: 2px;
  background: #e0e0e0;
  margin: 0 1rem;
  margin-bottom: 20px;
}

.step-line.active {
  background: #333;
}

/* ==================== 結帳佈局 ==================== */
.checkout-layout {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 2rem;
}

/* ==================== 左側區域 ==================== */
.checkout-left {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* 會員提示 */
.member-notice {
  background: #f8f9fa;
  padding: 1.25rem;
}

.member-notice p {
  margin: 0;
  color: #666;
  font-size: 14px;
  line-height: 1.6;
}

/* 數量控制 */
.item-quantity-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* 商品列表 */
.checkout-items {
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.checkout-item {
  display: grid;
  grid-template-columns: 100px 1fr 140px 150px;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.checkout-item:last-child {
  border-bottom: none;
}

.item-image {
  width: 100px;
  height: 100px;
  overflow: hidden;
  background: #f8f8f8;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-details {
  flex: 1;
}

.item-name {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 0.25rem 0;
  color: #333;
}

.item-desc {
  font-size: 13px;
  color: #999;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.item-quantity {
  font-size: 13px;
  color: #666;
  margin: 0;
}

.item-price {
  text-align: right;
}

.price-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.current-price {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.original-price {
  font-size: 13px;
  color: #999;
  text-decoration: line-through;
}

/* 相關商品 */
.related-products {
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ==================== 右側訂單摘要 ==================== */
.checkout-right {
  position: sticky;
  top: 2rem;
  height: fit-content;
}

.order-summary {
  background: #fff;
  padding: 1.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.member-hint {
  font-size: 12px;
  color: #257500;
}

.summary-section {
  margin-bottom: 1rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  font-size: 15px;
}

.summary-row span {
  color: #666;
}

.summary-row .value {
  font-weight: 500;
  color: #333;
}

.summary-row .free {
  color: #27ae60;
  font-weight: 600;
}

/* 配送方式選擇 */
.shipping-select {
  margin: 1.5rem 0;
}

.shipping-select label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 0.5rem;
}

.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  font-size: 14px;
  color: #333;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.3s;
}

.form-select:hover,
.form-select:focus {
  border-color: #333;
  outline: none;
}

/* 折價券按鈕 */
.coupon-section {
  margin: 1rem 0;
}

.btn-coupon {
  width: 100%;
  padding: 0.75rem;
  background: #f8f9fa;
  border: 1px dashed #ccc;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-coupon:hover {
  background: #fff;
  border-color: #333;
  color: #333;
}

.divider {
  border: none;
  border-top: 1px solid #e0e0e0;
  margin: 1.5rem 0;
}

/* 總計 */
.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  font-size: 18px;
  font-weight: 600;
}

.total-amount {
  font-size: 24px;
  color: #e74c3c;
}

/* 立即結帳按鈕 */
.btn-checkout {
  width: 100%;
  padding: 1rem;
  background: #333;
  color: #fff;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
  margin: 1rem 0;
}

.btn-checkout:hover {
  background: #000;
}

/* 付款方式 */
.payment-methods {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f5f5f5;
}

.payment-methods h3 {
  font-size: 16px;
  margin: 0 0 1rem 0;
  color: #333;
}

.payment-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.payment-left {
  flex: 1;
}

.payment-left .payment-label {
  font-size: 13px;
  color: #666;
  margin: 0 0 0.75rem 0;
  text-align: left;
}

.payment-icons-row {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
}

.payment-icon-img {
  height: 15px;
  width: auto;
  object-fit: contain;
}

/* ✅ 綠界 logo 區域 */
.payment-right {
  display: flex;
  align-items: center;
}

.ecpay-logo {
  padding: 0.5rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ecpay-logo img {
  height: 28px;
  width: auto;
}

.payment-note {
  font-size: 11px;
  color: #999;
  line-height: 1.6;
  margin: 0;
  text-align: left;
}

/* ==================== 響應式 ==================== */
@media (max-width: 768px) {
  .payment-header {
    flex-direction: column;
    gap: 1rem;
  }

  .payment-right {
    justify-content: flex-start;
  }

  .payment-icons-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .payment-icon-img {
    height: 13px;
  }

  .ecpay-logo img {
    height: 24px;
  }
}

/* ==================== 響應式設計 ==================== */
@media (max-width: 1024px) {
  .checkout-layout {
    grid-template-columns: 1fr;
  }

  .checkout-right {
    position: static;
  }
}

@media (max-width: 768px) {
  .checkout-steps {
    padding: 1rem 0;
  }

  .step-number {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .step-label {
    font-size: 12px;
  }

  .step-line {
    width: 40px;
    margin: 0 0.5rem;
  }

  .checkout-item {
    grid-template-columns: 80px 1fr;
    gap: 1rem;
  }

  .item-image {
    width: 80px;
    height: 80px;
  }

  /* 第二列:數量控制 */
  .item-quantity-control {
    grid-column: 1;
    justify-content: flex-start;
  }

  /* 第二列:價格 */
  .item-price {
    grid-column: 2;
    text-align: right;
  }
}

.coupon-section {
  margin: 1rem 0;
}

/* 選擇折價券按鈕 */
.btn-coupon {
  width: 100%;
  padding: 0.75rem;
  background: #f8f9fa;
  border: 1px dashed #ccc;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-coupon:hover {
  background: #fff;
  border-color: #667eea;
  color: #667eea;
}

/* 已選擇的折價券 */
.selected-coupon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
  border: 1px solid #667eea;
}

.coupon-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.coupon-info .coupon-name {
  font-size: 13px;
  color: #333;
  font-weight: 500;
}

.coupon-info .coupon-discount {
  font-size: 15px;
  color: #667eea;
  font-weight: 600;
}

/* 刪除按鈕 */
.btn-remove-coupon {
  background: none;
  border: none;
  color: #999;
  cursor: pointer;
  padding: 0.5rem;
  font-size: 18px;
  transition: all 0.3s;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove-coupon:hover {
  background: #fee;
  color: #e74c3c;
}

/* ==================== Modal 基礎樣式 ==================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: #fff;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s;
}

.modal-close:hover {
  color: #333;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  gap: 1rem;
}

/* ==================== 小型 Modal (提示用) ==================== */
.modal-small {
  max-width: 420px;
}

/* ==================== 需要登入彈窗 ==================== */
.login-required-content {
  text-align: center;
  padding: 1rem 0;
}

.icon-wrapper {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-wrapper img {
  width: 100%;
}

.login-required-content h4 {
  font-size: 18px;
  margin: 0 0 0.5rem 0;
  color: #333;
}

.login-required-content > p {
  font-size: 14px;
  color: #666;
  margin: 0 0 1.5rem 0;
  line-height: 1.6;
}

.benefits-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: left;
  margin-top: 1.5rem;
}

.benefit-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.benefit-item i {
  color: #27ae60;
  font-size: 16px;
}

.benefit-item span {
  font-size: 14px;
  color: #333;
}

/* ==================== 沒有折價券彈窗 ==================== */
.no-coupon-content {
  text-align: center;
  padding: 1rem 0;
}

.no-coupon-content .icon-wrapper {
  background: #f8f9fa;
}

.no-coupon-content .icon-wrapper i {
  color: #999;
}

.no-coupon-content > p {
  font-size: 15px;
  color: #333;
  margin: 0 0 0.5rem 0;
}

.no-coupon-content .hint {
  font-size: 13px;
  color: #999;
  margin: 0;
}

/* ==================== 響應式設計 ==================== */
@media (max-width: 768px) {
  .modal-content {
    max-height: 90vh;
  }

  .modal-small {
    max-width: 90%;
  }

  .discount-number {
    font-size: 24px;
  }

  .icon-wrapper {
    width: 60px;
    height: 60px;
  }

  .icon-wrapper i {
    font-size: 30px;
  }
}
