/*
 * カレンダーのイベントはコースごとの色で表示する（App\Controller\CalendarController::events）。
 * コマの状態は色ではなく表現で区別する（どのコース色でも見分けがつくように）:
 *   - 参加者ありの通常のコマ: コースの色（ベタ塗り）
 *   - 参加者0人のコマ（記録済み・欠席のみになった場合も含む）: 薄い色＋コース色の破線の枠（.ev-empty）
 *   - 休講（一括キャンセル）: 薄い色＋赤い斜線＋赤い枠＋タイトル先頭の「[休講]」（.ev-cancelled）
 */
.fc-event.ev-empty {
  border-style: dashed !important;
  border-width: 2px !important;
}
.fc-event.ev-cancelled {
  border-width: 2px !important;
  background-image: repeating-linear-gradient(
    135deg,
    rgba(220, 53, 69, 0.28) 0,
    rgba(220, 53, 69, 0.28) 5px,
    transparent 5px,
    transparent 10px
  ) !important;
}

/* カレンダー凡例の状態見本（実際のコマと同じ表現） */
.legend-chip {
  display: inline-block;
  min-width: 2.2em;
  height: 1.1em;
  border-radius: 3px;
  margin-right: 4px;
  vertical-align: middle;
  border: 1px solid #0d6efd;
  background-color: #0d6efd;
}
.legend-chip.legend-chip-empty {
  background-color: #cfe2ff;
  border: 2px dashed #0d6efd;
}
.legend-chip.legend-chip-cancelled {
  background-color: #cfe2ff;
  border: 2px solid #dc3545;
  background-image: repeating-linear-gradient(135deg, rgba(220, 53, 69, 0.35) 0, rgba(220, 53, 69, 0.35) 4px, transparent 4px, transparent 8px);
}

/* list表示の行にポインターを合わせるとFullCalendar既定のグレー背景になり、
   既定の文字色のままだと読みにくくなるため、ホバー時の文字色を明示的に指定する。 */
.fc-list-event:hover td {
  background-color: #e9ecef;
}
.fc-list-event:hover .fc-list-event-title,
.fc-list-event:hover .fc-list-event-time,
.fc-list-event:hover .fc-list-event-title a {
  color: #212529 !important;
}

/*
 * ヘッダー（ナビバー）のオレンジテーマ。文字は指定により白で統一する。
 */
.bg-brand-orange {
  background-color: #ffa217 !important;
}
.bg-brand-orange .navbar-brand,
.bg-brand-orange .nav-link,
.bg-brand-orange .navbar-text {
  color: #fff !important;
}
.bg-brand-orange .nav-link:hover,
.bg-brand-orange .nav-link:focus {
  color: #ffe9c2 !important;
}

/* カレンダー凡例の色見本 */
.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.legend-swatch.legend-regular { background-color: #0d6efd; }
.legend-swatch.legend-ticket { background-color: #0f7a5c; }

/* スマートフォン幅での余白調整 */
@media (max-width: 576px) {
  .container { padding-left: 8px; padding-right: 8px; }
}

/*
 * カレンダー（メインのカレンダー月表示・振替コマ選択のミニカレンダー）のイベントは、
 * FullCalendar既定の「時刻+タイトル横並び」ではなく「時刻→コース名」の縦積みで表示する
 * （calendar.js / occurrence.js の eventContent 参照）。
 * メインカレンダーの月表示は、1マスの幅が狭いスマホ幅でだけ文字を小さくする
 * （PC幅では従来通りの大きさのままでよいため）。振替のミニカレンダーはモーダル内の
 * 限られた幅で常に窮屈になるため、幅に関わらず常に小さくする。
 * ブレークポイントはJS側でモバイル判定に使っている768pxに合わせる。
 */
.cal-event-compact {
  overflow: hidden;
  padding: 1px 2px;
}
.cal-event-compact-time {
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-event-compact-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#transferCalendar .cal-event-compact {
  font-size: 0.7em;
  line-height: 1.2;
}
@media (max-width: 767px) {
  #calendar .cal-event-compact {
    font-size: 0.7em;
    line-height: 1.2;
  }
}

/*
 * スマホ幅では、カレンダー上部のツールバー（前後移動/today・タイトル・表示切替ボタン）が
 * PC幅前提の横並びレイアウトのままだと、幅の広い日付タイトル（例:「2026年8月9日 – 15日」）が
 * 折り返して3行になり、ボタン類も崩れて見づらくなる。
 * タイトルの文字サイズを縮め、「タイトル→前後移動/today→表示切替」の順に縦積みし直すことで、
 * 折り返しが起きにくく、各要素も中央揃えで整った配置になるようにする。
 * headerToolbarの構成上、chunk1=前後移動/today、chunk2=タイトル、chunk3=表示切替（calendar.js参照）。
 */
@media (max-width: 767px) {
  .fc-header-toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 8px !important;
  }
  .fc-toolbar-chunk {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
  }
  .fc-toolbar-chunk:nth-child(1) { order: 2; } /* 前後移動・today */
  .fc-toolbar-chunk:nth-child(2) { order: 1; } /* タイトル */
  .fc-toolbar-chunk:nth-child(3) { order: 3; } /* 表示切替（month/day/list） */
  .fc-toolbar-title {
    font-size: 1.15em !important;
    margin: 0 !important;
    text-align: center;
  }
  .fc-header-toolbar .fc-button {
    padding: 4px 10px !important;
    font-size: 0.85em !important;
  }
}

/*
 * 名簿ページ（occurrences/show.php）の参加者の顔写真。
 * PCでは氏名+学年/性別の2行ぶんの高さになるくらいのサイズ、スマホ幅ではさらに大きくして見やすくする
 * （「記録済み」「レギュラー制」等のマーク類は名前の下に1箇所へまとめてあるため、
 * 写真を大きくしてもレイアウトが横に圧迫されない）。
 */
.participant-photo {
  width: 48px;
  height: 48px;
  object-fit: cover;
}
@media (max-width: 767px) {
  .participant-photo {
    width: 64px;
    height: 64px;
  }
}

/*
 * ダッシュボードの本日の授業予定に表示する顔写真。名簿ページの参加者写真（.participant-photo）
 * よりも一回り大きくし、「なるべく大きく見やすく」という要望に応える
 * （行の情報量が多い分、写真を大きくしても窮屈にならないよう時刻/氏名/バッジ/内容を
 * 右側に縦積みでまとめている）。写真が未設定の生徒は、共通の「No Image」画像
 * （/assets/img/no-image.png）を表示し、写真あり/なしが混在してもレイアウトが揃うようにする。
 */
.dashboard-photo {
  width: 64px;
  height: 64px;
  object-fit: cover;
}
@media (max-width: 767px) {
  .dashboard-photo {
    width: 88px;
    height: 88px;
    font-size: 1.8rem;
  }
}

/*
 * 生徒一覧（students/index.php）の顔写真。他の一覧（.participant-photo/.dashboard-photo）より
 * 小さくし、生徒数が多くても表が重くならない程度に留める。写真が未設定の生徒は、
 * 他の一覧と同じ共通の「No Image」画像（/assets/img/no-image.png）を表示する。
 */
.student-list-photo {
  width: 28px;
  height: 28px;
  object-fit: cover;
}
