/* =========================================
   カートページ / ヘッダーバッジ
========================================= */

/* ヘッダーカートバッジ */
.cart-badge-wrap {
  position: relative;
  display: inline-flex;
}

.cart-badge {
  position: absolute;
  top: -8px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 4px;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  border-radius: 9999px;
  pointer-events: none;
}

/* カートに入れるボタン状態 */
.btn.cart.is-in-cart {
  background: #718096;
  border-color: #718096;
  cursor: default;
}

/* =========================================
   カートページ共通
========================================= */
.cart-page {
  min-height: 60vh;
  padding-top: var(--header-height);
}

.cart-page__hero {
  padding: 48px 0 32px;
  background: #f7f7f5;
  border-bottom: 1px solid #e8e8e4;
  text-align: center;
}

.cart-page__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  margin: 8px 0 0;
  color: #1a1a1a;
}

.cart-page__lead {
  margin: 12px 0 0;
  color: #555;
  font-size: 0.9375rem;
}

.cart-page__body {
  padding: 48px 0 80px;
}

/* セクション */
.cart-section {
  margin-bottom: 48px;
}

.cart-section__title {
  font-size: 1.125rem;
  font-weight: 700;
  padding-bottom: 12px;
  border-bottom: 2px solid #1a1a1a;
  margin-bottom: 24px;
}

.cart-section__lead {
  color: #555;
  font-size: 0.9375rem;
  margin-bottom: 24px;
}

/* アラート */
.cart-alert {
  padding: 14px 18px;
  border-radius: 6px;
  margin-bottom: 24px;
  font-size: 0.9375rem;
}

.cart-alert--error {
  background: #fff5f5;
  border: 1px solid #fc8181;
  color: #c53030;
}

/* =========================================
   カート商品一覧
========================================= */
.cart-empty {
  text-align: center;
  padding: 48px 0;
}

.cart-empty__text {
  font-size: 1rem;
  color: #666;
  margin-bottom: 24px;
}

.cart-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
}

.cart-item__thumb {
  flex-shrink: 0;
  width: 80px;
  height: 56px;
  border-radius: 4px;
  overflow: hidden;
  background: #f0f0ec;
}

.cart-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item__thumb-placeholder {
  width: 100%;
  height: 100%;
  background: #ddd;
}

.cart-item__info {
  flex: 1;
  min-width: 0;
}

.cart-item__title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item__price {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

.cart-item__price-note {
  font-size: 0.75rem;
  font-weight: 400;
  color: #888;
  margin-left: 2px;
}

.cart-item__remove {
  flex-shrink: 0;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.8125rem;
  color: #666;
  cursor: pointer;
  transition:
    border-color 0.2s,
    color 0.2s;
}

.cart-item__remove:hover {
  border-color: #e53e3e;
  color: #e53e3e;
}

/* =========================================
   クーポン
========================================= */
.cart-coupon {
  margin-top: 24px;
  padding: 20px;
  background: #fafaf8;
  border: 1px solid #e8e8e4;
  border-radius: 8px;
}

.cart-coupon__label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.cart-coupon__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cart-coupon__input {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s;
}

.cart-coupon__input:focus {
  border-color: #1a1a1a;
}

.cart-coupon__message {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: #2f855a;
  min-height: 1.4em;
}

.cart-coupon__message--error {
  color: #c53030;
}

/* =========================================
   合計
========================================= */
.cart-totals {
  margin-top: 24px;
}

.cart-totals__list {
  border-top: 1px solid #e8e8e4;
}

.cart-totals__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #e8e8e4;
  font-size: 0.9375rem;
}

.cart-totals__row--discount dd {
  color: #c53030;
  font-weight: 600;
}

.cart-totals__row--total {
  font-size: 1.125rem;
  font-weight: 700;
}

.cart-totals__note {
  font-size: 0.75rem;
  font-weight: 400;
  color: #888;
  margin-left: 2px;
}

/* =========================================
   お客様情報フォーム
========================================= */
.cart-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cart-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .cart-form__grid {
    grid-template-columns: 1fr;
  }
}

.cart-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cart-field__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #333;
}

.cart-field__input {
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.cart-field__input:focus {
  border-color: #1a1a1a;
}

.cart-field__input--date {
  max-width: 220px;
}

.cart-field.has-error .cart-field__input {
  border-color: #e53e3e;
}

.cart-field__error {
  font-size: 0.8125rem;
  color: #c53030;
  margin: 0;
}

.cart-field__note {
  font-size: 0.8125rem;
  color: #777;
  margin: 0;
}

/* 葬儀日の行 */
.cart-field__date-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* チェックボックスラベル */
.cart-field__checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  cursor: pointer;
}

.cart-field__checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.cart-field--privacy {
  padding: 16px;
  background: #fafaf8;
  border: 1px solid #e8e8e4;
  border-radius: 6px;
}

.cart-field__checkbox-label--privacy {
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .cart-field__checkbox-label--privacy {
    font-size: 0.6rem;
  }
}

.cart-field__checkbox-label--privacy a {
  color: inherit;
  text-decoration: underline;
}

/* 必須・任意バッジ */
.is-required {
  display: inline-block;
  padding: 1px 6px;
  background: #c53030;
  color: #fff;
  font-size: 0.6875rem;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

.cart-form__actions {
  padding-top: 8px;
  text-align: center;
}

/* =========================================
   確認画面
========================================= */
.cart-confirm {
  border-top: 1px solid #e8e8e4;
  margin: 0;
}

.cart-confirm__row {
  display: flex;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid #e8e8e4;
  font-size: 0.9375rem;
}

.cart-confirm__row dt {
  flex-shrink: 0;
  width: 140px;
  font-weight: 600;
  color: #555;
}

.cart-confirm__row dd {
  flex: 1;
  margin: 0;
}

@media (max-width: 600px) {
  .cart-confirm__row {
    flex-direction: column;
    gap: 4px;
  }
  .cart-confirm__row dt {
    width: auto;
  }
}

/* アクションボタン */
.cart-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}

.cart-actions__note {
  text-align: center;
  font-size: 0.875rem;
  color: #777;
  margin-top: 16px;
}

/* =========================================
   完了画面
========================================= */
.cart-complete {
  text-align: center;
  padding: 48px 16px;
}

.cart-complete__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 24px;
  color: #2f855a;
}

.cart-complete__icon svg {
  width: 100%;
  height: 100%;
}

.cart-complete__heading {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
}

.cart-complete__body {
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.8;
  color: #444;
}

.cart-complete__body p + p {
  margin-top: 12px;
}

.cart-complete__actions {
  margin-top: 32px;
}

/* =========================================
   トースト通知
========================================= */
.cart-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  opacity: 0;
  transition:
    opacity 0.3s,
    transform 0.3s;
  z-index: 9999;
  pointer-events: none;
  white-space: nowrap;
}

.cart-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cart-toast--success {
  background: #276749;
}

.cart-toast--warning {
  background: #b7791f;
}

.cart-toast--error {
  background: #c53030;
}
