.main-content {
  margin-top: 5px;
  padding: 5px 10px;
}

/* ======== ライト＆ダーク共通レイアウト ======== */
.campaign-pages-admin {
  border-radius: 14px;
  box-shadow: 0 6px 22px rgba(181, 153, 117, 0.13);
  max-width: 950px;
  margin: 15px auto;
  padding: 24px 34px 30px 34px;
  font-family: 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
}

.campaign-pages-admin h3 {
  font-size: 1.4rem;
}

.campaign-pages-admin ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.campaign-pages-admin li {
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(181, 153, 117, 0.11);
  margin-bottom: 12px;
  padding: 16px 20px 13px 20px;
  display: flex;
  flex-direction: column;
  gap: 0.25em;
  transition: box-shadow 0.18s;
}

.campaign-pages-admin li:hover {
  box-shadow: 0 4px 18px rgba(181, 153, 117, 0.22);
}

.campaign-pages-admin .row-main {
  display: flex;
  align-items: center;
  gap: 0.8em;
  flex-wrap: wrap;
  width: 100%;
}

.campaign-pages-admin .page-id-row {
  width: 100%;
  margin-bottom: 3px;
  display: flex;
  align-items: center;
}

.campaign-pages-admin .page-id {
  font-size: 1.6em;
  font-weight: 700;
  border-radius: 8px;
  padding: 10px 17px 10px 12px;
  margin-bottom: 10px;
  margin-right: 0;
  letter-spacing: .02em;
  display: inline-block;
  border-bottom: 2.5px solid #ecd0b2;
}

.campaign-pages-admin .color-input {
  border: none;
  width: 32px;
  height: 32px;
  background: transparent;
  margin: 0 2px;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(181, 153, 117, 0.10);
  border-radius: 6px;
  transition: box-shadow 0.12s;
}

.campaign-pages-admin .color-input:focus,
.campaign-pages-admin .color-input:hover {
  box-shadow: 0 0 0 2px #fd8e6d66;
}

/* カラープレビュー */
.campaign-pages-admin .color-preview {
  min-width: 56px;
  max-width: 100px;
  padding: 5px 10px 5px 10px;
  height: 25px;
  border-radius: 4px;
  margin: 0 5px;
  border: 1px solid #888;
  text-align: center;
  line-height: 25px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 1em;
  font-family: 'Meiryo', 'Segoe UI', sans-serif;
}

/* カラープレビュー編集フォーム */
#editorColorPreview.color-preview {
  display: inline-block;
  min-width: 60px;
  padding: 5px;
  height: 25px;
  vertical-align: middle;
  border-radius: 4px;
  margin: 0 6px;
  background: #fff;
  color: #333;
  border: 1px solid #888;
  text-align: center;
  line-height: 25px;
  overflow: hidden;
  white-space: nowrap;
  font-size: 1em;
}

html.dark-mode #editorColorPreview.color-preview {
  background: #181a19;
  color: #e3e8e1;
  border: 1px solid #3d463e;
}


/* ==== ボタン共通 ==== */
.campaign-pages-admin button {
  border: none;
  border-radius: 22px;
  padding: 7px 18px;
  font-size: 1em;
  margin: 0 1px 7px 1px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(251, 186, 98, 0.07);
  transition: background 0.14s, box-shadow 0.14s, filter 0.14s, transform 0.11s;
  min-width: 100px;
}

.campaign-pages-admin button:active {
  filter: brightness(0.93);
  transform: scale(0.98);
}

.campaign-pages-admin button.edit-btn {
  min-width: 124px;
}

.campaign-pages-admin button:disabled {
  background: #bcbcbc;
  color: #fff;
  cursor: not-allowed;
  opacity: .62;
  box-shadow: none;
}

/* トースト通知 */
#myToast {
  font-size: 1.1em;
  padding: 13px 22px;
  border-radius: 10px;
  z-index: 10010;
}

/* スクロールバー */
.campaign-pages-admin ::-webkit-scrollbar {
  height: 11px;
  border-radius: 8px;
}

