/* ================================================================
   メイン画面 - ガントチャート & カレンダー
   ================================================================ */

/* ---------- メインレイアウト ---------- */
.main-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 24px 40px;
}

/* ================================================================
   ガントチャート（PC表示）
   ================================================================ */
.gantt-wrapper {
  background: var(--color-surface);
}

.gantt-table {
  border-collapse: collapse;
  min-width: 100%;
}

.gantt-table th,
.gantt-table td {
  border: 1px solid var(--color-border);
  text-align: center;
  white-space: nowrap;
}

/* ヘッダー（日付行） */
.gantt-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface-2);
  padding: 8px 4px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
}

.gantt-table thead th.is-today {
  color: var(--color-primary-text);
  background: var(--color-primary-bg);
}
.gantt-table thead th.is-sunday {
  color: var(--color-danger);
}
.gantt-table thead th.is-saturday {
  color: #5ba3f5;
}

/* スタッフ名列（左固定・内容フィット） */
.gantt-table .staff-name {
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--color-surface-2);
  padding: 8px 10px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  width: 1%; /* 内容量ギリギリの幅にする */
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* セル */
.gantt-table td.day-cell {
  min-width: 40px; /* 最小幅を維持、画面が広い場合は均等に伸びる */
  height: 50px; /* クリックしやすい高さ */
  padding: 4px;
  cursor: pointer;
  transition: background var(--transition-fast);
  position: relative;
}
.gantt-table td.day-cell:hover {
  background: var(--color-surface-hover);
}

/* クロスハイライト（縦横軸） */
.gantt-table td.cross-highlight,
.gantt-table th.cross-highlight {
  background-color: #F1F5F9 !important;
}

/* ドラッグ選択中 */
.gantt-table.is-dragging {
  user-select: none;
  -webkit-user-select: none;
}
.gantt-table td.day-cell.drag-highlight {
  background: var(--color-primary-bg);
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* 希望マーカー（モダンなバッジ型） */
.gantt-table td.day-cell .marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;  /* 固定サイズ */
  height: 32px;
  margin: 0 auto; /* 中央揃え */
  border-radius: 6px; /* 角丸バッジ */
  font-size: var(--font-size-xs);
  font-weight: 600;
  transition: transform 0.1s;
}
.gantt-table td.day-cell:hover .marker:not(.is-bar-start):not(.is-bar-middle):not(.is-bar-end) {
  transform: scale(1.05); /* ホバー時のマイクロインタラクション（単発のみ） */
}

/* 複数日バー表示用スタイル（PC） */
.gantt-table td.day-cell .marker.is-bar-start {
  width: calc(100% + 5px);
  margin-right: -5px;
  border-radius: 6px 0 0 6px;
  position: relative;
  z-index: 2;
}
.gantt-table td.day-cell .marker.is-bar-middle {
  width: calc(100% + 10px);
  margin: 0 -5px;
  border-radius: 0;
  position: relative;
  z-index: 2;
  color: transparent;
}
.gantt-table td.day-cell .marker.is-bar-end {
  width: calc(100% + 5px);
  margin-left: -5px;
  border-radius: 0 6px 6px 0;
  position: relative;
  z-index: 2;
  color: transparent;
}
.marker--off {
  background: var(--color-off-bg);
  color: var(--color-off);
}
.marker--am {
  background: var(--color-am-bg);
  color: var(--color-am);
}
.marker--pm {
  background: var(--color-pm-bg);
  color: var(--color-pm);
}
.marker--other {
  background: var(--color-other-bg);
  color: var(--color-other);
}
.marker--dispense {
  background: #fef0e0;
  color: #e67e22;
}
.marker--ringo {
  background: #fee2e2;
  color: #E73B3B;
}

/* 集計行 */
.gantt-table tfoot td {
  background: var(--color-surface-2);
  padding: 6px 4px;
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--color-text-secondary);
}

