/* ============================================
   Calendar Themes
   /calendar/ 年・月・日すべてのビュー対応
   .theme-* で適用（html要素に付与）
   ============================================ */

/* ------ 猫カレンダーテーマ ------ */
.theme-neko {
  background-color: #fffbfd;
}
.theme-neko main {
  background: #fffbfd url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'%3E%3Ctext x='10' y='35' font-size='22' opacity='0.09'%3E%F0%9F%90%BE%3C/text%3E%3Ctext x='90' y='30' font-size='18' opacity='0.07'%3E%F0%9F%90%B1%3C/text%3E%3Ctext x='160' y='50' font-size='14' opacity='0.06'%3E%F0%9F%90%BE%3C/text%3E%3Ctext x='50' y='80' font-size='20' opacity='0.08'%3E%F0%9F%90%88%3C/text%3E%3Ctext x='140' y='100' font-size='16' opacity='0.07'%3E%F0%9F%90%BE%3C/text%3E%3Ctext x='10' y='120' font-size='14' opacity='0.06'%3E%F0%9F%90%9F%3C/text%3E%3Ctext x='100' y='140' font-size='22' opacity='0.08'%3E%F0%9F%90%BE%3C/text%3E%3Ctext x='30' y='170' font-size='16' opacity='0.07'%3E%F0%9F%90%B1%3C/text%3E%3Ctext x='160' y='170' font-size='18' opacity='0.08'%3E%F0%9F%90%88%3C/text%3E%3Ctext x='70' y='195' font-size='12' opacity='0.06'%3E%F0%9F%A7%B6%3C/text%3E%3C/svg%3E");
}
.theme-neko .card {
  border-radius: 4px;
  border: 2px solid #f0c0d0;
}
.theme-neko .card-header {
  background: linear-gradient(135deg, #ffe0ec, #fff0f5);
  border-bottom: 2px dashed #f0c0d0;
  color: #8b4060 !important;
  position: relative;
}
.theme-neko .card-header .text-white,
.theme-neko .card-header.text-white {
  color: #8b4060 !important;
}
.theme-neko .card-header.bg-info,
.theme-neko .card-header.bg-primary,
.theme-neko .card-header.bg-secondary,
.theme-neko .card-header.bg-dark {
  background: linear-gradient(135deg, #ffe0ec, #fff0f5) !important;
}
.theme-neko .card-header::before {
  content: '\1F43E'; /* paw */
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2em;
  opacity: 0.6;
}
.theme-neko .card.border-success {
  border-color: #f0c0d0 !important;
}
.theme-neko .card.border-success .card-header {
  background: linear-gradient(135deg, #f5a0c0, #e080a0) !important;
  color: #fff !important;
}
.theme-neko .card.border-success .card-header .text-white {
  color: #fff !important;
}
.theme-neko .card .text-muted {
  color: #9a7080 !important;
}
.theme-neko .progress-bar.bg-success {
  background: linear-gradient(90deg, #f5a0c0, #e080a0) !important;
}
.theme-neko .progress-bar.bg-info {
  background: linear-gradient(90deg, #f0b0d0, #e8a0c0) !important;
}
.theme-neko .table-sm td {
  padding: 0.3rem 0.5rem;
}
.theme-neko .moon-phase-display svg {
  filter: drop-shadow(0 0 3px rgba(255, 200, 100, 0.5));
}
.theme-neko h1 {
  font-family: 'Rounded Mplus 1c', 'Yu Gothic', sans-serif;
  color: #c0507a;
}
.theme-neko h1::before {
  content: '\1F43E';
  margin-right: 8px;
  opacity: 0.7;
}
/* 年・月カレンダーテーブル */
.theme-neko .table thead th {
  background: linear-gradient(135deg, #ffe0ec, #fff0f5) !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.theme-neko .table {
  border-radius: 2px;
  overflow: hidden;
}
.theme-neko .fc-toolbar .btn,
.theme-neko .fc-button {
  border-radius: 4px;
}
/* fullcalendar 月/年表示 月ヘッダー */
.theme-neko .fc-day-header {
  background: linear-gradient(135deg, #ffe0ec, #fff0f5) !important;
}
.theme-neko .fc-view-container {
  border-color: #f0c0d0;
}
.theme-neko .calendar-year-month-title {
  color: #d63384;
}
.theme-neko h2 {
  font-family: 'Rounded Mplus 1c', 'Yu Gothic', sans-serif;
  color: #c0507a;
}
/* 月タイトルバーにネコ装飾 */
.theme-neko .cal-month-index {
  background: linear-gradient(135deg, #ffe0ec, #ffd6e8) !important;
  border-color: #f0c0d0 !important;
  position: relative;
}
.theme-neko .cal-month-index::before {
  content: '\1F431';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1em;
  opacity: 0.7;
}
.theme-neko .cal-month-index::after {
  content: '\1F43E';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.0em;
  opacity: 0.5;
}
.theme-neko .cal-month-index h2 {
  color: #c0507a !important;
}
/* 年カレンダーの各月ボックス */
.theme-neko .month-box {
  border: 2px solid #f0c0d0 !important;
}
/* 今日のセル — ネコ肉球マーク */
.theme-neko .fc-my_today {
  background: #fff0f5 !important;
  box-shadow: inset 0 0 0 2px #f0a0c0;
}
/* 曜日ヘッダーの土日をネコピンクに */
.theme-neko .fc-day-header.fc-sun,
.theme-neko .fc-day-header.fc-sat {
  background: linear-gradient(135deg, #ffd0e0, #ffe0ec) !important;
}
/* 月ナビボタンをネコ丸ボタンに */
.theme-neko .fc-prev-button,
.theme-neko .fc-next-button,
.theme-neko .fc-today-button {
  border-color: #e8a0c0 !important;
  color: #c0507a !important;
}
.theme-neko .fc-prev-button:hover,
.theme-neko .fc-next-button:hover,
.theme-neko .fc-today-button:hover {
  background: #ffe0ec !important;
}
/* 月表示の祝日セルにキジトラ模様風ストライプ */
.theme-neko .fc-my_pubholiday {
  background: repeating-linear-gradient(
    135deg,
    #ffe8ef,
    #ffe8ef 4px,
    #ffd0e0 4px,
    #ffd0e0 8px
  ) !important;
}
/* 月ナビバッジ（1月〜12月） */
.theme-neko .badge,
.theme-neko .btn-outline-primary {
  border-radius: 4px;
}
/* 祝日リストにネコ肉球 */
.theme-neko .holiday-name::before,
.theme-neko .fc-my_str_pubholiday a::before {
  content: '\1F43E ';
  font-size: 0.8em;
  opacity: 0.5;
}
/* 年カレンダー全体の枠線をネコピンクに */
.theme-neko .cal-year table,
.theme-neko .cal-year td,
.theme-neko .cal-year th {
  border-color: #f0c0d0 !important;
}
/* キジトラ風の交互背景（年カレンダー月ブロック） */
.theme-neko .cal-small-month:nth-child(odd) .cal-month-index {
  background: linear-gradient(135deg, #ffe0ec, #ffd0e0) !important;
}
.theme-neko .cal-small-month:nth-child(even) .cal-month-index {
  background: linear-gradient(135deg, #ffd6e8, #ffe8f2) !important;
}

/* ------ 和風テーマ ------ */
.theme-wafuu {
  background-color: #faf8f0;
}
.theme-wafuu main {
  background: #faf8f0;
}
.theme-wafuu .card {
  border: 1px solid #8b7355;
  border-radius: 2px;
}
.theme-wafuu .card-header {
  background: linear-gradient(180deg, #f5f0e8, #ebe3d4);
  border-bottom: 1px solid #8b7355;
  color: #5a4530 !important;
  font-family: 'Noto Serif JP', serif;
}
.theme-wafuu .card-header .text-white,
.theme-wafuu .card-header.text-white {
  color: #5a4530 !important;
}
.theme-wafuu .card-header.bg-info,
.theme-wafuu .card-header.bg-primary,
.theme-wafuu .card-header.bg-secondary,
.theme-wafuu .card-header.bg-dark {
  background: linear-gradient(180deg, #f5f0e8, #ebe3d4) !important;
}
.theme-wafuu .card-header::before {
  content: '\25C6'; /* diamond */
  margin-right: 6px;
  color: #8b4513;
  font-size: 0.7em;
}
.theme-wafuu h1 {
  font-family: 'Noto Serif JP', serif;
}
.theme-wafuu .progress-bar.bg-info {
  background-color: #8b7355 !important;
}
.theme-wafuu .progress-bar.bg-success {
  background-color: #228b22 !important;
}
/* 年・月カレンダーテーブル */
.theme-wafuu .table thead th {
  background: linear-gradient(180deg, #f5f0e8, #ebe3d4) !important;
  font-family: 'Noto Serif JP', serif;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
/* fullcalendar 月/年表示 */
.theme-wafuu .fc-day-header {
  background: linear-gradient(180deg, #f5f0e8, #ebe3d4) !important;
  font-family: 'Noto Serif JP', serif;
}
.theme-wafuu .fc-view-container {
  border: 1px solid #8b7355;
}
.theme-wafuu h2 {
  font-family: 'Noto Serif JP', serif;
}

/* ------ ダークテーマ ------ */
.theme-dark {
  background-color: #1a1a2e;
}
.theme-dark main {
  background: #1a1a2e;
  color: #e0e0e0;
}
.theme-dark .card {
  background: #16213e;
  border-color: #0f3460;
  color: #e0e0e0;
}
.theme-dark .card-header {
  background: #0f3460;
  color: #e0e0e0;
  border-color: #0f3460;
}
.theme-dark .text-muted {
  color: #a0b0c0 !important;
}
.theme-dark .table {
  color: #e0e0e0;
}
.theme-dark strong {
  color: #ffffff;
}
.theme-dark a {
  color: #6db8ff;
}
.theme-dark h1 {
  color: #ffffff;
}
.theme-dark .progress {
  background-color: #2a2a4a;
}
/* 年・月カレンダーテーブル */
.theme-dark .table thead th {
  background: #0f3460 !important;
  color: #e0e0e0 !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.theme-dark .table td {
  background: #16213e;
  color: #e0e0e0;
}
.theme-dark .fc-button,
.theme-dark .btn-outline-secondary {
  color: #e8f0f8 !important;
  border-color: #3a5a80;
  background: #1a3050;
}
.theme-dark .fc-button:hover,
.theme-dark .btn-outline-secondary:hover {
  background: #244060;
  color: #ffffff !important;
}
.theme-dark a .fc-button,
.theme-dark .fc-button .fc-icon {
  color: #e8f0f8 !important;
}
.theme-dark #toolbar {
  color: #e0e0e0;
}
/* fullcalendar 月/年表示 */
.theme-dark .fc-day-header {
  background: #0f3460 !important;
  color: #e0e0e0 !important;
}
.theme-dark .fc-view-container {
  border-color: #2a4a70;
}
.theme-dark .fc-day {
  background: #16213e !important;
  color: #e0e0e0 !important;
}
.theme-dark .fc-day a {
  color: #6db8ff !important;
}
.theme-dark .fc-other-month,
.theme-dark #calendar-main .fc-other-month {
  background: #111a30 !important;
}
.theme-dark h2 {
  color: #ffffff;
}
/* 年カレンダーの平日数字が暗くて見づらい問題の修正 */
.theme-dark .fc-day-number {
  color: #d0d8e0 !important;
}
.theme-dark .fc-day-number a {
  color: #d0d8e0 !important;
}
.theme-dark .fc-my_str_weekday,
.theme-dark .fc-my_str_weekday a {
  color: #d0d8e0 !important;
}
.theme-dark .fc-my_str_sat,
.theme-dark .fc-my_str_sat a {
  color: #6db8ff !important;
}
.theme-dark .fc-my_str_sun,
.theme-dark .fc-my_str_sun a {
  color: #ff7070 !important;
}
.theme-dark .fc-my_str_pubholiday,
.theme-dark .fc-my_str_pubholiday a {
  color: #ff7070 !important;
}
/* 年カレンダー月タイトルバー */
.theme-dark .cal-month-index {
  background: #0f3460 !important;
  border-color: #2a4a70 !important;
}
.theme-dark .cal-month-index h2,
.theme-dark .cal-month-index a {
  color: #e0e8f0 !important;
}
/* 年カレンダー月ボックス枠線 */
.theme-dark .month-box {
  border-color: #2a4a70 !important;
}
/* 年カレンダーのテーブル枠線 */
.theme-dark .cal-year table,
.theme-dark .cal-year td,
.theme-dark .cal-year th {
  border-color: #1e3050 !important;
}
/* 祝日一覧テキスト */
.theme-dark .holiday-name,
.theme-dark .show_holiday {
  color: #ff9090 !important;
}
/* 六曜・旧暦・月齢・干支テキスト */
.theme-dark .show_rokuyou,
.theme-dark .show_kyureki,
.theme-dark .show_geturei,
.theme-dark .show_eto,
.theme-dark .show_suntime {
  color: #a0b0c0 !important;
}
/* 月表示のセル背景を確実にダーク化 */
.theme-dark .fc-bg td {
  background: #16213e !important;
}
.theme-dark .fc-bg .fc-other-month {
  background: #111a30 !important;
}
.theme-dark .fc-bg .fc-my_today,
.theme-dark #calendar-main .fc-my_today,
.theme-dark #calendar-main .fc-bg .fc-my_today {
  background: #1e2d4a !important;
  outline: 1px solid #4a7aaa;
}
.theme-dark .fc-bg .fc-my_pubholiday {
  background: #2a1a2a !important;
}
.theme-dark .fc-bg .fc-my_sat {
  background: #16213e !important;
}
.theme-dark .fc-bg .fc-my_sun {
  background: #1e1a28 !important;
}
/* 月ナビバッジ */
.theme-dark .btn-outline-primary {
  color: #6db8ff;
  border-color: #2a4a70;
}
.theme-dark .btn-outline-primary:hover {
  background: #1a3050;
  color: #90d0ff;
}
/* 月表示のコンテンツ行テキスト */
.theme-dark .fc-content-skeleton td {
  color: #d0d8e0;
}
.theme-dark .fc-content-skeleton .fc-other-month {
  color: #b0bec8 !important;
}
.theme-dark .fc-content-skeleton .fc-other-month a {
  color: #b0bec8 !important;
}
/* 現在時刻テキスト */
.theme-dark #date_time {
  color: #a0b0c0;
}
/* 祝日リストテーブル */
.theme-dark .holiday-list-table td:nth-child(1) {
  color: #8899aa !important;
}
.theme-dark .holiday-list-table td:nth-child(2) {
  color: #ff7070 !important;
}
.theme-dark .holiday-list-table td:nth-child(3) {
  color: #c0c8d0 !important;
}
.theme-dark .holiday-list-table tr {
  border-bottom-color: #1e3050 !important;
}
/* 年カレンダー下のテキスト全般 */
.theme-dark .container {
  color: #c0c8d0;
}

/* ------ 印刷時のテーマカラー保持 ------ */
@media print {
  .theme-neko *,
  .theme-wafuu *,
  .theme-dark * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  /* 共通印刷ルール（全ビュー）— PDF出力と同じ見え方 */
  /* サイトヘッダー・フッター・デバッグバー・Cookie・その他UI非表示 */
  #header,
  footer,
  #mojoDebug,
  #goToTopBtn,
  #gdpr-dialog,
  #gdpr-banner,
  .d-none.d-print-block {
    display: none !important;
  }
  /* h1上下マージン・日時表示を縮小して1ページに収める */
  #toolbar h1 {
    margin-top: 0 !important;
    margin-bottom: 2px !important;
    font-size: 1.3em !important;
  }
  #date_time {
    display: none !important;
  }
  /* #toolbar内のナビボタン部分のみ非表示（h1は残す） */
  #toolbar .fc-toolbar,
  #toolbar #toolbar_buttons_sm,
  #toolbar .fc-button-group,
  #toolbar form,
  #toolbar .select2filter,
  #toolbar .country_select_raw,
  #toolbar .select2-container,
  #toolbar .calendar-settings-dropdown,
  .d-print-none,
  #geolocation-overlay,
  #geolocation-btn {
    display: none !important;
  }
  /* PC用h1コンテナを印刷時に表示（fc-toolbarは除外） */
  #toolbar .d-none.d-md-block:not(.fc-toolbar) {
    display: block !important;
  }
  #toolbar h1 {
    display: block !important;
  }
  /* スマホ用エリアは印刷時に非表示（PC用h1を使う） */
  #toolbar .d-block.d-md-none {
    display: none !important;
  }
  /* 月ナビゲーション・前後日ナビ非表示 */
  #toolbar .d-md-flex.justify-content-center,
  #toolbar .d-flex.d-print-none {
    display: none !important;
  }
  .col-sm-10, .col-sm-12 {
    width: 100% !important;
    max-width: 100% !important;
  }
  /* 年ビュー: 列数は orientation 別メディアクエリで制御（下部参照） */
  /* 印刷時のcontainer幅・余白調整 */
  .container {
    max-width: 100% !important;
    padding-left: 25px !important;
    padding-right: 25px !important;
    margin-bottom: 0 !important;
  }
  /* 祝日セクション: 途中で切れる場合は次のページへ */
  .holiday-list-table {
    break-before: auto;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .holiday-list-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  /* 「〜年の祝日」見出し+テーブルをセットで改ページ制御 */
  #calendar-main > .row:last-child {
    break-before: auto;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  /* 空白ページ防止: main後の全要素を非表示 */
  main ~ * {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
}

/* ------ 年ビュー: 印刷向きに応じて列数切替 ------ */
/* 横向き = 1行4列（25%） */
@media print and (orientation: landscape) {
  #calendar-year .cal-small-month.col-xl-3 {
    flex: 0 0 25% !important;
    max-width: 25% !important;
  }
}
/* 縦向き = 1行3列（33.33%） */
@media print and (orientation: portrait) {
  #calendar-year .cal-small-month.col-xl-3 {
    flex: 0 0 33.333% !important;
    max-width: 33.333% !important;
  }
}

/* ------ ダークテーマ: Select2国選択ドロップダウン ------ */
.theme-dark .select2-container--default .select2-dropdown {
  background-color: #16213e;
  border-color: #2a4a70;
}
.theme-dark .select2-container--default .select2-search--dropdown .select2-search__field {
  background-color: #1a2a48;
  border-color: #2a4a70;
  color: #e0e0e0;
}
.theme-dark .select2-container--default .select2-results__option {
  color: #e0e0e0;
}
.theme-dark .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #0f3460;
  color: #ffffff;
}
.theme-dark .select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #1a3a5c;
  color: #90d0ff;
}
.theme-dark .select2-container--default .select2-results__group {
  color: #a0b8d0;
  background-color: #111a30;
}

/* ------ 歯車ドロップダウン共通 ------ */
.calendar-settings-dropdown .theme-btn.active {
  font-weight: bold;
  background-color: #6c757d;
  color: #fff;
  border-color: #6c757d;
}
