/**
 * イベント管理機能 - フロントエンドスタイル
 * @package ShingakuEventManager
 */

/* =====================================
   イベント一覧グリッド
   ===================================== */
.shgk-event-list-wrapper {
	margin: 20px 0;
}

.shgk-event-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 20px;
	margin: 20px 0;
}

/* カラム数指定用のクラス */
.shgk-event-grid.shgk-grid-cols-1 { grid-template-columns: 1fr !important; }
.shgk-event-grid.shgk-grid-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.shgk-event-grid.shgk-grid-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.shgk-event-grid.shgk-grid-cols-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* タブレット対応 (〜768px) */
@media (max-width: 768px) {
	/* 3カラム以上はタブレットで2カラムに落とす */
	.shgk-event-grid.shgk-grid-cols-3,
	.shgk-event-grid.shgk-grid-cols-4 {
		grid-template-columns: repeat(2, 1fr) !important;
	}
}

.shgk-event-card {
	border: 1px solid #ddd;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	transition: box-shadow 0.3s ease;
	display: flex;
	flex-direction: column;
	text-decoration: none;
	color: inherit;
}

.shgk-event-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	text-decoration: none;
}

.shgk-event-thumbnail {
	width: 100%;
	height: 200px;
	overflow: hidden;
	background: #f5f5f5;
	position: relative; /* オーバーレイのために相対配置 */
}

.shgk-event-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.3s ease;
}

.shgk-event-card:hover .shgk-event-thumbnail img {
	transform: scale(1.05);
}

.shgk-event-badges-overlay {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	flex-direction: column;
	gap: 5px;
	z-index: 2;
	pointer-events: none;
}

.shgk-badge {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 0.75rem;
	font-weight: 700;
	color: #fff;
	line-height: 1;
	white-space: nowrap;
}

.shgk-badge-new {
	background-color: #e53935; /* 赤 */
}

.shgk-badge-upcoming {
	background-color: #ff9800; /* オレンジ */
}

.shgk-badge-capacity {
	background-color: #fdd835; /* 黄色 */
	color: #333;
}

.shgk-badge-full {
	background-color: #757575; /* グレー */
}

/* タームバッジ（カテゴリー・受験種別） */
.shgk-event-terms {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 8px;
}

.shgk-term-badge {
	display: inline-block;
	padding: 3px 8px;
	border-radius: 12px;
	font-size: 0.75rem;
	line-height: 1.2;
	color: #fff;
	background-color: #666;
}

.shgk-term-category {
	background-color: #0073aa; /* WordPress Blue - デフォルト */
}

/* イベントカテゴリーごとのカラー（v24.0+） */
.shgk-term-category-online {
	background-color: #00ACC1; /* シアンブルー: オンライン系 - デジタル・現代的 */
	color: #fff;
}

.shgk-term-category-venue {
	background-color: #FFA000; /* アンバーゴールド: 会場系 - 温かみ・機会の価値 */
	color: #fff;
}

.shgk-term-exam {
	background-color: #00897b; /* Teal - デフォルト */
}

/* 受験種別ごとのカラー（v24.0+） */
.shgk-term-exam-elementary-exam {
	background-color: #29B6F6; /* スカイブルー: 小学校受験 - 無垢・はじまり */
	color: #fff;
}

.shgk-term-exam-junior-high-exam {
	background-color: #F57C00; /* パーシモンオレンジ: 中学受験 - 情熱・本気 */
	color: #fff;
}

.shgk-term-exam-high-school-exam {
	background-color: #1565C0; /* ロイヤルネイビー: 高校受験 - 知性・覚悟 */
	color: #fff;
}

.shgk-time-sep {
	margin: 0 4px;
	color: #ccc;
}

