/* Event Calendar Block - Frontend Styles */

.event-calendar-block {
	/* margin/paddingはWordPress block supportsで制御 */
	width: 100%;
	box-sizing: border-box;
}

/* カレンダーコンテナ */
.ec-calendars-container {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	gap: 30px;
	width: 100%;
	margin: 0;
	padding: 0;
}

/* カレンダーラッパー */
.ec-calendar-wrapper {
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 12px;
	padding: 20px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.06);
	transition: box-shadow 0.3s;
}

.ec-calendar-wrapper:hover {
	box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

/* カレンダーヘッダー */
.ec-calendar-header {
	margin-bottom: 20px;
	text-align: center;
	padding-bottom: 15px;
	border-bottom: 2px solid #f1f5f9;
}

.ec-calendar-month {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	color: #1e293b;
	letter-spacing: 0.5px;
}

/* 曜日ヘッダー */
.ec-calendar-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	margin-bottom: 8px;
	padding: 0 5px;
}

.ec-calendar-weekday {
	text-align: center;
	font-size: 13px;
	font-weight: 700;
	color: #64748b;
	padding: 10px 4px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.ec-calendar-weekday:first-child {
	color: #ef4444; /* 日曜日 */
}

.ec-calendar-weekday:last-child {
	color: #3b82f6; /* 土曜日 */
}

/* カレンダーグリッド */
.ec-calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 6px;
	padding: 10px;
	background: #f8fafc;
	border-radius: 8px;
}

/* カレンダーセル */
.ec-calendar-cell {
	min-height: 100px;
	padding: 10px;
	background: #ffffff;
	border: 2px solid #e2e8f0;
	border-radius: 8px;
	position: relative;
	transition: all 0.3s ease;
	cursor: pointer;
	overflow: hidden;
}

.ec-calendar-cell:hover {
	border-color: #3498db;
	box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
	transform: translateY(-2px);
}

.ec-calendar-cell-empty {
	background: transparent;
	border: none;
	cursor: default;
	min-height: 0;
}

.ec-calendar-cell-empty:hover {
	transform: none;
	box-shadow: none;
}

