/* ========================================
   Checkout Page – ISHOON Figma 結帳流程
   ======================================== */

.checkout-main {
  margin-top: var(--header-height);
  background: var(--color-wants-cream, #faf8f5);
  overflow-x: clip;
  max-width: 100%;
  --checkout-dark: #152042;
  --checkout-accent: #81895b;
  --checkout-tan: #ccad88;
  --checkout-text: #595757;
}

/* ---------- Body ---------- */
.checkout-body {
  position: relative;
  padding: 56px 20px 120px;
  overflow: hidden;
  min-height: calc(100vh - var(--header-height));
}

.checkout-body__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.checkout-body__bg-image {
  position: absolute;
  top: -20%;
  left: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
  object-fit: cover;
  opacity: 0.3;
  display: block;
  pointer-events: none;
}

.checkout-body__inner {
  position: relative;
  z-index: 1;
  max-width: 1090px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 56px;
}

/* ---------- Steps ---------- */
.checkout-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 122px;
  padding: 36px 20px 28px;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.checkout-steps__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-width: 48px;
}

.checkout-steps__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--checkout-text);
  border-radius: 60px;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  line-height: normal;
  color: var(--checkout-text);
  background: #fff;
}

.checkout-steps__badge--done {
  border-width: 2px;
}

.checkout-steps__badge--active {
  border: none;
  background: var(--checkout-tan);
  color: #fff;
}

.checkout-steps__label {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  color: var(--checkout-text);
  text-align: center;
}

.checkout-steps__label--active {
  font-weight: 700;
  color: var(--checkout-dark);
}

.checkout-steps__line {
  display: block;
  flex: 1 1 40px;
  width: auto;
  max-width: 160px;
  min-width: 24px;
  height: 1px;
  margin-top: 15px;
  background: #595757;
  border: none;
  align-self: flex-start;
}

/* ---------- Layout ---------- */
.checkout-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-width: 0;
}

/* ---------- Form Card ---------- */
.checkout-form {
  flex: 1 1 700px;
  max-width: 700px;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 35px;
  padding: 32px 30px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  box-shadow: 0 4px 5px rgba(0, 0, 0, 0.25);
}

.checkout-form__section {
  display: flex;
  flex-direction: column;
  gap: 19px;
}

.checkout-form__section--narrow {
  max-width: 300px;
}

.checkout-form__title {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 18px;
  font-weight: 700;
  line-height: normal;
  color: var(--checkout-dark);
  margin: 0;
}

.checkout-form__fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.checkout-form__row {
  display: flex;
  gap: 40px;
}

.checkout-form__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.checkout-form__field--half {
  flex: 0 0 calc(50% - 20px);
  max-width: 300px;
}

.checkout-form__label {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  color: #666;
}

.checkout-form__required {
  color: var(--checkout-accent);
}

.checkout-form__input,
.checkout-form__select,
.checkout-form__textarea {
  width: 100%;
  border: 1px solid #d9d9d9;
  border-radius: 0;
  background: #fff;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  color: var(--checkout-text);
}

.checkout-form__input,
.checkout-form__select {
  height: 44px;
  padding: 0 12px;
}

.checkout-form__select {
  appearance: none;
  color: #888;
  font-size: 13px;
}

.checkout-form__textarea {
  min-height: 84px;
  padding: 14px 18px;
  resize: vertical;
  font-size: 13px;
}

.checkout-form__textarea::placeholder {
  color: #888;
}

.checkout-form__input:focus,
.checkout-form__select:focus,
.checkout-form__textarea:focus {
  outline: 2px solid var(--checkout-dark);
  outline-offset: 1px;
}

