/**
 * カレンダーレイヤースタイル
 * シンプルカレンダー (Komorebi / Lifebear) 風 クリーンホワイトデザイン
 * 月曜日始まりマンスリーグリッド
 */

.calendar-grid {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 8px 12px;
  box-sizing: border-box;
  background-color: var(--bg-primary);
}

/* === マンスリーグリッド === */
.month-grid {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 曜日見出し（月〜日） */
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin-bottom: 4px;
  text-align: center;
  border-bottom: 1px solid var(--border-medium);
  padding-bottom: 4px;
}

.weekday-cell {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569; /* 平日: シックな濃いグレー */
  padding: 4px 0;
  letter-spacing: 0.02em;
}

.weekday-cell.sat { color: #2563eb; } /* 土曜: 爽やかな青 */
.weekday-cell.sun { color: #dc2626; } /* 日曜: 優しい赤 */

/* 日付グリッド (7列 × 5〜6行) */
.calendar-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  gap: 1px;
  background-color: var(--border-medium); /* グリッド境界線 */
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.day-cell {
  background: #ffffff;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 前月・翌月 */
.day-cell.other-month {
  background: #f8fafc;
}
.day-cell.other-month .day-num {
  color: #cbd5e1;
}

/* 今日のマス */
.day-cell.is-today {
  background: #f0f7ff;
}

/* 曜日別の文字色 */
.day-cell.sat .day-num { color: #2563eb; }
.day-cell.sun .day-num { color: #dc2626; }

.day-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 4px;
}

.day-num {
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

/* 今日の丸バッジ（シンプルカレンダー風のロイヤルブルー） */
.day-num.today-badge {
  background: #2563eb;
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.day-events {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  scrollbar-width: none;
}
.day-events::-webkit-scrollbar { display: none; }

/* 予定カード（白背景に映える淡いパステルブルーピル） */
.calendar-event-pill {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #1e3a8a;
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none; /* 手書きを邪魔しない */
}

.event-time {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: #2563eb;
  font-weight: 700;
  flex-shrink: 0;
}

.event-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* スマホ向けカレンダー最適化 */
@media (max-width: 640px) {
  .calendar-grid {
    padding: 4px 6px;
  }

  .calendar-weekdays {
    margin-bottom: 2px;
    padding-bottom: 2px;
  }

  .weekday-cell {
    font-size: 0.75rem;
    padding: 2px 0;
  }

  .day-cell {
    padding: 3px 4px;
  }

  .day-header {
    margin-bottom: 2px;
  }

  .day-num {
    font-size: 0.78rem;
    width: 20px;
    height: 20px;
  }

  .calendar-event-pill {
    padding: 1.5px 3px;
    font-size: 0.66rem;
    border-radius: 3px;
  }

  .event-time {
    display: none; /* スマホの月表示では予定タイトルを優先 */
  }
}
