/* Calendar Styles */

.calendar-area {
	margin-bottom: 2rem;
}

.calendar-header {
	margin-bottom: 1rem;
}

.calendar-title {
	margin: 0;
	font-size: 1.5rem;
	text-align: center;
}

/* カレンダーテーブルのレイアウト修正 */
.calendar-table {
	width: 100%;
	/* 列幅を均等に固定 */
	table-layout: fixed;
	/* セル間の境界線を結合 */
	border-collapse: collapse;
	/* 境界線のスペースをなくす */
	border-spacing: 0;
}

/* セルの基本スタイル */
.calendar-table th,
.calendar-table td {
	text-align: center;
	vertical-align: top;
	padding: 0.5rem;
	border: 1px solid #dee2e6;
	/* 全てのセルに固定高さを設定 */
	height: 6rem;
	/* 最大幅を設定して均等化 */
	width: calc(100% / 7);
}

/* ヘッダー行のスタイル */
.calendar-table th {
	background-color: #f8f9fa;
	font-weight: 500;
	padding: 0.75rem 0.5rem;
	height: auto;
}

/* 日付セルのスタイル */
.calendar-day {
	height: 100%;
	position: relative;
	/* 内容が多い場合のスクロール対応 */
	overflow-y: auto;
}

/* 日付番号のスタイル */
.day-number {
	position: absolute;
	top: 0.25rem;
	left: 0.25rem;
	font-weight: 500;
	font-size: 1rem;
	/* 必ず前面に表示 */
	z-index: 1;
}

/* 空のセルのスタイル */
td.empty {
	background-color: #f8f9fa;
}

/* ゴミ種類の表示エリア */
.trash-types {
	margin-top: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	/* 幅を制限して均等化 */
	width: 100%;
}

/* 個別のゴミ種類の表示スタイル */
.trash-type {
	padding: 0.25rem 0.5rem;
	border-radius: 0.25rem;
	font-size: 0.85rem;
	color: #fff;
	text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	/* 最大幅を設定して均等化 */
	max-width: 100%;
	/* ボックスモデルを変更して、paddingを含めた幅にする */
	box-sizing: border-box;
}

/* 凡例エリアのスタイル */
.trash-legend {
	margin-top: 1.5rem;
	padding: 1rem;
	background-color: #f8f9fa;
	border-radius: 0.25rem;
}

.trash-legend h4 {
	margin-bottom: 1rem;
	font-size: 1.25rem;
}

/* 凡例の個別アイテムのスタイル */
.trash-type-legend {
	display: flex;
	align-items: center;
	margin-bottom: 0.5rem;
}

.trash-color {
	display: inline-block;
	width: 1.5rem;
	height: 1.5rem;
	border-radius: 0.25rem;
	margin-right: 0.5rem;
	flex-shrink: 0;
}

.trash-name {
	font-size: 0.9rem;
}

/* タブレットサイズのレスポンシブ調整 */
@media (max-width: 767.98px) {
	.calendar-table td,
	.calendar-day {
		height: 5rem;
	}
	
	.trash-type {
		font-size: 0.75rem;
		padding: 0.2rem 0.4rem;
	}
	
	.day-number {
		font-size: 0.9rem;
	}
}

/* スマホサイズのレスポンシブ調整 */
@media (max-width: 575.98px) {
	.calendar-table th {
		padding: 0.5rem 0.25rem;
		font-size: 0.8rem;
	}
	
	.calendar-table td,
	.calendar-day {
		height: 4rem;
		/* スマホではパディングを減らす */
		padding: 0.25rem;
	}
	
	.trash-types {
		margin-top: 1.2rem;
	}
	
	.trash-type {
		font-size: 0.7rem;
		padding: 0.15rem 0.3rem;
	}
}

/* 特別な日のスタイリング */
.calendar-table td.today {
	background-color: rgba(253, 245, 230, 0.5);
	box-shadow: inset 0 0 0 2px #ffc107;
}

/* 印刷時のスタイル */
@media print {
	.sidebar,
	.navbar,
	.footer,
	.calendar-header a {
		display: none !important;
	}
	
	main {
		margin-left: 0 !important;
		width: 100% !important;
	}
	
	.calendar-table {
		font-size: 0.9rem;
		/* 印刷時に表が途切れないように */
		page-break-inside: avoid;
	}
	
	.calendar-table td,
	.calendar-day {
		height: 5rem;
	}
	
	.trash-type {
		border: 1px solid #000;
		/* 背景色が印刷されない場合の対策 */
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
	
	.container-fluid {
		padding: 0 !important;
	}
}

/* 曜日によって文字色を変更 */
.calendar-table th:first-child,
.calendar-table td:first-child .day-number {
	color: #dc3545; /* 日曜日は赤 */
}

.calendar-table th:last-child,
.calendar-table td:last-child .day-number {
	color: #007bff; /* 土曜日は青 */
}

/* 最後の週の空セルも同じ高さに保つ */
.calendar-table tr:last-child td {
	height: 6rem;
}

/* 行全体の高さを統一する */
.calendar-table tr {
	height: 6rem;
}

/* カレンダーテーブルの幅を均等に保つための追加修正 */
.calendar-table colgroup col {
	width: calc(100% / 7);
}