.campaign-pages-admin ::-webkit-scrollbar-thumb {
  border-radius: 8px;
  border: 2px solid #f3e9dd;
}


/* ======== ライトモード色指定（デフォルト） ======== */
.campaign-pages-admin,
#editorSection,
.campaign-pages-admin li {
  background: #faf7f3;
  color: #45331d;
}

.campaign-pages-admin .page-id {
  color: #ad6540;
  background: #f3e9dd;
  border-bottom: 2.5px solid #ecd0b2;
}

.campaign-pages-admin li {
  background: #fffdfa;
}

.campaign-pages-admin .color-preview {
  background: #fff;
  color: #333;
  border: 1px solid #888;
}

.campaign-pages-admin .notice {
  background: #f2e3d5;
  color: #9c5900;
  border-left: 6px solid #fdbe7e;
}

.campaign-pages-admin button {
  background: linear-gradient(90deg, #f0a151 0%, #f26d45 100%);
  color: #fff;
}

.campaign-pages-admin button.edit-btn {
  background: linear-gradient(90deg, #6ec1e4 0%, #45a6d6 100%);
}

.campaign-pages-admin button.delete-btn {
  background: linear-gradient(90deg, #ec8686 0%, #e05757 100%);
}

.campaign-pages-admin button.copy-btn {
  background: linear-gradient(90deg, #85df8e 0%, #48b965 100%);
  color: #fff;
}

#editorSection {
  background: #fffefa;
  border: 1.5px solid #ead8c1;
}

#myToast {
  background: linear-gradient(90deg, #fdbe7e 0%, #fd8e6d 100%);
  color: #fff;
}

.campaign-pages-admin ::-webkit-scrollbar {
  background: #f3e9dd;
}

.campaign-pages-admin ::-webkit-scrollbar-thumb {
  background: #fdbe7e;
}

/* ======== ダークモード ======== */
html.dark-mode .campaign-pages-admin,
html.dark-mode #editorSection,
html.dark-mode .campaign-pages-admin li {
  background: #191714 !important;
  color: #aca8a3 !important;
}

html.dark-mode .campaign-pages-admin .page-id {
  color: #dad6d3 !important;
  background: #392d1b !important;
  border-bottom: 2.5px solid #79582f !important;
}

html.dark-mode .campaign-pages-admin li {
  background: #201d18 !important;
}

html.dark-mode .color-preview {
  background: #181a19;
  color: #e3e8e1;
  border: 1px solid #3d463e;
}

html.dark-mode .campaign-pages-admin .notice {
  background: #2e2416 !important;
  color: #8b8a88 !important;
  border-left: 6px solid #bb965a !important;
}

html.dark-mode .campaign-pages-admin button {
  background: linear-gradient(90deg, #87603e 0%, #7c4a26 100%) !important;
  color: #fff !important;
}

html.dark-mode .campaign-pages-admin button.edit-btn {
  background: linear-gradient(90deg, #4687a6 0%, #237693 100%) !important;
}

html.dark-mode .campaign-pages-admin button.delete-btn {
  background: linear-gradient(90deg, #ca6262 0%, #913636 100%) !important;
}

html.dark-mode .campaign-pages-admin button.copy-btn {
  background: linear-gradient(90deg, #6cc27e 0%, #289454 100%) !important;
}

html.dark-mode #editorSection {
  background: #191714 !important;
  border: 1.5px solid #47341d !important;
}

html.dark-mode #myToast {
  background: linear-gradient(90deg, #bb965a 0%, #7c4a26 100%) !important;
  color: #fff !important;
}

html.dark-mode .campaign-pages-admin ::-webkit-scrollbar {
  background: #222018 !important;
}

html.dark-mode .campaign-pages-admin ::-webkit-scrollbar-thumb {
  background: #5a492a !important;
  border: 2px solid #222018 !important;
}

/* 新規作成ボタン */
.campaign-pages-admin .new-page-btn {
  margin-top: 15px;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #159767 0%, #079759 60%, #04793f 100%);
  color: #fff;
  font-size: 1.2em;
  font-weight: 800;
  padding: 18px 25px;
  border: none;
  border-radius: 38px;
  letter-spacing: .02em;
  cursor: pointer;
  transition: filter 0.14s, box-shadow 0.13s, transform 0.11s;
  min-width: 184px;
}

.campaign-pages-admin .new-page-btn:hover,
.campaign-pages-admin .new-page-btn:focus {
  filter: brightness(1.09) saturate(1.12);
  box-shadow: 0 3px 3px rgba(15, 204, 100, 0.767), 0 0.5px 1px #0bc062;
  transform: translateY(-2px) scale(1.02);
}

.campaign-pages-admin .new-page-btn:active {
  filter: brightness(0.95);
  transform: scale(0.98);
}

html.dark-mode .campaign-pages-admin .new-page-btn {
  background: linear-gradient(90deg, #04794a 0%, #035d34 100%) !important;
  color: #fff !important;
  box-shadow: 0 3px 16px rgba(15, 75, 43, 0.612), 0 1.5px 4.5px #193e29 !important;
}

/* 保存ボタンの上に10pxマージン */
#editorSection .save-btn {
  margin-top: 10px !important;
}

/* キャンセルボタン */
#editorSection .cancel-btn {
  background: linear-gradient(90deg, #ebd7a9 0%, #e8b64082 100%);
  color: #fff;
  font-weight: 700;
  border-radius: 18px;
  padding: 7px 20px;
  min-width: 98px;
}

#editorSection .cancel-btn:hover {
  filter: brightness(1.08);
}

/* フォームの行（横並び・レスポンシブ対応） */
#editorSection .form-row {
  display: flex;
  align-items: center;
  gap: 1.1em;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

#editorSection .color-row label {
  margin-right: 6px;
}

.button-row {
  display: flex;
  gap: 18px;
}

/* ページID入力欄 */
#editorSection .page-id-input {
  border: 1.5px solid #e3c89d;
  border-radius: 7px;
  padding: 8px 13px;
  font-size: 1.14em;
  min-width: 0;
  width: 260px;
  max-width: 100%;
  background: #fffefa;
  color: #804e19;
  transition: border 0.13s;
}

#editorSection .page-id-input:focus {
  border: 2px solid #fdbe7e;
  outline: none;
}

html.dark-mode #editorSection .page-id-input {
  background: #23201b;
  color: #e3e8e1;
  border-color: #47341d;
}


/* Quillエディタ領域 */
#editorSection .quill-editor {
  height: 350px;
  background: #fff;
  border-radius: 7px;
}

