/*!
 * tecnest.biz/shop/ Styles
 * 材料販売HP スタイル(WordPress固定ページに埋込)
 */

/* 2026-04-23 健太郎提案「白か黒にしたら」: ライトモード固定に変更
   スマホのOSダークモード設定でも、HPは白背景+濃色文字で表示される。
   これで同化問題が構造的に発生しなくなる(ダークモード対応@mediaを残していてもこれが優先) */
:root {
  color-scheme: only light;
}

#shop-app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: #222;
  line-height: 1.7;
}

#shop-app h2 {
  color: #0d2b52;
  border-bottom: 3px solid #0d2b52;
  padding-bottom: 8px;
  margin-bottom: 20px;
  font-size: 1.6em;
}

#shop-app h3 {
  color: #0d2b52;
  margin-top: 32px;
  border-left: 4px solid #0d2b52;
  padding-left: 10px;
  font-size: 1.2em;
}

/* 冒頭の送料・支払・納期案内 */
.shop-notice {
  background: #f0f4fa;
  border: 1px solid #c7d4e8;
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.95em;
}
.shop-notice strong {
  color: #0d2b52;
}
/* 商品画像について ブロック(ベージュ基調・ライトモード) */
.shop-notice.image-note {
  background: #f7f3ee;
  border-color: #d8c7a8;
}
/* 2026-04-23 同化解消: 送料注記等の小さい注釈テキスト(インラインstyle廃止) */
.shop-notice .sub-note,
.sub-note {
  font-size: 0.9em;
  color: #111;  /* ライトモード標準 */
}
/* cart-hint 品番入力下の注釈 */
.cart-hint {
  font-size: 0.85em;
  color: #111;
  margin: 4px 0 0;
}
/* 特商法ページ 電話番号セル */
.tel-cell {
  font-size: 0.9em;
  color: #111;
}

/* カートテーブル */
#cart-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
#cart-table th,
#cart-table td {
  padding: 10px 8px;
  border-bottom: 1px solid #ddd;
  text-align: left;
  vertical-align: middle;
}
/* 2026-04-20 行高さ安定化(バリアント/計算式/特殊note出入りで行がガクッと動くのを緩和) */
#cart-table tbody tr {
  min-height: 88px;
}
#cart-table tbody td {
  min-height: 72px;
  vertical-align: top;
}
#cart-table .td-name {
  min-height: 66px;
  line-height: 1.55;
}
#cart-table th {
  background: #f7f8fa;
  font-size: 0.9em;
  color: #111;
}
#cart-table .td-unit,
#cart-table .td-sub {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
#cart-table .in-pn {
  width: 100%;
  min-width: 120px;
  padding: 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 16px; /* iOS zoom回避 */
}
#cart-table .in-m {
  width: 60px;
  padding: 8px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 16px;
  text-align: right;
}
#cart-table .btn-del {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #ccc;
  background: #fff;
  color: #999;
  cursor: pointer;
  font-size: 1.1em;
}
#cart-table .btn-del:hover {
  background: #ffeaea;
  color: #c53030;
  border-color: #c53030;
}
#cart-table .err {
  color: #c53030;
  font-weight: bold;
}
#cart-table .muted {
  color: #999;
}

#btn-add-row {
  display: inline-block;
  padding: 10px 20px;
  background: #fff;
  border: 2px dashed #0d2b52;
  border-radius: 6px;
  color: #0d2b52;
  cursor: pointer;
  font-size: 1em;
  font-weight: bold;
  margin: 8px 0 24px;
}
#btn-add-row:hover {
  background: #0d2b52;
  color: #fff;
}

/* 合計ボックス */
#totals-box {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 18px 22px;
  margin: 20px 0;
}
#totals-box > div {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.95em;
}
#totals-box .grand {
  border-top: 2px solid #0d2b52;
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1.25em;
  font-weight: bold;
  color: #0d2b52;
}

/* 承諾文 */
.consent-box {
  background: #fff8e6;
  border: 1px solid #f5b800;
  border-radius: 8px;
  padding: 18px 22px;
  margin: 24px 0;
}
.consent-box h3 {
  border: none;
  padding: 0;
  margin: 0 0 12px;
  color: #8b6500;
  font-size: 1.1em;
}
.consent-box label {
  display: block;
  padding: 8px 0;
  cursor: pointer;
  font-size: 0.95em;
  line-height: 1.6;
}
.consent-box label:hover {
  background: #fff4d0;
}
.consent-box input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin-right: 10px;
  vertical-align: middle;
  cursor: pointer;
}
.consent-box strong {
  color: #8b6500;
}
.consent-box a {
  color: #0d2b52;
  text-decoration: underline;
}

