/* ====================================================================
   管理画面の追加CSS。Tabler（/static/vendor/tabler/）の後に読む。
   瀬戸内市場の admin.css から、記事エディタの部分を除いて移植（2026-10-04）

   ==================================================================== */

:root {
  /* Tabler の既定は Inter。日本語の管理画面なのでシステムの和文に寄せる */
  --tblr-font-sans-serif: -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Noto Sans JP", "Segoe UI", Roboto, sans-serif;
  /* 主色は公開側の「ポン」の濃い赤紫 rgb(85,25,55)。白文字が読める */
  --tblr-primary: #551937;
  --tblr-primary-rgb: 85, 25, 55;
  --tblr-primary-darken: #40122a;
  --tblr-primary-fg: #fff;
}

/* 押せるカードはホバーでわずかに浮く */
.card-link { transition: transform .12s ease, box-shadow .12s ease; }
.card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(16, 24, 40, .07), 0 12px 28px rgba(16, 24, 40, .12);
}

/* カードとアラートにごく薄い影。色の付いた背景の上で紙のように浮かせる */
.card, .page-body .alert {
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 6px 18px rgba(16, 24, 40, .08);
}
/* 角丸は公開側のカードと同じ 10px。card-table の行背景が
   角からはみ出して欠けて見えるので、中身ごと角で切り落とす */
.card {
  --tblr-card-border-radius: 10px;
  --tblr-card-inner-border-radius: 9px;
  overflow: hidden;
}
.page-body .alert { border-radius: 10px; }

/* Tabler の .alert は display:flex（アイコン併記用）。アイコンを使わない
   この管理画面では、<strong> や <br> 混じりの文が横に割れるので縦に戻す */
.alert { flex-direction: column; gap: .25rem; }

/* 背景に直接載る場所（見出し・注記）のリンクは下線＋濃色で立てる */
.page-header a:not(.btn), .page-body > .container-xl > p a,
.page-body > .container-xl > .text-secondary a {
  color: var(--tblr-body-color); text-decoration: underline;
}