.shgk-event-content {
	padding: 15px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

/* =====================================
   モバイル最適化
   ===================================== */
@media (max-width: 480px) {
	/* 詳細度を最大化してスタイルを強制適用 */
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-grid {
		gap: 11px !important;
		display: grid !important;
		grid-template-columns: 1fr !important;
	}

	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-card {
		margin-bottom: 0 !important;
		width: 100% !important;
	}

	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-thumbnail {
		height: 120px !important;
	}

	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-content {
		padding: 8px 10px !important;
	}

	/* タイトルスタイル（目次プラグイン等の影響をリセット） */
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-card .shgk-event-title,
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-card .shgk-event-title span,
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-card .shgk-event-title a {
		font-size: 16px !important;
		margin: 0 0 5px 0 !important;
		padding: 0 !important;
		line-height: 1.3 !important;
		font-weight: 600 !important;
		display: block !important;
	}

	/* メタ情報 */
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-meta {
		font-size: 13px !important;
		margin: 2px 0 !important;
		gap: 5px !important;
		line-height: 1.3 !important;
		display: flex !important;
		align-items: baseline !important;
		flex-wrap: wrap !important;
	}

	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-meta strong {
		min-width: 30px !important;
		color: #999 !important;
		font-weight: normal !important;
		font-size: 12px !important;
		margin-right: 2px !important;
	}

	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-meta span {
		color: #555 !important;
	}

	/* タームバッジ */
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-terms {
		gap: 4px !important;
		margin-bottom: 5px !important;
		display: flex !important;
		flex-wrap: wrap !important;
	}

	html body .shgk-event-list-wrapper .shgk-event-list .shgk-term-badge {
		padding: 1px 5px !important;
		font-size: 11px !important;
		border-radius: 8px !important;
		line-height: 1.2 !important;
		display: inline-block !important;
	}

	/* 抜粋文 */
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-description {
		font-size: 13px !important;
		margin-top: 5px !important;
		line-height: 1.4 !important;
		color: #777 !important;
	}

	/* バッジオーバーレイ */
	html body .shgk-event-list-wrapper .shgk-event-list .shgk-event-badges-overlay,
	html body .shgk-event-list .shgk-event-badges {
		gap: 3px !important;
		top: 5px !important;
		left: 5px !important;
		display: flex !important;
		flex-direction: column !important;
	}

	html body .shgk-event-list-wrapper .shgk-event-list .shgk-badge {
		padding: 2px 5px !important;
		font-size: 11px !important;
		border-radius: 3px !important;
		line-height: 1 !important;
		display: inline-block !important;
		width: fit-content !important;
	}
}

/* タイトルスタイル（div化に対応） */
.shgk-event-title {
	margin: 0 0 10px 0;
	font-size: 1.2em;
	font-weight: 700;
	line-height: 1.4;
	color: #333;
}

.shgk-event-title a {
	color: inherit;
	text-decoration: none;
}

.shgk-event-title a:hover {
	color: #0073aa;
}

.shgk-event-card .shgk-event-title {
	margin: 0 0 6px 0 !important;
	padding: 0 !important;
	font-size: 1.05em;
	line-height: 1.25;
	font-weight: 600;
	color: #333;
}

.shgk-event-card:hover .shgk-event-title {
	color: #0073aa;
}

.shgk-event-meta {
	margin: 4px 0;
	color: #666;
	font-size: 0.9em;
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.shgk-event-meta strong {
	color: #333;
	min-width: 70px;
	flex-shrink: 0;
}

.shgk-event-description {
	margin: 8px 0;
	color: #666;
	font-size: 0.9em;
	line-height: 1.5;
}

.shgk-all-day-badge {
	display: inline-block;
	padding: 2px 8px;
	background: #fff3cd;
	color: #856404;
	border-radius: 3px;
	font-size: 0.85em;
	margin-left: 8px;
	border: 1px solid #ffeeba;
}

/* =====================================
   シンプルリスト形式
   ===================================== */
.shgk-event-list-simple .shgk-event-list-items {
	list-style: none;
	padding: 0;
	margin: 20px 0;
}

.shgk-event-list-simple .shgk-event-list-item {
	padding: 12px;
	border-bottom: 1px solid #eee;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}

.shgk-event-list-simple .shgk-event-list-item:hover {
	background: #f9f9f9;
}

.shgk-event-date {
	color: #666;
	font-size: 0.9em;
	white-space: nowrap;
}

.shgk-event-separator {
	color: #ccc;
}

.shgk-event-location {
	color: #888;
	font-size: 0.85em;
	margin-left: auto;
}

/* =====================================
   テーブル形式
   ===================================== */
.shgk-event-table {
	width: 100%;
	border-collapse: collapse;
	margin: 20px 0;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shgk-event-table thead {
	background: #0073aa;
	color: #fff;
}

.shgk-event-table th {
	padding: 12px 15px;
	text-align: left;
	font-weight: 600;
	border-bottom: 2px solid #005a87;
}

.shgk-event-table tbody tr {
	border-bottom: 1px solid #ddd;
	transition: background-color 0.2s ease;
}

.shgk-event-table tbody tr:hover {
	background-color: #f9f9f9;
}

.shgk-event-table tbody tr:last-child {
	border-bottom: none;
}

.shgk-event-table td {
	padding: 12px 15px;
	vertical-align: top;
}

/* 開催日列 */
.shgk-event-table .shgk-event-date {
	width: 180px;
	white-space: nowrap;
}

.shgk-event-table .shgk-date-main {
	color: #333;
	font-weight: 500;
	margin-bottom: 4px;
}

.shgk-event-table .shgk-time {
	color: #666;
}

/* イベント名列 */
.shgk-event-table .shgk-event-name {
	width: 45%;
}

.shgk-event-table .shgk-event-title {
	margin-bottom: 6px;
}

.shgk-event-table .shgk-event-title a {
	color: #333;
	text-decoration: none;
	font-weight: 500;
	font-size: 1.05em;
}

.shgk-event-table .shgk-event-title a:hover {
	color: #0073aa;
	text-decoration: underline;
}

.shgk-event-table .shgk-event-summary {
	color: #666;
	font-size: 0.9em;
	line-height: 1.5;
}

/* 場所列 */
.shgk-event-table .shgk-event-location {
	color: #666;
	width: 25%;
}

/* テーブル形式のレスポンシブ対応 */
@media (max-width: 768px) {
	.shgk-event-table {
		font-size: 0.9em;
	}

	.shgk-event-table th,
	.shgk-event-table td {
		padding: 10px;
	}

	.shgk-event-table .shgk-event-date {
		width: 140px;
		font-size: 0.85em;
	}

	.shgk-event-table .shgk-event-name {
		width: auto;
	}

	/* 狭い画面では場所列を非表示 */
	.shgk-event-table th:nth-child(3),
	.shgk-event-table td:nth-child(3) {
		display: none;
	}
}

@media (max-width: 480px) {
	.shgk-event-table th,
	.shgk-event-table td {
		padding: 8px;
	}

	.shgk-event-table .shgk-event-date {
		width: 110px;
		font-size: 0.8em;
	}

	.shgk-event-table .shgk-event-summary {
		font-size: 0.85em;
	}
}

/* =====================================
   モダンテーブル形式 (v18.0+)
   ===================================== */
.shgk-table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.shgk-event-list-modern .shgk-event-table th {
    background-color: #f8f9fa; /* 薄いグレーに変更 */
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-weight: 700;
    white-space: nowrap;
}

.shgk-event-list-modern .shgk-event-table td {
    vertical-align: middle; /* 上揃えではなく中央揃え */
}

/* カラム幅設定 */
.shgk-col-date { width: 15%; min-width: 140px; }
.shgk-col-content { width: 40%; min-width: 250px; }
.shgk-col-venue { width: 15%; min-width: 100px; }
.shgk-col-status { width: 15%; min-width: 100px; }
.shgk-col-action { width: 15%; min-width: 100px; }

/* 日時セル */
.shgk-event-date .shgk-weekday {
    color: #6c757d;
}
.shgk-event-date .shgk-date-sep {
    color: #adb5bd;
    margin: 0 2px;
}

/* コンテンツセル */
.shgk-event-content-cell .shgk-event-badges {
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.shgk-event-content-cell .shgk-event-title {
    margin: 0 0 6px 0;
    font-size: 1.1em;
}
.shgk-event-content-cell .shgk-event-terms {
    margin-bottom: 6px;
}
.shgk-event-content-cell .shgk-event-description {
    color: #6c757d;
    font-size: 0.9em;
    margin: 0;
}

/* ステータスセル */
.shgk-event-status {
    text-align: center;
}
.shgk-capacity-label {
    display: block;
    font-size: 0.75em;
    color: #6c757d;
    margin-bottom: 2px;
}
.shgk-capacity-value {
    font-weight: 700;
    font-size: 1.1em;
}
.shgk-no-limit {
    color: #adb5bd;
}

/* アクションセル */
.shgk-event-action {
    text-align: center;
}
.shgk-button-detail {
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 0.9em;
    text-decoration: none;
    transition: background-color 0.2s;
    display: inline-block;
}
.shgk-button-detail:hover {
    background-color: #005177;
    color: #fff;
}

/* モバイル対応調整 */
@media (max-width: 768px) {
    .shgk-event-list-modern .shgk-event-table th, 
    .shgk-event-list-modern .shgk-event-table td {
        padding: 10px 8px;
    }
}