/* ▼ 2026-04-20 規約同意ダイアログ(tamatuf方式・スクロール最下部でチェック有効化) ▼ */

.shop-subheader {
  background: #f7f9fc;
  border-left: 3px solid #0d2b52;
  padding: 10px 14px;
  margin: -10px 0 22px;
  font-size: 0.93em;
  line-height: 1.75;
  color: #111;
}
.shop-subheader strong {
  color: #0d2b52;
  display: inline-block;
  min-width: 11em;
}

.consent-instruction {
  margin: 8px 0 10px;
  font-size: 0.95em;
  color: #111;
}
.consent-instruction strong {
  color: #c53030;
}

.consent-scroll {
  border: 1px solid #c7d4e8;
  border-radius: 6px;
  width: 100%;
  max-height: min(50vh, 360px);
  overflow-y: scroll;
  padding: 14px 18px;
  background: #fff;
  font-size: 0.92em;
  line-height: 1.75;
  color: #111;
  outline: none;
}
.consent-scroll:focus {
  border-color: #0d2b52;
  box-shadow: 0 0 0 2px rgba(26, 58, 92, 0.15);
}
.consent-scroll h4 {
  color: #0d2b52;
  font-size: 1em;
  margin: 18px 0 8px;
  padding: 0;
  border: none;
}
.consent-scroll h4:first-child { margin-top: 0; }
.consent-scroll p,
.consent-scroll ul,
.consent-scroll ol {
  margin: 6px 0;
}
.consent-scroll ul,
.consent-scroll ol {
  padding-left: 1.4em;
}
.consent-scroll strong {
  color: #0d2b52;
}
.consent-scroll .tokushoho-list {
  display: grid;
  grid-template-columns: 12em 1fr;
  gap: 4px 12px;
  margin: 6px 0;
}
.consent-scroll .tokushoho-list dt {
  color: #111;
  font-size: 0.92em;
  padding: 3px 0;
}
.consent-scroll .tokushoho-list dd {
  margin: 0;
  padding: 3px 0;
  border-bottom: 1px dotted #ddd;
}
.consent-scroll .consent-end-mark {
  margin-top: 22px;
  text-align: center;
  color: #111;
  font-size: 0.9em;
  letter-spacing: 0.1em;
}

#consent-wrap {
  margin: 16px 0 24px;
  padding: 14px 18px;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  transition: all 0.2s;
}
#consent-wrap.check-disabled {
  color: #afafaf;
  opacity: 0.75;
}
#consent-wrap.check-enabled {
  border-color: #0d2b52;
  background: #f0f4fa;
}
#consent-wrap label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1.02em;
}
#consent-wrap input[type="checkbox"] {
  width: 24px;
  height: 24px;
  margin-right: 12px;
  cursor: pointer;
}
#consent-wrap input[type="checkbox"]:disabled {
  cursor: not-allowed;
}