html.dark-mode #editorSection .quill-editor {
  background: #222019;
}

/* --- ボタンを常に横並びで等分 --- */
.button-row {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-end;
  width: 100%;
}

#editorSection .cancel-btn,
#editorSection .save-btn {
  flex: 1 1 0;
  min-width: 120px;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0 !important;
  font-size: 1.2em;
  padding: 16px 0;
}

/* gap代替: 最初のボタン以外にだけ左マージン */
.button-row>*+* {
  margin-left: 18px;
}

/* form-rowのカラム化は他には効かせるが、button-rowには効かせない */
#editorSection .form-row:not(.button-row) {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

/* --- レスポンシブ --- */
@media (max-width: 700px) {
  .campaign-pages-admin {
    padding: 5px 5vw 10px 5vw;
    max-width: 100vw;
  }

  .campaign-pages-admin .row-main {
    gap: 0.5em;
    flex-wrap: wrap;
    flex-direction: row;
    margin-top: 2px;
  }

  .campaign-pages-admin .page-id {
    padding: 6px 10px 6px 8px;
    border-bottom-width: 2px;
  }

  .campaign-pages-admin button {
    min-width: 92px;
    font-size: 0.9em;

  }

  .campaign-pages-admin .color-preview {
    min-width: 48px;
    font-size: 0.9em;
    height: 24px;
    line-height: 24px;
    padding: 5px 10px 5px 10px;
  }

  .form-row.button-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-end;
    width: 100%;
  }

  #editorSection .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #editorSection .page-id-input {
    width: 100%;
    font-size: 1em;
  }

  #editorSection .cancel-btn {
    float: none;
    margin-left: 0;
    margin-top: 8px;
    width: 100%;
  }

  .campaign-pages-admin .new-page-btn {
    display: block; 
    margin-left: auto;
    margin-right: auto;
  }

  .button-row {
    display: flex !important;
    flex-direction: row !important;
  }

  .button-row>*+* {
    margin-right: 8px;
  }

  #editorSection .cancel-btn,
  #editorSection .save-btn {
    font-size: 1.2em;
    padding: 16px 0;
    min-width: 80px;
    width: 100%;
  }

  .form-row.button-row {
    display: flex !important;
    flex-direction: row !important;
  }

  .form-row.button-row>*+* {
    margin-left: 8px;
  }

  #editorSection .cancel-btn,
  #editorSection .save-btn {
    font-size: 1em;
    min-width: 80px;
    padding: 16px 0;
    width: 100%;
  }
}