.checkout-form__address {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.checkout-form__address-row {
  display: flex;
  gap: 20px;
  width: 100%;
  min-width: 0;
}

.checkout-form__address-row .checkout-form__select {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.checkout-form__date {
  position: relative;
}

.checkout-form__input--date {
  position: relative;
  z-index: 1;
  background: transparent;
  color: var(--checkout-text);
}

.checkout-form__input--date::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.checkout-form__date-placeholder {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 13px;
  color: #888;
  pointer-events: none;
}

.checkout-form__input--date:valid + .checkout-form__date-placeholder,
.checkout-form__input--date:focus + .checkout-form__date-placeholder {
  display: none;
}

.checkout-form__date-icon {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* ---------- Shipping ---------- */
.checkout-shipping {
  display: flex;
  gap: 40px;
  flex-wrap: wrap;
}

.checkout-shipping__option {
  display: flex;
  align-items: center;
  gap: 17px;
  flex: 1 1 300px;
  width: 100%;
  max-width: 300px;
  min-width: 0;
  min-height: 78px;
  padding: 21px 17px;
  border: 1px solid #d7ccc8;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.checkout-shipping__option--active {
  border-color: var(--checkout-accent);
}

.checkout-shipping__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.checkout-shipping__radio {
  flex-shrink: 0;
  display: block;
}

.checkout-shipping__radio--empty {
  width: 16px;
  height: 16px;
  border: 1px solid #d7ccc8;
  border-radius: 60px;
}

.checkout-shipping__content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkout-shipping__name {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 400;
  line-height: normal;
  color: var(--checkout-text);
}

.checkout-shipping__option--active .checkout-shipping__name {
  font-weight: 700;
  color: var(--checkout-accent);
}

.checkout-shipping__desc {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  color: #888;
}

/* ---------- Summary ---------- */
.checkout-summary {
  flex: 0 0 350px;
  width: 350px;
  max-width: 100%;
}

.checkout-summary__card {
  padding: 22px 25px 28px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.checkout-summary__content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
}

.checkout-summary__title {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 18px;
  font-weight: 700;
  line-height: normal;
  color: var(--checkout-text);
  margin: 0;
}

.checkout-summary__items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkout-summary__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 74px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #eee;
  box-shadow: 0 4px 2px rgba(0, 0, 0, 0.08);
}

.checkout-summary__item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.checkout-summary__item-image {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  object-fit: cover;
  display: block;
}

.checkout-summary__item-name {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--checkout-text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.checkout-summary__item-price {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  font-weight: 700;
  line-height: normal;
  color: var(--checkout-accent);
  margin: 0;
  flex: 0 0 auto;
  white-space: nowrap;
}

.checkout-summary__totals {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.checkout-summary__divider {
  display: block;
  width: 100%;
  height: 0;
  border: none;
  border-top: 1px solid #eee;
  margin: 0;
}

.checkout-summary__rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  margin: 0;
}

.checkout-summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 14px;
  line-height: normal;
}

.checkout-summary__row dt {
  font-weight: 400;
  color: #666;
}

.checkout-summary__row dd {
  margin: 0;
  font-weight: 400;
  color: var(--checkout-text);
  text-align: right;
}

.checkout-summary__total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}

.checkout-summary__total-label {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--checkout-text);
}

.checkout-summary__total-value {
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--checkout-accent);
  text-align: right;
}

.checkout-summary__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 14px 20px;
  border: none;
  border-radius: 27px;
  background: var(--checkout-tan);
  font-family: 'Georgia', 'Noto Sans TC', serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.checkout-summary__submit:hover {
  opacity: 0.9;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .checkout-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .checkout-form,
  .checkout-summary {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .checkout-summary__content {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .checkout-body {
    padding: 36px 16px 60px;
  }

  .checkout-steps {
    flex-wrap: nowrap;
    gap: 0;
    padding: 24px 8px 20px;
    min-height: auto;
    overflow: hidden;
  }

  .checkout-steps__item {
    min-width: 0;
    flex: 0 1 auto;
  }

  .checkout-steps__line {
    flex: 1 1 8px;
    min-width: 8px;
    max-width: 32px;
    margin-top: 14px;
  }

  .checkout-steps__label {
    font-size: 10px;
    white-space: nowrap;
  }

  .checkout-form {
    padding: 24px 16px;
  }

  .checkout-form__row {
    flex-direction: column;
    gap: 20px;
  }

  .checkout-form__field--half {
    flex: none;
    max-width: 100%;
  }

  .checkout-form__address-row {
    gap: 12px;
  }

  .checkout-shipping {
    flex-direction: column;
    gap: 16px;
  }

  .checkout-shipping__option {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .checkout-form__section--narrow {
    max-width: 100%;
  }

  .checkout-summary__card {
    padding: 20px 16px 24px;
  }
}

/* 結帳頁：避免 footer / 搜尋列撐出橫向捲動 */
body.page-template-page-checkout-php,
body.woocommerce-checkout {
  overflow-x: clip;
}

body.page-template-page-checkout-php .mobile-search-overlay,
body.woocommerce-checkout .mobile-search-overlay {
  overflow: hidden;
  max-width: 100%;
}

body.page-template-page-checkout-php .mobile-search-overlay__inner,
body.woocommerce-checkout .mobile-search-overlay__inner {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