/* ▼ カート品番入力の状態表示(未登録品番/自動見積) ▼ */
#cart-table .td-name.pn-not-found {
  color: #c53030;
  font-size: 0.88em;
}
#cart-table .td-name.pn-multi {
  color: #8b6500;
  font-size: 0.88em;
}
/* 2026-04-20 追加: 特殊掛率品の警告(赤文字) */
#cart-table .td-name .special-warn {
  color: #c53030;
  font-size: 0.88em;
  font-weight: bold;
  margin-bottom: 4px;
  padding: 2px 6px;
  background: #ffe8e8;
  border-left: 3px solid #c53030;
  border-radius: 3px;
}
/* 2026-04-20 変更: 登録品番でも関連バリアント(AR/NEO等)提案を表示 */
#cart-table .td-name .variant-hint {
  margin-top: 4px;
  padding: 4px 8px;
  background: #fff8e6;
  border-left: 3px solid #f5b800;
  color: #8b6500;
  font-size: 0.82em;
  line-height: 1.45;
  border-radius: 3px;
}
/* 2026-04-23 HPI-11b: サジェスト候補を選択可能ボタン化(美砂さん指摘・タップで入力切替) */
#cart-table .pn-suggest-btn {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 5px 10px;
  font-size: 0.92em;
  color: #0d2b52;
  background: #f0f4fa;
  border: 1px solid #b5c5dd;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  white-space: nowrap;
  touch-action: manipulation;
}
#cart-table .pn-suggest-btn:hover,
#cart-table .pn-suggest-btn:active {
  background: #0d2b52;
  color: #fff;
  border-color: #0d2b52;
}
#cart-table .variant-hint {
  /* ボタンの改行対応 */
  word-break: break-word;
  overflow-wrap: anywhere;
}
#cart-table .td-joutai,
#cart-table .td-ppt {
  font-size: 0.88em;
  color: #111;  /* ライトモード標準・ダークモード対応は下部メディアクエリで上書き */
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* 2026-04-23 HPI-23: 規格幅ドロップダウン(ガラスフィルム複数幅対応) */
#cart-table .td-joutai .width-select,
#cart-table .td-joutai .width-static {
  margin-top: 4px;
  font-size: 0.82em;
  color: #111;
  white-space: nowrap;
}
#cart-table .in-width {
  padding: 4px 6px;
  border: 1px solid #b5c5dd;
  border-radius: 4px;
  background: #fff;
  font-size: 0.95em;
  color: #0d2b52;
  cursor: pointer;
  font-family: inherit;
}
#cart-table .in-width:focus {
  outline: 2px solid #0d2b52;
  outline-offset: 1px;
}
/* 2026-04-23 HPI-10: m単価セル(td-unit) スマホ/狭幅でのはみ出し対策 */
#cart-table .td-unit {
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
/* 2026-04-23 HPI-6+: 商品名表示(オルティノのみ・ソース明確品番用) */
#cart-table .pn-brand .pn-product-name {
  font-size: 1.05em;
  font-weight: 700;
  color: #0d2b52;
  line-height: 1.3;
  margin-bottom: 2px;
}
#cart-table .pn-brand .pn-brand-sub {
  font-size: 0.82em;
  color: #111;
  line-height: 1.3;
}
/* 2026-04-23 HPI-13: メーカー公式サイトへのリンク("柄を見る→") */
#cart-table .pn-brand .official-link {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.82em;
  color: #0a5cad;
  text-decoration: underline;
  font-weight: normal;
  white-space: nowrap;
}
#cart-table .pn-brand .official-link:hover {
  color: #0d2b52;
  background: #f0f4fa;
}
/* 2026-04-20: m単価セル下の計算式ヒント(上代×1.2×掛率) */
/* 2026-04-23 HPI-10: スマホ枠はみ出し対策・折り返し許容 */
#cart-table .td-unit .unit-formula {
  margin-top: 2px;
  font-size: 0.72em;
  color: #111;  /* HPI-14 紺色見にくい対応・グレーのコントラスト上げ #888→#555 */
  font-weight: normal;
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
/* 2026-04-20 商品名列廃止→品番セル内に集約 */
#cart-table .pn-brand {
  font-size: 0.98em;
  font-weight: bold;
  color: #0d2b52;
  margin-bottom: 4px;
  line-height: 1.3;
}
#cart-table .pn-suggest-slot .pn-suggest {
  margin-top: 4px;
  font-size: 0.82em;
  line-height: 1.45;
  /* 2026-04-23 HPI-11修正: サジェスト候補がスマホ幅にはみ出す問題対応(美砂さん指摘) */
  word-break: break-word;
  overflow-wrap: anywhere;
  white-space: normal;
  max-width: 100%;
}
#cart-table .pn-suggest-slot {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
#cart-table .pn-suggest-slot .pn-suggest strong {
  display: inline;
  word-break: break-word;
}
#cart-table .pn-suggest-slot .pn-suggest.muted {
  color: #999;
}
#cart-table .pn-suggest-slot .pn-suggest.not-found {
  color: #c53030;
}

/* 2026-04-20: 品番セルinput下の特殊掛率品note(赤文字) */
#cart-table .pn-warn-slot {
  margin-top: 4px;
}
#cart-table .pn-warn-slot .special-warn {
  color: #c53030;
  font-size: 0.85em;
  font-weight: bold;
  padding: 3px 6px;
  background: #ffe8e8;
  border-left: 3px solid #c53030;
  border-radius: 3px;
  line-height: 1.35;
}
.auto-quote-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  font-size: 0.88em;
  color: #111;
  cursor: pointer;
  user-select: none;
}
.auto-quote-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

