/*============================================================
  ショップ（商品一覧）セクション表示用
  編集・プレビュー・公開で共通のデザイン
  - タイトル: 横中央寄せ、weight 700、size 32px
  - カード（2件以上）: 横230px・縦370px、radius 4px
  - カード（公開商品がちょうど1件）: 横640px・縦160px、radius 4px・画像左160×160
  - 画像: 縦横230px（複数件時） / 160×160（1件時）
  - 商品名: weight 700、size 16px
  - 価格: weight 400、size 16px
  - カート追加ボタン: #0AC4DD、86px×32px、左寄せ
  - 商品同士の間隔: gap 32px
*============================================================*/

/* セクション両端の余白はグリッドを中央寄せで確保。商品同士は32px */
.maqe-shop .shop-products-inner {
  padding: 16px 24px;
  max-width: 1016px;
  margin-left: auto;
  margin-right: auto;
}

.maqe-shop .shop-products-title {
  text-align: center;
  font-weight: 700;
  font-size: 32px;
  margin: 0 0 40px;
  padding: 0 8px;
  color: #000;
}

/* 4列×230px + 間隔32px×3 = 1016px（プレビュー・公開ではメディアクエリでレスポンシブ） */
.maqe-shop .shop-products-grid {
  display: grid;
  gap: 32px !important;
  grid-template-columns: repeat(4, 230px);
  justify-content: center;
  width: 1016px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* 公開商品が1件のときのみ付与されるグリッド：Figma 640幅・横長カード1枚 */
.maqe-shop .shop-products-grid--single {
  /* 1列レイアウト */
  grid-template-columns: 1fr;
  /* カードを行の中央に置く */
  justify-items: center;
  /* デザイン指定のグリッド幅 */
  width: 640px;
  /* 狭い画面では親要素内に収める */
  max-width: 100%;
  /* 水平方向センタリング */
  margin-left: auto;
  /* 水平方向センタリング */
  margin-right: auto;
  /* 1枚のみのためカード間 gap は不要 */
  gap: 0;
  /* 幅計算にパディングを含める */
  box-sizing: border-box;
}

/* 1件時の商品カード本体：640×160・横並び・角丸4px */
.maqe-shop .shop-products-grid--single .shop-product-card {
  /* 指定横幅 */
  width: 640px;
  /* ビューポートが狭いときは縮小 */
  max-width: 100%;
  /* 指定高さ */
  height: 160px;
  /* 画像左・テキスト右 */
  flex-direction: row;
  /* Figma の角丸値 */
  border-radius: 4px;
  /* 幅計算の一貫性 */
  box-sizing: border-box;
}

/* 1件時のサムネイル枠：左160×160固定 */
.maqe-shop .shop-products-grid--single .shop-product-card-img-wrap {
  /* 左カラム幅 */
  width: 160px;
  /* カード高に合わせる */
  height: 160px;
  /* 横並びで潰さない */
  flex-shrink: 0;
}

/* 1件時のテキストエリア：右側で縦に積みボタンを下へ */
.maqe-shop .shop-products-grid--single .shop-product-card-body {
  /* 残り幅をテキスト側に割り当て */
  flex: 1;
  /* 長い商品名の省略に必要 */
  min-width: 0;
  /* 高さ内に収める余白 */
  padding: 10px 16px 12px 12px;
  /* 上から順に配置し最後を auto で下押し */
  justify-content: flex-start;
}

/* 1件時は高さ制約のため商品名は最大1行 */
.maqe-shop .shop-products-grid--single .shop-product-card-name,
.maqe-shop .shop-products-grid--single .shop-product-card-link.shop-product-card-name {
  /* 1行で切り詰め */
  -webkit-line-clamp: 1;
  /* 下余白を詰める */
  margin: 0 0 4px 0;
  /* 2行分の min-height を解除 */
  min-height: 0;
}

/* 1件時の価格行の下余白 */
.maqe-shop .shop-products-grid--single .shop-product-card-price {
  /* ボタンとの間隔 */
  margin: 0 0 8px 0;
}

/* 1件時：カートボタンをカード下端付近（右カラム内）に配置 */
.maqe-shop .shop-products-grid--single .shop-product-card-btn {
  /* 上のコンテンツの下に押し下げ */
  margin-top: auto;
  /* 左寄せのまま */
  align-self: flex-start;
}

.maqe-shop .shop-products-grid--row {
  grid-template-columns: repeat(4, 230px);
  width: 1016px;
  margin-left: auto;
  margin-right: auto;
}

.maqe-shop .shop-product-card {
  width: 230px;
  height: 370px;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.maqe-shop .shop-product-card-img-wrap {
  width: 230px;
  height: 230px;
  flex-shrink: 0;
  overflow: hidden;
  background: #f5f5f5;
}

.maqe-shop .shop-product-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.maqe-shop .shop-product-card-body {
  flex: 1;
  padding: 8px 8px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.maqe-shop .shop-product-card-name,
.maqe-shop .shop-product-card-link.shop-product-card-name {
  font-weight: 700;
  font-size: 16px;
  margin: 0 0 8px;
  line-height: 1.4;
  color: #000;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.maqe-shop .shop-product-card-link {
  text-decoration: none;
  color: inherit;
}

.maqe-shop .shop-product-card-link:hover {
  text-decoration: underline;
  color: inherit;
}

.maqe-shop .shop-product-card-price {
  font-weight: 400;
  font-size: 16px;
  margin: 0 0 12px;
  color: #000;
}

.maqe-shop .shop-product-card-btn {
  width: 86px;
  height: 32px;
  padding: 0;
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  background: #0AC4DD;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-decoration: none;
}
.maqe-shop .shop-product-card-btn:hover {
  color: #fff;
  opacity: 0.9;
}

/* 在庫切れ：カート追加をグレーアウトしクリックを CSS でも無効化（JS と併用） */
.maqe-shop .shop-product-card-btn.shop-product-card-btn--out-of-stock {
  background: #c4c4c4 !important;
  color: #666 !important;
  cursor: not-allowed;
  pointer-events: none;
  opacity: 1;
}
.maqe-shop .shop-product-card-btn.shop-product-card-btn--out-of-stock:hover {
  color: #666 !important;
  opacity: 1;
}

/* 12件超：13件目以降カードを非表示（公開は「さらに表示」で JS がクラス除去、編集・プレビューは常にこのまま） */
.maqe-shop .shop-product-card--more-collapsed {
  /* 折りたたみ対象をレイアウトから外す */
  display: none !important;
}

/* 「さらに表示」ブロックをグリッド下に中央配置 */
.maqe-shop .shop-products-show-more-wrap {
  /* 上マージン（グリッドとの間隔） */
  margin-top: 32px;
  /* ボタンを中央に */
  text-align: center;
  /* ラッパーを行全体に伸ばす */
  width: 100%;
}

/* 「さらに表示」ボタン（背景・文字色は HTML インライン style 優先、未設定時はアクセント） */
.maqe-shop .shop-products-show-more-btn {
  /* 既定の塗り（インラインが無い場合） */
  background: #0AC4DD;
  /* 既定の文字色 */
  color: #fff;
  /* Figma 角丸 4px */
  border-radius: 4px;
  /* 境界線なし */
  border: none;
  /* ポインタ表示 */
  cursor: pointer;
  /* クリック領域の最小幅 */
  min-width: 140px;
  /* 高さ */
  height: 44px;
  /* 左右余白 */
  padding: 0 24px;
  /* フォントサイズ */
  font-size: 14px;
  /* 太さ */
  font-weight: 600;
  /* ボックス計算 */
  box-sizing: border-box;
}

.maqe-shop .shop-products-show-more-btn:hover {
  /* ホバー時のフィードバック */
  opacity: 0.9;
}

/* 商品一覧ページへの導線（「最新4つまで」+ チェック時のみ表示） */
.maqe-shop .shop-products-list-link-wrap {
  text-align: center;
  margin-top: 32px;
}

.maqe-shop .shop-products-list-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 140px;
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #0AC4DD;
  border-radius: 8px;
  text-decoration: none;
  box-sizing: border-box;
  transition: background-color 0.2s;
}

.maqe-shop .shop-products-list-link-btn:hover {
  background: #09a9bf;
  color: #fff;
}

/*============================================================
  プレビュー・公開サイト用レスポンシブ（gap 32px 維持）
*============================================================*/

/* タブレット: 2列（230×2 + 32 = 492px） */
@media (max-width: 1024px) {
  .maqe-shop .shop-products-inner {
    max-width: 492px;
  }

  /* 公開1件時：2列用492px上限を外し640カードを載せられる幅にする */
  .maqe-shop .shop-products-inner--single {
    max-width: 1016px;
  }

  /* parts 未再生成時も grid--single があれば inner 幅を広げる */
  .maqe-shop .shop-products-inner:has(.shop-products-grid--single) {
    max-width: 1016px;
  }

  .maqe-shop .shop-products-grid,
  .maqe-shop .shop-products-grid--row {
    grid-template-columns: repeat(2, 230px);
    width: 492px;
    max-width: 100%;
  }
}

/* スマホ: 1列（230px） */
@media (max-width: 560px) {
  .maqe-shop .shop-products-inner {
    max-width: 230px;
    padding-left: 16px;
    padding-right: 16px;
  }

  /* 公開1件時：230px制限を解除して横長カードを表示する */
  .maqe-shop .shop-products-inner--single {
    max-width: 100%;
  }

  /* parts 未再生成時も1件グリッドなら inner を全幅扱いにする */
  .maqe-shop .shop-products-inner:has(.shop-products-grid--single) {
    max-width: 100%;
  }

  .maqe-shop .shop-products-grid,
  .maqe-shop .shop-products-grid--row {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 230px;
    justify-items: center;
  }

  .maqe-shop .shop-products-title {
    font-size: 24px;
    margin-bottom: 24px;
  }

  .maqe-shop .shop-product-card {
    width: 100%;
    max-width: 230px;
  }

  .maqe-shop .shop-product-card-img-wrap {
    width: 100%;
    aspect-ratio: 1;
    height: auto;
  }

  /* 公開1件：上記230px縦カード用ルールを上書きし640基準の横並びを維持 */
  .maqe-shop .shop-products-grid--single {
    /* 親幅いっぱいに近づける */
    width: 100%;
    /* 230px 上限を外す */
    max-width: 100%;
  }

  .maqe-shop .shop-products-grid--single .shop-product-card {
    /* 230px 上限を外す */
    max-width: 100%;
    /* 狭い画面では親幅に追従 */
    width: 100%;
    /* 極端に潰れる場合に備え最小高さ */
    height: auto;
    min-height: 160px;
    /* 横並びを維持 */
    flex-direction: row;
  }

  .maqe-shop .shop-products-grid--single .shop-product-card-img-wrap {
    /* 縦積み用の 100% 幅を打ち消す */
    width: 160px;
    /* 極窄幅では画像をやや縮小 */
    max-width: 40%;
    min-width: 96px;
    /* 高さはカードに合わせる */
    height: 160px;
    /* aspect-ratio 指定を無効化 */
    aspect-ratio: unset;
    /* 横並びで潰さない */
    flex-shrink: 0;
  }
}

/*============================================================
  ショップ用フッター法務リンク（特定商取引法に基づく表記 | 利用規約）
  フッター背景が白・明るい場合は濃い色、黒帯の場合は .footer-dark で上書き可能
*============================================================*/
.shop-footer-legal-links {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 20px;
  margin-bottom: 8px;
  color: #333;
  font-size: 14px;
}

.shop-footer-legal-links a {
  color: inherit;
  text-decoration: none;
}

.shop-footer-legal-links a:hover {
  text-decoration: underline;
}

.shop-footer-legal-sep {
  margin: 0 8px;
  opacity: 0.85;
}

/* ========== 注文完了ページ /shop/checkout/complete ========== */
.shop-checkout-complete-page .shop-checkout-complete-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px 80px;
  box-sizing: border-box;
  text-align: center;
}

.shop-checkout-complete-heading {
  margin: 0 0 16px;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  color: #1e2023;
}

/* 見出し直下の区切り（タイトル行幅に近い max-width で中央寄せ） */
.shop-checkout-complete-divider {
  width: 100%;
  margin: 0 auto 20px;
  border: 0;
  border-top: 1px solid #dfdfdf;
}

/* サンクス：メインより一段小さく太字（デザインの階層） */
.shop-checkout-complete-lead {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  color: #1e2023;
}

.shop-checkout-complete-order-badge {
  display: inline-block;
  margin: 0 0 28px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: #fff;
  background: #525252;
  border-radius: 8px;
}

.shop-checkout-complete-messages {
  margin: 0 0 32px;
  text-align: left;
}

/* 2文を詰めて表示するため段落間マージンは付けない */
.shop-checkout-complete-messages p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #1e2023;
}