.radio-dot--other { background: #b2bec3; }
.radio-dot--dispense { background: #e67e22; }

.gantt-table tfoot .count-badge {
  display: inline-block;
  min-width: 20px;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: var(--font-size-xs);
}
.count-badge--warn {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

/* 凡例ドット */
.legend__dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend__dot--off { background: var(--color-off); }
.legend__dot--am { background: var(--color-am); }
.legend__dot--pm { background: var(--color-pm); }
.legend__dot--other { background: var(--color-other); }
.legend__dot--dispense { background: #e67e22; }

/* ================================================================
   カレンダー（スマホ表示）- Google Calendar 風
   ================================================================ */
.calendar-wrapper {
  display: none; /* PCでは非表示 */
}

/* スタッフチップ（モバイル用横スクロール選択は廃止） */
.staff-chips {
  display: none;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.staff-chips::-webkit-scrollbar { display: none; }

.staff-chip {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  white-space: nowrap;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}
.staff-chip.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}
.staff-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 6px;
}

/* カレンダーグリッド */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
}

.calendar-grid__header {
  background: var(--color-surface-2);
  padding: 8px 0;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}
.calendar-grid__header.is-sunday { color: var(--color-danger); }
.calendar-grid__header.is-saturday { color: #5ba3f5; }

.calendar-grid__cell {
  background: var(--color-surface);
  min-height: 80px;
  padding: 5px 3px 4px;
  cursor: pointer;
  transition: background var(--transition-fast);
}
.calendar-grid__cell:hover {
  background: var(--color-surface-hover);
}
.calendar-grid__cell.is-empty {
  background: var(--color-bg);
  cursor: default;
}
.calendar-grid__cell.is-selected {
  background: var(--color-primary-bg);
}

/* 日付番号（Google Calendar スタイル：今日は青丸） */
.cal-date {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}
.cal-date__num {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50%;
  color: var(--color-text-secondary);
  line-height: 1;
}
.cal-date__num--today {
  background: var(--color-primary);
  color: #fff;
}
.calendar-grid__cell.is-sunday  .cal-date__num:not(.cal-date__num--today) { color: var(--color-danger); }
.calendar-grid__cell.is-saturday .cal-date__num:not(.cal-date__num--today) { color: #5ba3f5; }
.calendar-grid__cell.is-holiday  .cal-date__num:not(.cal-date__num--today) { color: var(--color-danger); }

/* イベント表示（コンパクト色ラベル） */
.cal-events {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.cal-evt {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 1px 3px;
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
}
.cal-evt--off      { background: var(--color-off-bg);    color: var(--color-off);   }
.cal-evt--am       { background: var(--color-am-bg);     color: var(--color-am);    }
.cal-evt--pm       { background: var(--color-pm-bg);     color: var(--color-pm);    }
.cal-evt--other    { background: var(--color-other-bg);  color: var(--color-other); }
.cal-evt--dispense { background: #fef0e0;                color: #e67e22;            }
.cal-evt--ringo    { background: #fee2e2;                color: #E73B3B;            }
.cal-evt--more     { background: var(--color-surface-2); color: var(--color-text-muted); text-align: center; }
/* 空きレーンのスペーサー：高さを確保して下の行がずれないようにする */
.cal-evt--spacer   { background: transparent; pointer-events: none; visibility: hidden; }

/* 複数日バー表示用スタイル（スマホ） */
.calendar-grid__cell .cal-evt.is-bar-start {
  width: calc(100% + 4px);
  margin-right: -4px;
  border-radius: 2px 0 0 2px;
  position: relative;
  z-index: 2;
}
.calendar-grid__cell .cal-evt.is-bar-middle {
  width: calc(100% + 8px);
  margin: 0 -4px;
  border-radius: 0;
  position: relative;
  z-index: 2;
  color: transparent !important;
}
.calendar-grid__cell .cal-evt.is-bar-end {
  width: calc(100% + 4px);
  margin-left: -4px;
  border-radius: 0 2px 2px 0;
  position: relative;
  z-index: 2;
  color: transparent !important;
}

/* ================================================================
   ボトムシート（日付詳細・スマホ）
   ================================================================ */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}
.bottom-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
}
.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border-radius: 20px 20px 0 0;
  padding-bottom: max(env(safe-area-inset-bottom, 0px), 20px);
  transform: translateY(100%);
  transition: transform var(--transition-normal);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
}
.bottom-sheet-overlay.active .bottom-sheet {
  transform: translateY(0);
}
.bottom-sheet__handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  margin: 12px auto 0;
  flex-shrink: 0;
}
.bottom-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}
.bottom-sheet__title {
  font-size: var(--font-size-base);
  font-weight: 700;
}
.bottom-sheet__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.bottom-sheet__close:hover {
  background: var(--color-surface-hover);
}
.bottom-sheet__body {
  padding: 16px 20px 4px;
  overflow-y: auto;
  flex: 1;
}

/* FABボタン（スマホ用フローティングアクション） */
.fab {
  position: fixed;
  bottom: 28px;
  right: 20px;
  z-index: 120;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary) 0%, #4338ca 100%);
  color: #fff;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.45);
  transition: all var(--transition-fast);
}
.fab:hover {
  transform: scale(1.07);
  box-shadow: var(--shadow-glow);
}
.fab:active {
  transform: scale(0.95);
}

/* ---------- 日付詳細リスト（ボトムシート内） ---------- */
.day-detail__list {
  list-style: none;
}

.day-detail__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  flex-wrap: wrap;
  border-radius: var(--radius-sm);
}
.day-detail__item:last-child {
  border-bottom: none;
}