@media (prefers-color-scheme: dark) {
  .consent-scroll {
    background: #111827;
    border-color: #334155;
    color: #d1d5db;
  }
  .consent-scroll .tokushoho-list dd {
    border-bottom-color: #334155;
  }
  #consent-wrap {
    background: #111827;
    border-color: #334155;
  }
  #consent-wrap.check-enabled {
    background: #1e293b;
  }
  .shop-subheader {
    background: #1e293b;
    color: #d1d5db;
  }
}

/* 顧客情報フォーム */
#order-form {
  margin: 24px 0;
}
#order-form label {
  display: block;
  margin: 14px 0;
  font-size: 0.95em;
}
#order-form label > input,
#order-form label > textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid #bbb;
  border-radius: 4px;
  font-size: 16px; /* iOS zoom回避 */
  font-family: inherit;
}
#order-form textarea {
  min-height: 80px;
  resize: vertical;
}
#order-form input:focus,
#order-form textarea:focus {
  outline: 2px solid #0d2b52;
  outline-offset: 2px;
  border-color: #0d2b52;
}

/* 送信ボタン */
#btn-submit {
  display: block;
  width: 100%;
  padding: 16px;
  background: #0d2b52;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 1.15em;
  font-weight: bold;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.15s;
}
#btn-submit:not(:disabled):hover {
  background: #0f2e5c;
}
#btn-submit:disabled {
  background: #bbb;
  cursor: not-allowed;
}
#submit-hint {
  margin-top: 8px;
  color: #c53030;
  font-size: 0.9em;
  text-align: center;
  min-height: 1.2em;
}

/* 2026-04-23 T221: スケジュール予告バナー(メンテ前にページ上部sticky表示) */
.scheduled-banner {
  background: #fff3cd;
  border-bottom: 3px solid #f5b800;
  color: #664d03;
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95em;
  line-height: 1.5;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.scheduled-banner .time { color: #8b0000; font-weight: 700; }

/* 緊急停止バナー(BCP対応) */
.suspended-banner {
  max-width: 600px;
  margin: 40px auto;
  background: #fff8e6;
  border: 2px solid #f5b800;
  border-radius: 8px;
  padding: 40px 32px;
  text-align: center;
}
.suspended-banner h2 {
  color: #8b6500;
  border: none;
  padding: 0;
  margin: 0 0 20px;
  font-size: 1.4em;
}
.suspended-banner p {
  margin: 12px 0;
  color: #5c4200;
  font-size: 1em;
  line-height: 1.7;
}
.suspended-banner .contact {
  background: #fff;
  border: 1px solid #e5d4a3;
  border-radius: 6px;
  padding: 16px;
  margin: 24px auto;
  max-width: 400px;
  text-align: left;
  font-size: 0.95em;
}
.suspended-banner .contact a {
  color: #0d2b52;
  text-decoration: underline;
}
.suspended-banner .note {
  margin-top: 24px;
  font-size: 0.85em;
  color: #6c757d;
}

/* エラー状態 */
.fatal-error {
  background: #ffe5e5;
  border: 2px solid #c53030;
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: #c53030;
  font-size: 1.05em;
}
.fatal-error button {
  display: block;
  margin: 16px auto 0;
  padding: 10px 24px;
  background: #c53030;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1em;
  cursor: pointer;
}

/* モバイル最適化(2026-04-20改修: cart-table を縦積みレイアウトに) */
@media (max-width: 640px) {
  #shop-app {
    padding: 12px;
  }
  #shop-app h2 {
    font-size: 1.25em;
    line-height: 1.4;
  }
  #shop-app h3 {
    font-size: 1.05em;
  }
  .consent-box label {
    font-size: 0.9em;
  }
  #btn-submit {
    font-size: 1.05em;
    padding: 14px;
  }

  /* cart-table を1行=1カード形式に変換 */
  #cart-table,
  #cart-table thead,
  #cart-table tbody,
  #cart-table tr {
    display: block;
    width: 100%;
  }
  #cart-table thead {
    display: none; /* 列見出しは非表示にしてラベルをtdに持たせる */
  }
  #cart-table tr {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #fff;
    position: relative;
  }
  #cart-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: none;
    gap: 8px;
  }
  #cart-table td::before {
    content: attr(data-label);
    font-size: 0.82em;
    color: #111;
    font-weight: bold;
    min-width: 5.5em;
    flex-shrink: 0;
  }
  #cart-table .td-name {
    display: block;
    padding: 6px 0 2px;
    font-size: 0.95em;
    line-height: 1.5;
  }
  #cart-table .td-name::before {
    display: none; /* 商品名セルはラベル不要・全幅で表示 */
  }
  /* 品番セルだけ block にして input をフル幅化(スマホ対応 2026-04-20) */
  #cart-table td[data-label="品番"] {
    display: block;
    padding: 10px 0 8px;
  }
  #cart-table td[data-label="品番"]::before {
    display: block;
    margin-bottom: 6px;
  }
  #cart-table .in-pn {
    display: block;
    width: 100%;
    min-width: 0;
    font-size: 16px; /* iOS Safari でズーム暴走防止 */
    padding: 10px 12px;
    min-height: 44px; /* タッチ操作 */
    box-sizing: border-box;
    margin-top: 2px;
  }
  #cart-table .pn-warn-slot,
  #cart-table .pn-suggest-slot {
    display: block;
    width: 100%;
    margin-top: 6px;
  }
  #cart-table .in-m {
    width: 90px;
    min-height: 40px;
    font-size: 16px;
    padding: 8px 10px;
    text-align: right;
    box-sizing: border-box;
  }
  #cart-table .td-unit,
  #cart-table .td-sub {
    text-align: right;
  }
  #cart-table .btn-del {
    position: absolute;
    top: 6px;
    right: 6px;
  }

  @media (prefers-color-scheme: dark) {
    #cart-table tr {
      background: #1f2937;
      border-color: #374151;
    }
    #cart-table td::before {
      color: #9ca3af;
    }
  }
}