/* 連続する p 同士でも隙間を開けない */
.shop-checkout-complete-messages p + p {
  margin-top: 0;
}

/* 注文完了「サイトトップに戻る」：カート追加と同系の角丸4px・高さ44px（色はインライン style で上書き可） */
.shop-checkout-complete-cta {
  /* ボタンとして横並び中央寄せ */
  display: inline-flex;
  /* 縦方向センタリング */
  align-items: center;
  /* 横方向センタリング */
  justify-content: center;
  /* 「さらに表示」ボタンと同じクリック高さ */
  min-height: 44px;
  /* 最小幅は一覧の二次ボタン系に合わせる */
  min-width: 140px;
  /* 左右パディング */
  padding: 0 24px;
  /* カート周りのラベルと同じ 14px */
  font-size: 14px;
  /* さらに表示ボタンと同じ太さ */
  font-weight: 600;
  /* 行の高さ */
  line-height: 1.4;
  /* 枠線なし（塗りボタン） */
  border: none;
  /* 商品カードのカート追加（.shop-product-card-btn）と同じ角丸 */
  border-radius: 4px;
  /* ポインタ */
  cursor: pointer;
  /* リンクの下線を消す */
  text-decoration: none;
  /* 幅計算 */
  box-sizing: border-box;
  /* セクション未設定時の既定はカート既定色と同一 */
  background: #0AC4DD;
  /* 既定の文字色（白）。設定があるときはインラインが優先 */
  color: #fff;
}