/* お待ちください点滅メッセージ */
.wait-message {
  color: #888;
  font-size: 1.1em;
  text-align: center;
  margin-top: 10px;
  animation: wait-blink 1s steps(1, start) infinite;
}

@keyframes wait-blink {
  50% {
    opacity: 0;
  }
}

/* --- Quillエディタ --- */
#editorSection {
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(181, 153, 117, 0.10);
  margin-top: 26px;
  padding: 26px 20px 22px 20px;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

#editorSection input[type="text"] {
  border: 1.5px solid #e3c89d;
  border-radius: 7px;
  padding: 8px 13px;
  font-size: 1.14em;
  margin-bottom: 13px;
  width: 300px;
  transition: border 0.13s;
}

#editorSection input[type="text"]:focus {
  border: 2px solid #fdbe7e;
  outline: none;
}

#editorSection button {
  margin-left: 5px;
  margin-top: 7px;
}

/* ======== Quillエディタのダークモード ======== */
html.dark-mode .ql-toolbar {
  background: #23201b !important;
  border-color: #47341d !important;
  color: #e7d7bc !important;
}

html.dark-mode .ql-picker,
html.dark-mode .ql-picker-label,
html.dark-mode .ql-stroke {
  color: #e7d7bc !important;
  border-color: #9e8e7b !important;
  stroke: #e7d7bc !important;
}

html.dark-mode .ql-container {
  background: #222019 !important;
  border-color: #47341d !important;
  color: #e3e8e1 !important;
}

html.dark-mode .ql-editor {
  background: #222019 !important;
  color: #e3e8e1 !important;
}

html.dark-mode .ql-editor.ql-blank::before {
  color: #8c8475 !important;
  opacity: 0.6;
}

html.dark-mode .ql-toolbar button,
html.dark-mode .ql-toolbar .ql-picker-label,
html.dark-mode .ql-toolbar .ql-picker-options {
  color: #e7d7bc !important;
}

html.dark-mode .ql-toolbar button:hover,
html.dark-mode .ql-toolbar button.ql-active {
  background: #463828 !important;
}

html.dark-mode .ql-editor a {
  color: #86c2f0 !important;
}

/* ============================
   Quillエディタ用CSS（画像寄せ/テキスト整形/ダークモード/動画幅）
   ============================ */

/* --- フォントサイズ --- */
.ql-size-small {
  font-size: 0.75em;
}

.ql-size-large {
  font-size: 1.5em;
}

.ql-size-huge {
  font-size: 2.5em;
}

/* --- テキスト行の揃え --- */
.ql-align-center {
  text-align: center;
}

.ql-align-right {
  text-align: right;
}

.ql-align-left {
  text-align: left;
}

.ql-align-justify {
  text-align: justify;
}

/* --- 画像の寄せ --- */
.container picture,
.container img {
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  height: auto;
  /* 必要なら border-radiusやbox-shadowなど追加可 */
}

/* 左寄せ */
.container .ql-align-left picture,
.container .ql-align-left img {
  margin-left: 0 !important;
  margin-right: auto !important;
  float: left !important;
}

/* 右寄せ */
.container .ql-align-right picture,
.container .ql-align-right img {
  margin-left: auto !important;
  margin-right: 0 !important;
  float: right !important;
}

