/* 雑誌予約管理ページ専用スタイル */
.magazine-reservation-page {
  box-sizing: border-box;
  width: min(100% - 32px, 760px);
  margin: 0 auto;
  padding: 0 0 120px;
  color: #292929;
}
.magazine-reservation-page *, .reservation-modal * { box-sizing: border-box; }
.reservation-intro { margin: 8px 0 20px; color: #777; font-size: .9rem; line-height: 1.7; }
.reservation-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 5px; border-radius: 14px; background: #f4f4f4; }
.reservation-tab { min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: #666; font: inherit; font-weight: 700; cursor: pointer; }
.reservation-tab.is-active { background: #fff; color: #c41e3a; box-shadow: 0 1px 5px #00000012; }
.reservation-tab span { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: #e9e9e9; color: #555; font-size: .78rem; }
.reservation-tab.is-active span { background: #fbe8ec; color: #c41e3a; }
.reservation-count { margin: 16px 2px 10px; color: #777; font-size: .84rem; }
.reservation-list { display: grid; gap: 12px; }
.reservation-card { padding: 16px; border: 1px solid #e8e8e8; border-radius: 16px; background: #fff; box-shadow: 0 3px 12px #00000006; }
.reservation-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.reservation-card-title { margin: 0; font-size: 1rem; font-weight: 750; line-height: 1.55; overflow-wrap: anywhere; }
.reservation-status { flex: 0 0 auto; padding: 5px 9px; border-radius: 99px; background: #e8f6ec; color: #237541; font-size: .72rem; font-weight: 700; }
.reservation-status.is-received { background: #f0f0f0; color: #666; }
.reservation-card-details { display: grid; gap: 7px; margin: 13px 0 15px; }
.reservation-detail { display: grid; grid-template-columns: 7.2em minmax(0, 1fr); gap: 8px; font-size: .87rem; line-height: 1.5; }
.reservation-detail-label { color: #888; }
.reservation-detail-value { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.reservation-card-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid #eee; padding-top: 12px; }
.reservation-action-button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 38px; padding: 8px 12px; border: 1px solid #ddd; border-radius: 10px; background: #fff; color: #444; font: inherit; font-size: .82rem; cursor: pointer; }
.reservation-action-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.reservation-action-button.is-primary { border-color: #c41e3a; background: #fff7f8; color: #c41e3a; }
.reservation-action-button.is-danger { margin-left: auto; color: #b42336; }
.reservation-empty { padding: 36px 18px; border: 1px dashed #ddd; border-radius: 16px; color: #888; text-align: center; font-size: .92rem; line-height: 1.8; }
.reservation-fab { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: calc(108px + env(safe-area-inset-bottom)); z-index: 9000; display: grid; place-items: center; width: 58px; height: 58px; border: 0; border-radius: 50%; background: #c41e3a; color: #fff; box-shadow: 0 5px 18px #0000002b; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.reservation-fab svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.reservation-fab:active { transform: scale(.96); }
.reservation-modal { position: fixed; inset: 0; z-index: 10000; display: none; align-items: flex-end; justify-content: center; padding: 0; }
.reservation-modal.is-open { display: flex; }
.reservation-modal-backdrop { position: absolute; inset: 0; background: #0008; }
.reservation-dialog { position: relative; z-index: 1; width: min(100%, 620px); max-height: min(90dvh, 850px); overflow-y: auto; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: #fff; box-shadow: 0 -8px 35px #00000020; overscroll-behavior: contain; }
.reservation-dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.reservation-dialog-heading h2 { margin: 0; font-size: 1.15rem; }
.modal-close-button { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f3f3f3; color: #444; font-size: 1.6rem; cursor: pointer; }
#reservation-form { display: grid; gap: 15px; }
.reservation-field { display: grid; gap: 7px; min-width: 0; color: #444; font-size: .88rem; font-weight: 650; }
.reservation-field > span { display: flex; align-items: center; gap: 7px; }
.required-mark { padding: 2px 5px; border-radius: 4px; background: #fbe8ec; color: #c41e3a; font-size: .65rem; font-weight: 700; }
.reservation-field input, .reservation-field select { width: 100%; min-width: 0; min-height: 46px; padding: 11px 12px; border: 1px solid #d9d9d9; border-radius: 10px; background: #fff; color: #292929; font: inherit; font-weight: 400; font-size: 16px; }
.reservation-field input:focus, .reservation-field select:focus { outline: 2px solid #c41e3a55; border-color: #c41e3a; }
.reservation-field[hidden] { display: none !important; }
.reservation-field [hidden] { display: none !important; }
.reservation-form-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; padding-top: 4px; }
.reservation-form-actions button { min-height: 46px; border-radius: 11px; font: inherit; font-weight: 700; cursor: pointer; }
.reservation-secondary-button { border: 1px solid #ddd; background: #fff; color: #555; }
.reservation-primary-button { border: 1px solid #c41e3a; background: #c41e3a; color: #fff; }
.reservation-form-error { margin: 0; color: #b42336; font-size: .85rem; }
.reservation-toast { position: fixed; left: 50%; bottom: calc(178px + env(safe-area-inset-bottom)); z-index: 11000; width: max-content; max-width: calc(100% - 36px); padding: 11px 16px; border-radius: 12px; background: #292929; color: #fff; font-size: .86rem; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .18s ease, transform .18s ease; }
.reservation-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
body.reservation-modal-open { overflow: hidden; }
@media (min-width: 640px) {
  .reservation-modal { align-items: center; padding: 24px; }
  .reservation-dialog { border-radius: 22px; padding: 24px; max-height: 90dvh; }
  .reservation-fab { bottom: 28px; }
  .reservation-toast { bottom: 28px; }
}
@media (prefers-reduced-motion: reduce) { .reservation-toast { transition: none; } }

/* 一覧の件数と並び順 */
.reservation-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 2px 10px;
}
.reservation-list-toolbar .reservation-count { margin: 0; flex: 0 0 auto; }
.reservation-sort-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
  color: #777;
  font-size: .78rem;
}
.reservation-sort-control select {
  max-width: min(66vw, 290px);
  min-height: 38px;
  padding: 7px 28px 7px 9px;
  border: 1px solid #ddd;
  border-radius: 9px;
  background: #fff;
  color: #444;
  font: inherit;
  font-size: .78rem;
}
@media (max-width: 390px) {
  .reservation-list-toolbar { align-items: flex-start; flex-direction: column; gap: 8px; }
  .reservation-sort-control { justify-content: flex-start; width: 100%; }
  .reservation-sort-control select { flex: 1; max-width: none; }
}


/* 入力履歴候補と個別削除ボタン */
.reservation-field { position: relative; }
.history-suggestions { display: none; position: absolute; z-index: 20; top: calc(100% - 1px); left: 0; right: 0; max-height: 220px; overflow-y: auto; border: 1px solid #ddd; border-radius: 10px; background: #fff; box-shadow: 0 6px 18px #00000018; }
.history-suggestions.is-open { display: block; }
.history-suggestion-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-bottom: 1px solid #f0f0f0; }
.history-suggestion-row:last-child { border-bottom: 0; }
.history-suggestion-pick { flex: 1; min-width: 0; padding: 8px 0; border: 0; background: transparent; color: #333; text-align: left; font: inherit; font-weight: 400; overflow-wrap: anywhere; cursor: pointer; }
.history-suggestion-delete { flex: 0 0 32px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f5f5f5; color: #b42336; font-size: 20px; line-height: 1; cursor: pointer; }
.history-suggestion-delete:active { background: #fbe8ec; }

/* 説明文を中央揃え */
.magazine-reservation-page .reservation-intro {
  text-align: center;
}

/* スマホで登録画面が左右に動くのを防ぐ */
.magazine-reservation-page,
.reservation-modal,
.reservation-dialog {
  box-sizing: border-box;
  max-width: 100%;
}

.reservation-modal {
  overflow-x: hidden;
}

.reservation-dialog {
  width: 100%;
  max-width: 480px;
  min-width: 0;
  margin: 0;
  overflow-x: hidden;
}

.reservation-dialog input,
.reservation-dialog select,
.reservation-dialog textarea {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

/* 受取日（発売日）の入力欄をほかと同じ幅にする */
#pickup-date {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

/* 「予約を登録」を中央揃え */
.reservation-dialog-heading {
  justify-content: center;
  position: relative;
}

.reservation-dialog-heading h2 {
  text-align: center;
}

.reservation-dialog-heading .modal-close-button {
  position: absolute;
  right: 0;
}

/* 予約カードの操作ボタンの配置 */
.reservation-card-actions {
  justify-content: flex-start;
}

.reservation-card-actions .is-danger {
  margin-left: 0;
}

/* 編集・削除を右詰めにする */
.reservation-card-actions .is-primary {
  margin-right: auto;
}


/* 店舗受取モードの店舗見出し */
.reservation-store-heading {
  margin: 18px 0 10px;
  padding: 10px 12px;
  border-left: 4px solid #C41E3A;
  border-radius: 4px;
  background: #f8f3f4;
  color: #292929;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.reservation-store-heading:first-child {
  margin-top: 0;
}

/* 店舗受取：受取日＋店舗ごとの折りたたみグループ */

.reservation-store-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f8f3f4;
  color: #292929;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.reservation-store-group {
  margin: 16px 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
}

.reservation-store-heading::-webkit-details-marker {
  display: none;
}

.reservation-store-count {
  display: inline-flex;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #C41E3A;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.reservation-store-heading-text {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  overflow-wrap: anywhere;
}

.reservation-store-date {
  color: #777;
  font-size: 12px;
  font-weight: 400;
}

.reservation-store-name {
  color: #292929;
  font-size: 15px;
  font-weight: 700;
}

.reservation-store-heading::after {
  content: "＋";
  flex-shrink: 0;
  font-size: 18px;
}

.reservation-store-group[open] > .reservation-store-heading::after {
  content: "−";
}

.reservation-store-cards {
  padding: 0 0 10px;
}

.reservation-store-cards .reservation-card {
  margin-top: 10px;
}


/* 在庫登録ボタン */
.magazine-stock-fab {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: calc(108px + env(safe-area-inset-bottom));
  z-index: 9000;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #C41E3A;
  color: #fff;
  box-shadow: 0 5px 18px #0000002b;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.magazine-stock-fab svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.magazine-stock-fab:active {
  transform: scale(.96);
}

/* 登録フォームのモーダル */
.magazine-stock-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  overflow-x: hidden;
}

.magazine-stock-modal.is-open {
  display: flex;
}

.magazine-stock-modal-backdrop {
  position: absolute;
  inset: 0;
  background: #0008;
}

.magazine-stock-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  min-width: 0;
  max-height: min(90dvh, 850px);
  margin: 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -8px 35px #00000020;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

.magazine-stock-dialog *,
.magazine-stock-dialog input,
.magazine-stock-dialog select,
.magazine-stock-dialog textarea {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.magazine-stock-dialog-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 18px;
}

.magazine-stock-dialog-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  text-align: center;
}

.magazine-stock-modal-close {
  position: absolute;
  right: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #f3f3f3;
  color: #444;
  font-size: 1.6rem;
  cursor: pointer;
}

#magazine-stock-form {
  display: grid;
  gap: 15px;
}

.magazine-stock-form-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: #444;
  font-size: .88rem;
  font-weight: 650;
}

.magazine-stock-form-field > span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.magazine-stock-required {
  padding: 2px 5px;
  border-radius: 4px;
  background: #fbe8ec;
  color: #C41E3A;
  font-size: .65rem;
  font-weight: 700;
}

.magazine-stock-form-field input,
.magazine-stock-form-field select,
.magazine-stock-form-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 10px;
  background: #fff;
  color: #292929;
  font: inherit;
  font-size: 16px;
  font-weight: 400;
}

.magazine-stock-form-field textarea {
  min-height: 90px;
  resize: vertical;
}

.magazine-stock-form-field input:focus,
.magazine-stock-form-field select:focus,
.magazine-stock-form-field textarea:focus {
  outline: 2px solid #C41E3A55;
  border-color: #C41E3A;
}

.magazine-stock-form-actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
  padding-top: 4px;
}

.magazine-stock-form-actions button {
  min-height: 46px;
  border-radius: 11px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.magazine-stock-cancel {
  border: 1px solid #ddd;
  background: #fff;
  color: #555;
}

.magazine-stock-submit {
  border: 1px solid #C41E3A;
  background: #C41E3A;
  color: #fff;
}

.magazine-stock-form-error {
  margin: 0;
  color: #b42336;
  font-size: .85rem;
}

.magazine-stock-form-error[hidden] {
  display: none !important;
}

body.magazine-stock-modal-open {
  overflow: hidden;
}

@media (min-width: 640px) {
  .magazine-stock-modal {
    align-items: center;
    padding: 24px;
  }

  .magazine-stock-dialog {
    border-radius: 22px;
    padding: 24px;
    max-height: 90dvh;
  }

  .magazine-stock-fab {
    bottom: 28px;
  }
}