/* タップ可能なイベント行 */
.day-detail__item--tappable {
  cursor: pointer;
  transition: background var(--transition-fast);
  margin: 0 -8px;
  padding: 10px 8px;
}
.day-detail__item--tappable:hover,
.day-detail__item--tappable:active {
  background: var(--color-surface-hover);
}

.day-detail__name {
  font-weight: 600;
  flex: 1;
}

.day-detail__chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.day-detail__note {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  display: block;
  width: 100%;
  padding-left: 2px;
  margin-top: -4px;
}

/* ================================================================
   その他リスト（画面下部）
   ================================================================ */
.other-list {
  margin-top: 24px;
}

.other-list__title {
  font-size: var(--font-size-lg);
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.other-list__count {
  font-size: var(--font-size-xs);
  background: var(--color-other-bg);
  color: var(--color-other);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}



.other-list__empty {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  padding: 24px 0;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  text-align: center;
}

/* ================================================================
   変更通知（画面下部）
   ================================================================ */
.changes-list {
  margin-top: 24px;
}

.changes-list__title {
  font-size: var(--font-size-base);
  font-weight: 700;
  margin-bottom: 12px;
}

.changes-list__items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.changes-list__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  color: var(--color-text-secondary);
}

.changes-list__time {
  min-width: 90px;
  color: var(--color-text-muted);
}

.changes-list__action {
  flex: 1;
}

/* ================================================================
   祝日表示
   ================================================================ */
.gantt-table thead th.is-holiday {
  color: var(--color-danger);
}
.gantt-table thead th.is-holiday::after {
  content: '祝';
  display: block;
  font-size: 0.5rem;
  color: var(--color-danger);
  line-height: 1;
}
.calendar-grid__cell.is-holiday .calendar-grid__date {
  color: var(--color-danger);
}

/* ================================================================
   レスポンシブ
   ================================================================ */
@media (max-width: 768px) {
  .main-container {
    padding: 0 12px 100px; /* FAB分の余白を確保 */
  }
  .gantt-wrapper {
    display: none; /* スマホではガント非表示 */
  }
  .calendar-wrapper {
    display: block; /* スマホでカレンダー表示 */
  }
  .toolbar-surface {
    justify-content: center;
  }
  /* 凡例はモバイルでは非表示（色で判別可能） */
  .legend--chips { display: none; }
  /* スタッフ選択ドロップダウンはチップUIに置き換え */
  .staff-selector { display: none; }
  /* ヘッダーナビはアイコンのみ（テキスト非表示） */
  .app-header__link-text { display: none; }
  .app-header__link { padding: 8px 10px; }
}