.ec-calendar-cell-today {
	background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
	border-color: #f59e0b;
	border-width: 3px;
	font-weight: 700;
	box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.ec-calendar-cell-today:hover {
	border-color: #d97706;
	box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.ec-calendar-cell-has-events {
	background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
	border-color: #0ea5e9;
}

.ec-calendar-cell-has-events:hover {
	background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

/* 日付番号 */
.ec-calendar-day-number {
	font-size: 16px;
	font-weight: 700;
	color: #1e293b;
	margin-bottom: 8px;
	line-height: 1;
}

.ec-calendar-cell-today .ec-calendar-day-number {
	color: #f59e0b;
	font-size: 18px;
}

/* イベントコンテナ */
.ec-calendar-events {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-top: 8px;
}

/* イベントバッジ */
.ec-calendar-event-badge {
	padding: 8px 10px;
	border-radius: 6px;
	font-size: 12px;
	line-height: 1.4;
	background: #e3f2fd;
	border-left: 4px solid #3498db;
	transition: all 0.2s;
	position: relative;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.ec-calendar-event-badge:hover {
	transform: translateX(3px);
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.ec-event-title {
	font-weight: 700;
	color: #1e293b;
	margin-bottom: 4px;
	line-height: 1.3;
	word-break: break-word;
}

.ec-event-time,
.ec-event-location {
	font-size: 11px;
	color: #64748b;
	margin-bottom: 3px;
	display: flex;
	align-items: center;
	gap: 4px;
}

.ec-event-description {
	font-size: 11px;
	color: #475569;
	margin-top: 6px;
	line-height: 1.5;
	word-break: break-word;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ec-event-link {
	display: inline-block;
	margin-top: 6px;
	font-size: 11px;
	font-weight: 700;
	text-decoration: none;
	color: #3498db;
	transition: color 0.2s;
}

.ec-event-link:hover {
	color: #2980b9;
	text-decoration: underline;
}

.ec-calendar-event-more {
	font-size: 11px;
	color: #64748b;
	font-weight: 700;
	text-align: center;
	padding: 4px;
	background: #f1f5f9;
	border-radius: 4px;
	margin-top: 4px;
}

/* モーダル用のスタイル（フロントエンド用） */
.ec-modal-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	padding: 20px;
	backdrop-filter: blur(4px);
}

.ec-modal {
	background: #ffffff;
	border-radius: 16px;
	max-width: 600px;
	width: 100%;
	max-height: 80vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0,0,0,0.3);
	animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
	from {
		opacity: 0;
		transform: translateY(-20px) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

.ec-modal-header {
	padding: 25px;
	border-bottom: 2px solid #f1f5f9;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.ec-modal-title {
	font-size: 24px;
	font-weight: 700;
	color: #1e293b;
	margin: 0;
}

.ec-modal-close {
	background: #f1f5f9;
	border: none;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	font-size: 20px;
	color: #64748b;
	transition: all 0.2s;
}

.ec-modal-close:hover {
	background: #e2e8f0;
	color: #1e293b;
	transform: rotate(90deg);
}

.ec-modal-body {
	padding: 25px;
}

.ec-modal-info {
	display: flex;
	flex-direction: column;
	gap: 15px;
}

.ec-modal-info-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px;
	background: #f8fafc;
	border-radius: 8px;
}

.ec-modal-info-icon {
	font-size: 20px;
	flex-shrink: 0;
}

.ec-modal-info-content {
	flex: 1;
}

.ec-modal-info-label {
	font-size: 12px;
	font-weight: 700;
	color: #64748b;
	text-transform: uppercase;
	margin-bottom: 4px;
}

.ec-modal-info-value {
	font-size: 15px;
	color: #1e293b;
	line-height: 1.6;
}

.ec-modal-footer {
	padding: 20px 25px;
	border-top: 2px solid #f1f5f9;
	display: flex;
	justify-content: flex-end;
}

.ec-modal-link-button {
	display: inline-block;
	padding: 12px 24px;
	background: #3498db;
	color: #ffffff;
	text-decoration: none;
	border-radius: 8px;
	font-weight: 700;
	font-size: 14px;
	transition: all 0.2s;
	box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.ec-modal-link-button:hover {
	background: #2980b9;
	color: #ffffff;
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

/* ============================================
   コンテナクエリの定義
   ============================================ */
.event-calendar-block {
	container-type: inline-size;
	container-name: event-calendar-block;
}

/* ============================================
   レスポンシブデザイン（ビューポートベース）
   ============================================ */

/* 小さいモバイル（max-width: 400px） */
@media only screen and (max-width: 400px) {
	.event-calendar-block {
		padding: 12px 8px;
		margin: 15px 0;
	}
	
	.ec-calendars-container {
		grid-template-columns: 1fr;
		gap: 15px;
	}
	
	.ec-calendar-wrapper {
		padding: 12px;
	}
	
	.ec-calendar-month {
		font-size: 16px;
	}
	
	.ec-calendar-weekday {
		font-size: 10px;
		padding: 6px 2px;
	}
	
	.ec-calendar-grid {
		gap: 3px;
		padding: 5px;
	}
	
	.ec-calendar-cell {
		min-height: 60px;
		padding: 4px;
	}
	
	.ec-calendar-day-number {
		font-size: 12px;
		margin-bottom: 4px;
	}
	
	.ec-calendar-event-badge {
		padding: 4px 6px;
		font-size: 10px;
	}
	
	.ec-event-title {
		font-size: 10px;
		margin-bottom: 2px;
	}
	
	.ec-event-time,
	.ec-event-location {
		font-size: 9px;
	}
	
	.ec-event-description {
		display: none;
	}
	
	.ec-modal {
		max-width: 100%;
		max-height: 90vh;
		border-radius: 12px;
	}
	
	.ec-modal-header,
	.ec-modal-body,
	.ec-modal-footer {
		padding: 15px;
	}
	
	.ec-modal-title {
		font-size: 18px;
	}
}

/* タブレット（min-width: 481px） */
@media only screen and (min-width: 481px) {
	.event-calendar-block {
		padding: 20px 15px;
		margin: 20px 0;
	}
	
	.ec-calendars-container {
		grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
		gap: 20px;
	}
	
	.ec-calendar-wrapper {
		padding: 15px;
	}
	
	.ec-calendar-month {
		font-size: 18px;
	}
	
	.ec-calendar-weekday {
		font-size: 11px;
		padding: 8px 2px;
	}
	
	.ec-calendar-cell {
		min-height: 80px;
		padding: 6px;
	}
	
	.ec-calendar-day-number {
		font-size: 14px;
	}
	
	.ec-calendar-event-badge {
		padding: 6px 8px;
		font-size: 11px;
	}
	
	.ec-event-title {
		font-size: 11px;
	}
	
	.ec-event-time,
	.ec-event-location,
	.ec-event-description {
		font-size: 10px;
	}
}

/* デスクトップ（min-width: 769px） */
@media only screen and (min-width: 769px) {
	.event-calendar-block {
		padding: 30px;
		margin: 40px 0;
	}
	
	.ec-calendars-container {
		grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
		gap: 30px;
	}
	
	.ec-calendar-wrapper {
		padding: 20px;
	}
	
	.ec-calendar-month {
		font-size: 22px;
	}
	
	.ec-calendar-weekday {
		font-size: 13px;
		padding: 10px 4px;
	}
	
	.ec-calendar-cell {
		min-height: 100px;
		padding: 10px;
	}
	
	.ec-calendar-day-number {
		font-size: 16px;
	}
	
	.ec-calendar-event-badge {
		padding: 8px 10px;
		font-size: 12px;
	}
	
	.ec-event-title {
		font-size: 12px;
	}
	
	.ec-event-time,
	.ec-event-location,
	.ec-event-description {
		font-size: 11px;
	}
}

/* 大きなデスクトップ（min-width: 1030px） */
@media only screen and (min-width: 1030px) {
	.event-calendar-block {
		padding: 35px 30px;
	}
	
	.ec-calendars-container {
		gap: 35px;
	}
}

/* 超大画面（min-width: 1240px） */
@media only screen and (min-width: 1240px) {
	.event-calendar-block {
		max-width: 1400px;
		margin: 40px auto;
	}
}

/* HDサイズ（min-width: 1920px） */
@media only screen and (min-width: 1920px) {
	.event-calendar-block {
		padding: 40px 35px;
	}
	
	.ec-calendars-container {
		gap: 40px;
	}
	
	.ec-calendar-wrapper {
		padding: 25px;
	}
	
	.ec-calendar-month {
		font-size: 24px;
	}
	
	.ec-calendar-cell {
		min-height: 120px;
		padding: 12px;
	}
	
	.ec-calendar-day-number {
		font-size: 18px;
	}
	
	.ec-calendar-event-badge {
		padding: 10px 12px;
		font-size: 13px;
	}
	
	.ec-event-title {
		font-size: 13px;
	}
	
	.ec-event-time,
	.ec-event-location,
	.ec-event-description {
		font-size: 12px;
	}
}

/* 4Kサイズ（min-width: 3840px） */
@media only screen and (min-width: 3840px) {
	.event-calendar-block {
		padding: 48px 40px;
	}
	
	.ec-calendars-container {
		gap: 48px;
	}
	
	.ec-calendar-wrapper {
		padding: 30px;
	}
	
	.ec-calendar-month {
		font-size: 26px;
	}
	
	.ec-calendar-cell {
		min-height: 140px;
		padding: 14px;
	}
	
	.ec-calendar-day-number {
		font-size: 20px;
	}
	
	.ec-calendar-event-badge {
		padding: 12px 14px;
		font-size: 14px;
	}
	
	.ec-event-title {
		font-size: 14px;
	}
	
	.ec-event-time,
	.ec-event-location,
	.ec-event-description {
		font-size: 13px;
	}
}

/* ============================================
   コンテナクエリ（コラム内など、コンテナ幅が制限される場合）
   ============================================ */

/* 小さいモバイル（コンテナ） */
@container event-calendar-block (max-width: 400px) {
	.event-calendar-block {
		padding: 12px 8px;
	}
	
	.ec-calendars-container {
		grid-template-columns: 1fr;
		gap: 15px;
	}
	
	.ec-calendar-cell {
		min-height: 60px;
		padding: 4px;
	}
}

/* タブレット（コンテナ） */
@container event-calendar-block (min-width: 481px) {
	.ec-calendars-container {
		grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	}
}

/* デスクトップ（コンテナ） */
@container event-calendar-block (min-width: 769px) {
	.ec-calendars-container {
		grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
	}
}

/* 大きなデスクトップ（コンテナ） */
@container event-calendar-block (min-width: 1030px) {
	.ec-calendars-container {
		gap: 35px;
	}
}

/* ============================================
   JavaScriptフォールバック用クラス
   （コンテナクエリがサポートされていない場合）
   ============================================ */
.event-calendar-block.ut-mobile-size {
	padding: 12px 8px;
}

.event-calendar-block.ut-mobile-size .ec-calendars-container {
	grid-template-columns: 1fr !important;
	gap: 15px;
}

.event-calendar-block.ut-tablet-size .ec-calendars-container {
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.event-calendar-block.ut-desktop-size .ec-calendars-container {
	grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* プリント用スタイル */
@media print {
	.event-calendar-block {
		box-shadow: none;
		border: 1px solid #e2e8f0;
	}
	
	.ec-calendar-cell {
		page-break-inside: avoid;
	}
	
	.ec-modal-overlay {
		display: none;
	}
}

/* アクセシビリティ */
.ec-calendar-cell:focus {
	outline: 3px solid #3498db;
	outline-offset: 2px;
}

.ec-calendar-event-badge:focus {
	outline: 2px solid #3498db;
	outline-offset: 1px;
}

/* アニメーション */
@media (prefers-reduced-motion: reduce) {
	.ec-calendar-cell,
	.ec-calendar-event-badge,
	.ec-modal {
		transition: none;
		animation: none;
	}
}