/* 中央寄せ */
.container .ql-align-center picture,
.container .ql-align-center img {
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
}

/* --- エディタ上の画像の寄せ --- */
/* デフォルト：左寄せ */
.ql-editor img {
  margin-left: 0 !important;
  margin-right: auto !important;
  display: block !important;
  max-width: 100%;
  height: auto;
}

/* 中央寄せ */
.ql-editor .ql-align-center img,
.ql-editor img.ql-align-center {
  margin-left: auto !important;
  margin-right: auto !important;
  float: none !important;
  display: block !important;
}

/* 右寄せ */
.ql-editor .ql-align-right img,
.ql-editor img.ql-align-right {
  margin-left: auto !important;
  margin-right: 0 !important;
  float: right !important;
}

/* 左寄せ（明示） */
.ql-editor .ql-align-left img,
.ql-editor img.ql-align-left {
  margin-left: 0 !important;
  margin-right: auto !important;
  float: left !important;
}

/* --- 動画（iframe.ql-video）はエディタ内だけ小さく中央寄せ --- */
.ql-editor iframe.ql-video {
  display: block;
  width: 100%;
  max-width: 320px;
  min-width: 180px;
  aspect-ratio: 16/9;
  height: auto;
  margin-left: auto !important;
  margin-right: auto !important;
  border: none;
  background: #000;
}

/* --- Quillツールバー：ダークモード対応（ドロップダウンもカバー） --- */
.dark-mode .ql-toolbar.ql-snow {
  background: #2a2a2a;
  border-color: #444;
  color: #e6e6e6;
}

.dark-mode .ql-toolbar.ql-snow .ql-picker,
.dark-mode .ql-toolbar.ql-snow .ql-picker-label,
.dark-mode .ql-toolbar.ql-snow .ql-picker-options {
  background: #232323 !important;
  color: #e6e6e6 !important;
  border-color: #444 !important;
}

.dark-mode .ql-toolbar.ql-snow .ql-picker-item {
  /* カラーボックス色（Quill本体がインラインで指定する）を尊重し、background指定を外す */
  border-color: #444 !important;
}

.dark-mode .ql-toolbar.ql-snow .ql-picker-item.ql-selected,
.dark-mode .ql-toolbar.ql-snow .ql-picker-item:hover {
  background: #444 !important;
  color: #fff !important;
}

.dark-mode .ql-toolbar button {
  color: #e6e6e6;
}

.dark-mode .ql-toolbar button.ql-active,
.dark-mode .ql-toolbar button:hover {
  background: #444;
  color: #fff;
}

/* --- Quill動画アイコンもダークで見やすく --- */
.dark-mode .ql-toolbar .ql-video {
  filter: brightness(2) invert(1);
}

.dark-mode .ql-toolbar .ql-video:hover,
.dark-mode .ql-toolbar .ql-video.ql-active {
  background: #444;
  color: #fff;
}

/* --- Quill動画挿入ダイアログもダーク対応 --- */
.dark-mode .ql-tooltip.ql-editing {
  background: #232323 !important;
  color: #f0f0f0 !important;
  border: 1px solid #444 !important;
}

.dark-mode .ql-tooltip.ql-editing input[type="text"] {
  background: #232323 !important;
  color: #f0f0f0 !important;
  border: 1px solid #666 !important;
}

.dark-mode .ql-tooltip.ql-editing a {
  color: #8bc1ff !important;
}

/* --- Quillエディタ本体ダーク化（入力エリア）--- */
.dark-mode .ql-container.ql-snow {
  background: #232323 !important;
  color: #e6e6e6;
  border-color: #444;
}

.dark-mode .ql-editor {
  background: #232323 !important;
  color: #e6e6e6;
}

.dark-mode .ql-editor a {
  color: #66bfff;
}

.dark-mode .ql-editor img {
  filter: brightness(0.9) contrast(1.1);
}

.dark-mode .ql-editor.ql-blank::before {
  color: #888 !important;
}

.dark-mode .ql-editor {
  scrollbar-color: #444 #232323;
}