/* ダークモード対応(OS設定に追随) */
@media (prefers-color-scheme: dark) {
  #shop-app {
    color: #e5e7eb;
  }
  #cart-table th {
    background: #1f2937;
    color: #9ca3af;
  }
  #totals-box {
    background: #111827;
    border-color: #374151;
  }
  .shop-notice {
    background: #1e293b;
    border-color: #334155;
  }
  /* 2026-04-23 同化解消: ダークモード下で .shop-notice strong が#0d2b52=ほぼ背景同色だった */
  .shop-notice strong {
    color: #ffd54f;  /* 黄色アクセント・視認性最大 */
  }
  /* 送料注記・小さい注釈もダークモード可読色へ */
  .shop-notice .sub-note {
    color: #cbd5e1;  /* 薄明グレー・濃紺背景で可読 */
  }
  /* 2026-04-23 追加同化解消: 商品画像ブロック(ベージュインラインstyle廃止→image-noteクラス) */
  .shop-notice.image-note {
    background: #2d2419;
    border-color: #8b6500;
    color: #fbbf24;
  }
  .shop-notice.image-note strong {
    color: #fcd34d;
  }
  .shop-notice.image-note a {
    color: #60a5fa;
  }
  /* shop-subheader(化粧フィルム/ガラスフィルムの紹介ブロック) */
  .shop-subheader strong {
    color: #ffd54f;  /* ダークモード下で#0d2b52→黄色に */
  }
  /* consent-scroll 内の見出し/強調 */
  .consent-scroll h4 {
    color: #ffd54f;
  }
  .consent-scroll strong {
    color: #ffd54f;
  }
  .consent-box {
    background: #2d2419;
    border-color: #8b6500;
  }
  #order-form input,
  #order-form textarea,
  #cart-table .in-pn,
  #cart-table .in-m {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #4b5563;
  }
  /* 2026-04-23 同化解消: cart-tableテキストセル全般を明色化(濃紺背景下) */
  #cart-table .td-joutai,
  #cart-table .td-ppt {
    color: #e5e7eb;
  }
  #cart-table .td-joutai .width-select,
  #cart-table .td-joutai .width-static {
    color: #e5e7eb;
  }
  #cart-table .td-unit .unit-formula {
    color: #b0bec5;
  }
  /* バリアントヒント/注釈系 */
  #cart-table .variant-hint,
  #cart-table .pn-suggest-slot .pn-suggest {
    color: #e5e7eb;
  }
  #cart-table .pn-suggest-slot .pn-suggest.muted {
    color: #9ca3af;
  }
  /* 「柄を見る→」リンク */
  #cart-table .pn-brand .official-link {
    color: #60a5fa;
  }
  #cart-table .pn-brand .official-link:hover {
    color: #93c5fd;
  }
}