/* 本体の背景は主色（濃い赤紫）をごく薄くした色。カードの白が浮くように */
.page { background: #f4eef1; }
[data-bs-theme=dark] .page { background: #1e1419; }

/* サイドバーの頭のロゴ */
.navbar-vertical .brand-logo { width: 150px; display: block; margin: 0 auto; }
/* ロゴ下の「管理画面」札。ロゴと間を空け、角丸の罫線で囲う */
.navbar-vertical .brand-tag { display: inline-block; margin-top: 14px;
  padding: 3px 14px; border: 1px solid #c6cdd5; border-radius: 999px;
  font-size: 12px; color: #667382; }
[data-bs-theme=dark] .navbar-vertical .brand-logo {
  /* 黒文字ロゴをダークで白抜きに */
  filter: invert(1) hue-rotate(180deg);
}
.navbar-vertical .letter-sp { letter-spacing: .35em; text-indent: .35em; }

/* 金額・数値の列。表の中で桁を揃える */
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.num { text-align: right; }

/* サイドバーの下端に置く操作者の表示 */
.navbar-vertical .actor-box {
  margin-top: auto;
  padding: .75rem 1rem .5rem;
  border-top: 1px solid var(--tblr-border-color);
  font-size: .78rem;
  color: var(--tblr-secondary);
  overflow-wrap: anywhere;
}
.navbar-vertical .actor-box .caps { margin-top: .15rem; }

/* 一覧の小さな写真。Tabler の img 既定（max-width:100%; height:auto）に負けないよう幅と高さを固定 */
.table .thumb { width: 48px; height: 48px; max-width: none; object-fit: cover; }

/* 見出しを押して並べ替える表（570suite UIルール 部-13。sortable.js）。
   印は細い線の ⌃ ⌄ を 10px・薄い灰 #9aa3ab で字の右 3px。並べていない見出しはなぞったときだけ薄く ⌄。
   見出しの文字と太さは並べていてもいなくても同じ（依頼者 2026-10-09） */
.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.sortable:hover { background: #ececec; }   /* 見出しの地（gray-50）より少し濃く。Kabosu と同じ値 */
[data-bs-theme=dark] .table th.sortable:hover { background: var(--tblr-gray-700); }
.table th.sortable .sort-mark { display: inline-block; width: 10px; height: 10px; margin-left: 3px; vertical-align: -1px; color: #9aa3ab; }
.table th.sortable:not(.on) .sort-mark { opacity: 0; }
.table th.sortable:not(.on):hover .sort-mark { opacity: .6; }

/* ---------------------------------------------------------------- 一覧の表（商品・ギフト・タグ・検定・名簿）: 見出しで並べ替え・行を開いてその場で直す（ITEMS-ROW.md）
   開く印 ▶ と伸びて出る行は 570suite の suite.css（button.fold・tr.reveal・2026-09-25）をそのまま写したもの。
   色だけ Tabler の変数。13px・普通の太さ。写真 40px で行は 46px。長い名前は 1 行に収めて … */
.table-rows { table-layout: fixed; width: 100%; }
.table-rows th, .table-rows td { padding-left: 8px; padding-right: 8px; }
.table-rows td { padding-top: 3px; padding-bottom: 3px; height: 35px; font-size: 13px; }   /* 字-1: 行 35px・13px */
.table-rows.with-photo td { height: 46px; }   /* 写真 40px が入るぶん天地を広げた（依頼者 2026-10-09） */
/* Tabler の .card-table は最初の列の左余白を 1.5rem にする（.card-table tr td:first-child）。▶ の列はそれより狭いので上書き */
.table-rows tr > .fold-cell:first-child, .table-rows tr > th:first-child { padding-left: 6px; padding-right: 0; }
.table-rows .fold-cell { padding-right: 0; }
.table-rows .photo-cell { padding-right: 4px; }
.table-rows .thumb { width: 40px; height: 40px; }
.table-rows .name-cell { white-space: nowrap; }          /* 名前は 1 行に。長ければ …（略名は出さない。依頼者 2026-10-09） */
.table-rows .ellip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-rows .hint { font-size: 12px; color: var(--tblr-secondary); }
.table-rows a.rowedit-open { color: inherit; }
.table-rows a.rowedit-open:hover { color: var(--tblr-primary); }

button.fold {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 26px; height: 26px; padding: 0; margin: 0; box-sizing: border-box;
  border: none; border-radius: 50%; background: none; color: #9a9a9a;   /* ▶ だけ。○ の枠は付けない */
  vertical-align: middle; line-height: 1; cursor: pointer;
  transition: color .15s, background-color .15s;
}
button.fold::before { content: ""; display: block; width: 8px; height: 9px; margin-left: 2px; background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%); }
button.fold:hover:not(:disabled) { color: var(--tblr-body-color); background: #ececec; }
[data-bs-theme=dark] button.fold:hover:not(:disabled) { background: var(--tblr-gray-700); }
button.fold.open { transform: rotate(90deg); }
button.fold.spin { animation: s-fold-open .4s cubic-bezier(.3, .9, .35, 1.3) both; }
button.fold.spin:not(.open) { animation-name: s-fold-close; }
@keyframes s-fold-open  { from { transform: rotate(0deg); }  to { transform: rotate(90deg); } }
@keyframes s-fold-close { from { transform: rotate(90deg); } to { transform: rotate(0deg); } }
tr.reveal > td { animation: s-row-grow .34s ease-out var(--d, 0ms) backwards; }
tr.reveal > td > .cell, tr.reveal > td > .inline-edit { overflow: hidden; animation: s-cell-grow .34s ease-out var(--d, 0ms) backwards; }
tr.reveal > td > .inline-edit { animation-name: s-box-grow; }
@keyframes s-row-grow  { from { padding-top: 0; padding-bottom: 0; opacity: 0; } to { opacity: 1; } }
@keyframes s-cell-grow { from { max-height: 0; } to { max-height: 48px; } }
@keyframes s-box-grow  { from { max-height: 0; } to { max-height: 320px; } }
tr.reveal > td > .inline-edit.tall { animation-name: s-box-grow-tall; }
@keyframes s-box-grow-tall { from { max-height: 0; } to { max-height: 720px; } }
@media (prefers-reduced-motion: reduce) {
  button.fold.spin, tr.reveal > td, tr.reveal > td > .cell, tr.reveal > td > .inline-edit { animation: none; }
}
.s-spacer { width: 100%; }

/* 開いた行の中身。欄は普通の高さ（置-2）。背景を少し変えて、一覧の行と区別する */
.table-rows tr.edit-row > td { height: auto; padding: 0 12px 0 32px; background: var(--tblr-bg-surface-secondary); font-size: inherit; }
/* width: 0 + min-width: 100% = 中身の幅で表を広げない（広げると表が横に流れて、右の欄と保存ボタンが画面の外に出た） */
.table-rows tr.edit-row .inline-edit { padding: 8px 0 10px; width: 0; min-width: 100%; }
/* 左 = 写真・右 = 欄 3 行（商品名・略名・カテゴリー・価格・税込・カロリー／説明・占いの一言／表示・季節イベント）。
   見出しは欄の上（置-2）・欄は小さい箱で幅は中身の幅（依頼者 2026-10-09） */
.rowedit-grid { display: flex; gap: 16px; align-items: flex-start; }
.rowedit-photo { flex: none; width: 132px; }
.rowedit-photo .imgblk-preview { width: 132px; height: 132px; object-fit: cover; border-radius: 4px; display: block; }
.rowedit-photo .imgblk-empty { display: block; width: 132px; height: 132px; border-radius: 4px; background: var(--tblr-bg-surface-tertiary); }
.rowedit-fields { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.rowedit-line { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.rowedit-line .fld { display: flex; flex-direction: column; }
.rowedit-line .fld .form-label { font-size: 12px; margin-bottom: 3px; white-space: nowrap; }
.rowedit-line .w-name { flex: 2 1 200px; min-width: 180px; }
.rowedit-line .w-abbr { flex: 1 1 140px; min-width: 120px; }
.rowedit-line .w-num { width: 84px; }
.rowedit-line .w-cat { width: 112px; }
.rowedit-line .grow { flex: 1 1 240px; min-width: 200px; }
.rowedit-line textarea.form-control-sm { line-height: 1.35; padding-top: 4px; padding-bottom: 4px; }
.rowedit-line .form-check { font-size: 13px; }
.rowedit-official { align-items: center; gap: 4px 6px; }
/* 守-1: 変えたまま閉じようとしたときの赤い札（保存ボタンの真上）。押す = 保存 */
.rowedit-foot { position: relative; }
.unsaved-pill { position: absolute; right: 64px; bottom: 100%; margin-bottom: 6px;
  border: none; border-radius: 999px; padding: 3px 12px; font-size: 12px; color: #fff; background: #d63939; cursor: pointer; }
.official-desc-text { white-space: pre-wrap; max-height: 6em; overflow: auto; }
.hint-th { font-weight: 400; color: var(--tblr-secondary); text-transform: none; }   /* Tabler の見出しは大文字化されるので kcal を小文字のまま */
/* ギフトのタグ（行の中）: 左にジャンル・右に札（チップ）。付いている札は塗りつぶし。
   表の形（grid）なので、札が折り返しても札の列に揃い、ジャンルの字の下に潜らない（依頼者 2026-10-15） */
.rowedit-tagbox { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; align-items: start; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--tblr-border-color); }
.rowedit-tagbox .tag-genre { font-size: 12px; color: var(--tblr-secondary); white-space: nowrap; padding-top: 4px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip span { display: inline-block; padding: 2px 11px; border: 1px solid var(--tblr-border-color); border-radius: 999px; font-size: 12.5px; line-height: 1.6; background: var(--tblr-bg-surface); color: var(--tblr-body-color); user-select: none; }
.chip:hover span { border-color: var(--tblr-primary); }
.chip input:checked + span { background: var(--tblr-primary); border-color: var(--tblr-primary); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 2px rgba(var(--tblr-primary-rgb), .35); }
.rowedit-line .w-genre { width: 160px; }

/* 写真を押すと大きく出す（zoom.js。依頼者 2026-10-15）。押せる写真は data-zoom を持つ */
img[data-zoom] { cursor: zoom-in; }
.zoom-overlay { position: fixed; inset: 0; z-index: 1080; background: rgba(0, 0, 0, .82); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.zoom-overlay img { max-width: 92vw; max-height: 92vh; object-fit: contain; border-radius: 6px; background: #fff; box-shadow: 0 8px 32px rgba(0, 0, 0, .5); }

/* ギフトの箱写真。48px の札では差し替えの要否が見えなかった（依頼者 2026-10-15）→ 132px 角・押すと大きく */
.boxphoto { width: 132px; height: 132px; max-width: none; object-fit: cover; border-radius: 4px; display: block; }
.rowedit-photo .boxphotos { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; padding: 6px; }
.rowedit-photo .boxphotos .boxphoto { width: 118px; height: 118px; }     /* 塊の枠と余白のぶん 132 → 118 */
.boxphoto-wrap { position: relative; }
.boxphoto-del { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; line-height: 20px; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 16px; cursor: pointer; }
.boxphoto-del:hover { background: rgba(220, 53, 69, .9); }

/* 「〜とは？」の説明の窓（helppop.js）。ボタンの下に出す・× と外側で閉じる */
details.helppop { position: relative; display: inline-block; }
details.helppop > summary { list-style: none; cursor: pointer; }
details.helppop > summary::-webkit-details-marker { display: none; }
details.helppop > summary::before { content: "?"; display: inline-block; width: 16px; height: 16px; line-height: 16px; margin-right: 6px; border-radius: 50%; text-align: center; font-size: 11px; font-weight: 600; background: var(--tblr-primary); color: #fff; }
.helppop-box { position: absolute; left: 0; top: calc(100% + 6px); z-index: 1060; width: min(440px, 88vw); padding: 12px 36px 12px 14px; border: 1px solid var(--tblr-border-color); border-radius: 8px; background: var(--tblr-bg-surface); box-shadow: 0 8px 24px rgba(0, 0, 0, .18); font-size: 13px; line-height: 1.6; color: var(--tblr-body-color); text-align: left; white-space: normal; }
.helppop-box p { margin: 0 0 8px; }
.helppop-box p:last-child { margin-bottom: 0; }
.helppop-box strong { display: block; margin-bottom: 6px; font-size: 14px; }
.helppop-box b { font-weight: 800; }
.helppop-close { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--tblr-secondary); font-size: 18px; line-height: 26px; cursor: pointer; }
.helppop-close:hover { background: var(--tblr-bg-surface-tertiary); color: var(--tblr-body-color); }