.shop-checkout-complete-cta:hover {
  /* カートボタンと同様のホバー */
  opacity: 0.9;
  /* 下線は出さない（文字色は要素本体・インラインに任せる） */
  text-decoration: none;
}

/* 公開サイト：ヘッダーカート押下時のカート内容モーダル */
.maqe-ec-cart-modal {
  /* 初期は非表示（開くときに flex） */
  display: none;
  /* 画面全面にオーバーレイを張る */
  position: fixed;
  /* ビューポート左上に固定 */
  left: 0;
  top: 0;
  /* ビューポート全体を覆う */
  width: 100%;
  height: 100%;
  /* ヘッダーより前面に重ねる */
  z-index: 10050;
  /* 中央にパネルを置く */
  align-items: center;
  justify-content: center;
  /* 背面を半透明グレーにする */
  background: rgba(0, 0, 0, 0.45);
  /* モーダル内スクロール用 */
  box-sizing: border-box;
  padding: 24px 16px;
}

.maqe-ec-cart-modal.is-open {
  /* 開いているときだけ flex で中央寄せ */
  display: flex;
}

.maqe-ec-cart-modal__panel {
  /* 白背景のカード */
  background: #fff;
  /* 角丸 */
  border-radius: 8px;
  /* 最大幅（モックに近い読みやすい幅） */
  max-width: 600px;
  width: 100%;
  /* 縦に長いときはパネル内でスクロール */
  height: 600px;
  overflow: hidden;
  /* 縦レイアウト：ヘッダー・一覧・フッター */
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.maqe-ec-cart-modal__head {
  /* タイトル行の余白 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid #e5e5e5;
}

.maqe-ec-cart-modal__title {
  /* モーダル見出し */
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e2023;
}

.maqe-ec-cart-modal__close {
  /* 閉じるボタン（×） */
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #666;
  padding: 4px 8px;
}

/* 一覧＋フッター＋読み込みオーバーレイをまとめる領域（ヘッダー直下） */
.maqe-ec-cart-modal__main {
  /* パネル内の残り高さをすべて使う */
  flex: 1;
  /* 子の flex 子が縮小できるよう最小高さを 0 にする */
  min-height: 0;
  /* 縦方向に list と foot を積む */
  display: flex;
  flex-direction: column;
  /* 読み込みオーバーレイの基準位置 */
  position: relative;
}

/* 数量変更・削除中に一覧＋フッターの上へ重ねる半透明レイヤー */
.maqe-ec-cart-modal__loading {
  /* 通常は非表示（flex は is-visible で有効化） */
  display: none;
  /* main 全体を覆う */
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  /* GIF と文言を画面中央に */
  align-items: center;
  justify-content: center;
  flex-direction: column;
  /* 背後の一覧が透けて見えないよう白ベース */
  background: rgba(255, 255, 255, 0.92);
  /* 一覧・フッターより手前 */
  z-index: 3;
}

/* 読み込み表示を出すときだけ flex で中央寄せ */
.maqe-ec-cart-modal__loading.is-visible {
  display: flex;
}

/* 管理画面の商品一覧と同じ ansy.gif を 32px で表示 */
.maqe-ec-cart-modal__loading-img {
  display: block;
  width: 32px;
  height: 32px;
  margin-bottom: 12px;
}

/* 読み込み中テキスト */
.maqe-ec-cart-modal__loading-text {
  margin: 0;
  font-size: 14px;
  color: #1e2023;
}

.maqe-ec-cart-modal__list {
  /* 商品行のスクロール領域 */
  overflow-y: auto;
  flex: 1;
  padding: 16px 24px;
  min-height: 120px;
}

.maqe-ec-cart-modal__empty {
  /* カート空メッセージ */
  margin: 0;
  color: #666;
  font-size: 14px;
}

.maqe-ec-cart-modal__row {
  /* 1 商品行：画像・本文・右列（数量・小計・削除） */
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
  align-items: flex-start;
}

.maqe-ec-cart-modal__row:last-child {
  border-bottom: none;
}

.maqe-ec-cart-modal__thumb {
  /* サムネ枠 */
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  background: #f5f5f5;
  border-radius: 4px;
  overflow: hidden;
}

.maqe-ec-cart-modal__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.maqe-ec-cart-modal__row-main {
  /* 商品名・価格・削除のブロック */
  flex: 1 1 140px;
  min-width: 0;
}

.maqe-ec-cart-modal__name {
  font-weight: 700;
  font-size: 14px;
  color: #1e2023;
  line-height: 1.4;
}

.maqe-ec-cart-modal__price {
  font-size: 14px;
  color: #333;
  margin-top: 4px;
}

.maqe-ec-cart-modal__row-side {
  /* 数量・小計・削除を縦積み */
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.maqe-ec-cart-modal__qty {
  /* 数量 ± コントロール */
  display: inline-flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
}

.maqe-ec-cart-modal__qty button {
  width: 32px;
  height: 32px;
  border: none;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #333;
}

.maqe-ec-cart-modal__qty button:disabled {
  opacity: 0.4;
  cursor: default;
}

.maqe-ec-cart-modal__qty span {
  min-width: 28px;
  text-align: center;
  font-size: 14px;
  padding: 0 4px;
}

.maqe-ec-cart-modal__line-total {
  font-size: 14px;
  font-weight: 600;
  color: #1e2023;
  text-align: right;
  white-space: nowrap;
}

.maqe-ec-cart-modal__remove {
  /* 削除リンク風ボタン */
  border: none;
  background: none;
  color: #0ac4dd;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  padding: 0;
}

.maqe-ec-cart-modal__foot {
  /* 合計・注記・購入ボタン */
  padding: 16px 24px 24px;
  border-top: 1px solid #e5e5e5;
  /* 縦に詰まったときもフッターを潰さない */
  flex-shrink: 0;
}

.maqe-ec-cart-modal__total {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  text-align: right;
  color: #1e2023;
}

.maqe-ec-cart-modal__ship-note {
  margin: 0 0 16px;
  font-size: 12px;
  color: #666;
  text-align: right;
}

.maqe-ec-cart-modal__checkout {
  /* 幅いっぱいの主ボタン（色は JS でセクション設定に合わせる） */
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.maqe-ec-cart-modal__checkout:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
