/* ================================================
   Cast Manager - フロントエンドスタイル
   ================================================ */

/* ---------- ページヘッダー（テーマ非依存フォールバック） ---------- */
.cm-page-header {
	background: linear-gradient(135deg, #012b3e 0%, #0096b7 50%, #014a63 100%);
	padding: 32px 0;
	text-align: center;
	width: 100%;
	box-sizing: border-box;
	flex-shrink: 0;
	min-height: 120px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.cm-page-header__title {
	font-size: clamp(22px, 4vw, 36px);
	font-weight: 800;
	color: #fff;
	text-shadow: 0 2px 12px rgba(0, 167, 196,.3);
	margin-bottom: 12px;
}
.cm-page-header__desc {
	font-size: 14px;
	color: rgba(190, 235, 245,.8);
}
.cm-page-header__label {
	display: inline-block;
	background: rgba(255,255,255,.15);
	color: rgba(255,220,235,.9);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	padding: 3px 12px;
	border-radius: 999px;
	border: 1px solid rgba(255,255,255,.25);
	margin-bottom: 10px;
}

/* ---------- メインエリア（テーマ非依存フォールバック） ---------- */
.cm-site-main {
	min-height: 60vh;
	padding-bottom: 80px;
	width: 100%;
	flex: 1 1 100%;
	max-width: 100%;
	min-width: 0;
	box-sizing: border-box;
}

/* ---------- 共通 ---------- */
.cm-section-title {
	font-size: 1.4em;
	font-weight: 700;
	margin: 0 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid #c8a96e;
	color: #1a1a1a;
}

/* ---------- キャストグリッド ---------- */
.cm-cast-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 16px;
	margin: 0;
}

/* ---------- キャストカード（② 重複定義を統合） ---------- */
.cm-cast-card {
	position: relative;
	max-width: 420px;
	margin: 0 auto;
	background: #fff;
	border-radius: 24px;
	overflow: hidden;
	box-shadow: 0 10px 30px rgba(0,0,0,.08);
	transition: transform .25s, box-shadow .25s;
	width: 100%;
}
.cm-cast-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 18px 40px rgba(0,0,0,.16);
}
.cm-cast-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

/* ---------- キャスト写真（② 重複定義を統合） ---------- */
.cm-cast-photo {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;
	overflow: hidden;
	background: #f5f5f5;
}
.cm-cast-photo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform .3s;
}
.cm-cast-card:hover .cm-cast-photo img {
	transform: scale(1.04);
}
.cm-no-photo {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ccc;
	font-size: 48px;
}

/* ---------- キャスト情報 ---------- */
.cm-cast-info {
	padding: 10px 12px 12px;
}
.cm-cast-name {
	font-size: 15px;
	font-weight: 800;
	margin: 0 0 4px;
	line-height: 1.3;
	color: #111;
}
.cm-cast-age,
.cm-cast-spec,
.cm-cast-size,
.cm-cast-type {
	font-size: 12px;
	line-height: 1.5;
	color: #666;
	margin: 0 0 4px;
}

/* ---------- シフトステータス ---------- */
.cm-working-badge {
	display: inline-flex;
	align-items: center;
	background: #00a7c4;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 6px 12px;
	border-radius: 999px;
	margin: 10px 0 6px;
	box-shadow: 0 0 16px rgba(0, 150, 183,.45);
}

.cm-cast-status {
	display: block;
	width: fit-content;
	margin: 6px auto 4px;
	min-width: 120px;
	background: #e0f7fa;
	color: #00a7c4;
	border: 1px solid rgba(0, 167, 196,.2);
	font-size: 12px;
	font-weight: 700;
	text-align: center;
	padding: 6px 14px;
	border-radius: 999px;
}
.cm-cast-shift {
	display: block;
	width: 100%;
	background: #00a7c4;
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	text-align: center;
	padding: 8px 14px;
	border-radius: 999px;
	margin: 4px 0 0;
}

/* 登録順インデックスでカラーローテーション（ステータス・グレード共通） */
.cm-cast-status[data-color-index],
.cm-grade-badge[data-color-index] { color: #fff; }

.cm-cast-status[data-color-index="0"] { background: #00a7c4; border-color: #00a7c4; }
.cm-cast-status[data-color-index="1"] { background: #ffb400; border-color: #ffb400; }
.cm-cast-status[data-color-index="2"] { background: #7b5ea7; border-color: #7b5ea7; }
.cm-cast-status[data-color-index="3"] { background: #2e86c1; border-color: #2e86c1; }
.cm-cast-status[data-color-index="4"] { background: #1e8449; border-color: #1e8449; }
.cm-cast-status[data-color-index="5"] { background: #cb4335; border-color: #cb4335; }
.cm-cast-status[data-color-index="6"] { background: #717d7e; border-color: #717d7e; }
.cm-cast-status[data-color-index="7"] { background: #d35400; border-color: #d35400; }
.cm-cast-status[data-color-index="8"] { background: #1a5276; border-color: #1a5276; }
.cm-cast-status[data-color-index="9"] { background: #6d4c41; border-color: #6d4c41; }

.cm-grade-badge[data-color-index="0"] { background: rgba(200,169,110,.9); }
.cm-grade-badge[data-color-index="1"] { background: rgba(155, 89,182,.9); }
.cm-grade-badge[data-color-index="2"] { background: rgba( 46,134,193,.9); }
.cm-grade-badge[data-color-index="3"] { background: rgba( 30,132, 73,.9); }
.cm-grade-badge[data-color-index="4"] { background: rgba(203, 67, 53,.9); }
.cm-grade-badge[data-color-index="5"] { background: rgba(211,84,  0,.9); }
.cm-grade-badge[data-color-index="6"] { background: rgba(113,125,126,.9); }
.cm-grade-badge[data-color-index="7"] { background: rgba( 26, 82,118,.9); }
.cm-grade-badge[data-color-index="8"] { background: rgba(109, 76, 65,.9); }
.cm-grade-badge[data-color-index="9"] { background: rgba( 52,152,219,.9); }

/* ---------- バッジ ---------- */
.cm-rank-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #c8a96e;
	color: #fff;
	font-size: 11px;
	font-weight: 900;
	line-height: 1;
	flex-shrink: 0;
}
.cm-rank-1 .cm-rank-badge { background: linear-gradient(135deg, #ffd700, #ff9800); }
.cm-rank-2 .cm-rank-badge { background: linear-gradient(135deg, #c0c0c0, #909090); }
.cm-rank-3 .cm-rank-badge { background: linear-gradient(135deg, #cd7f32, #8b4513); }

/* ランキングカード：順位バッジと名前を横並び */
.cm-ranking-card .cm-cast-info {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}
.cm-ranking-card .cm-cast-name {
	margin-bottom: 0;
	flex: 1;
	min-width: 0;
}
.cm-ranking-card .cm-cast-spec,
.cm-ranking-card .cm-cast-size,
.cm-ranking-card .cm-cast-type,
.cm-ranking-card .cm-cast-shift {
	width: 100%;
}

/* ランキングカードの中間div（cm-rank-N）をグリッド高さ揃えの対象にする */
.cm-cast-grid > [class^="cm-rank-"] {
	display: contents;
}

.cm-new-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: #e74c3c;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	z-index: 1;
	letter-spacing: 1px;
}
.cm-grade-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	background: rgba(200,169,110,.9);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	z-index: 1;
}
.cm-type-tag {
	display: inline-block;
	background: #e0f7fa;
	color: #00a7c4;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 999px;
	border: 1px solid rgba(0, 167, 196, 0.2);
	margin: 1px 2px;
}

/* ---------- スケジュール ---------- */
.cm-schedule {
	margin: 20px 0;
}
.cm-rest-day,
.cm-no-schedule {
	padding: 20px;
	text-align: center;
	background: #f9f9f9;
	border-radius: 8px;
	color: #666;
}
.cm-rest-notice {
	font-size: 18px;
	color: #c8600a;
	font-weight: 700;
}

/* ---------- ランキング ---------- */
.cm-ranking {
	margin: 1px 0;
}
.cm-ranking-title {
	display: flex;
	align-items: center;
	gap: 8px;
}
.cm-ranking-title::before {
	content: '🏆';
	font-size: 1.2em;
}

/* ---------- 個別プロフィール ---------- */
.cm-cast-profile {
	display: flex;
	gap: 24px;
	align-items: flex-start;
	margin: 20px 0;
	flex-wrap: wrap;
}
.page-cast-area .cm-cast-profile {
	margin-top: 1px;
}
.cm-profile-gallery {
	flex: 0 0 320px;
	max-width: 320px;
}
.cm-gallery-main {
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 10px;
}
.cm-gallery-main img {
	width: 100%;
	height: auto;
	display: block;
	aspect-ratio: 3 / 4;
	object-fit: cover;
	cursor: grab;
}
.cm-gallery-main img:active {
	cursor: grabbing;
}
.cm-gallery-thumbs {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}
.cm-thumb-img {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 4px;
	cursor: pointer;
	opacity: .75;
	transition: opacity .2s;
	border: 2px solid transparent;
}
.cm-thumb-img:hover,
.cm-thumb-img.active {
	opacity: 1;
	border-color: #c8a96e;
}
.cm-profile-info {
	flex: 1;
	min-width: 0;
}
.cm-profile-badges {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	margin-bottom: 8px;
}
.cm-profile-badges .cm-new-badge,
.cm-profile-badges .cm-grade-badge {
	position: static;
	font-size: 12px;
}
.cm-profile-name {
	font-size: 2em;
	font-weight: 900;
	margin: 0 0 8px;
	color: #1a1a1a;
}
.cm-profile-types {
	margin-bottom: 16px;
}
.cm-profile-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 16px;
}
.cm-profile-table th {
	width: 100px;
	padding: 8px 12px;
	background: #f9f5ee;
	color: #8a6428;
	font-size: 13px;
	font-weight: 600;
	text-align: left;
	border-bottom: 1px solid #eddfc0;
}
.cm-profile-table td {
	padding: 8px 12px;
	font-size: 15px;
	border-bottom: 1px solid #f0eee8;
}
.cm-profile-pr {
	background: #faf7f0;
	border: 1px solid #eddfc0;
	border-radius: 6px;
	padding: 16px;
	margin-top: 12px;
}
.cm-profile-post-content {
	margin-top: 32px;
}
.cm-profile-pr h3 {
	margin: 0 0 8px;
	font-size: 14px;
	color: #8a6428;
}
.cm-profile-pr p {
	margin: 0;
	font-size: 14px;
	line-height: 1.8;
	color: #444;
}
.cm-error {
	color: #d63638;
	font-size: 13px;
}

/* ---------- もっと見るボタン ---------- */
.cm-load-more-wrap {
	text-align: center;
	margin-top: 24px;
}
.cm-load-more-btn {
	display: inline-block;
	padding: 12px 32px;
	background: #c8a96e;
	color: #fff;
	border: none;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: background .2s, transform .2s;
}
.cm-load-more-btn:hover {
	background: #b8934a;
	transform: translateY(-2px);
}
.cm-load-more-btn:disabled {
	background: #ccc;
	cursor: not-allowed;
	transform: none;
}

/* ---------- レスポンシブ ---------- */
@media screen and (min-width: 768px) and (max-width: 1023px) {
	.cm-cast-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media screen and (max-width: 767px) {
	.cm-cast-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
	.cm-cast-profile {
		flex-direction: column;
	}
	.cm-profile-gallery {
		flex: none;
		max-width: 100%;
		width: 100%;
	}
	.cm-gallery-main img {
		aspect-ratio: 3 / 4;
	}
	.cm-profile-info,
	.cm-profile-table,
	.cm-profile-pr,
	.cm-cast-week {
		width: 100%;
		min-width: 0;
		box-sizing: border-box;
	}
	.cm-cast-week-list {
		width: 100%;
	}
}

@media screen and (max-width: 480px) {
	.cm-cast-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 8px;
	}
	.cm-cast-name {
		font-size: 13px;
	}
	.cm-profile-name {
		font-size: 1.5em;
	}
}

/* ================================================
   週間スケジュール
   ================================================ */
.cm-schedule-week {
	margin: 1px 0;
}
.cm-week-tabs {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	gap: 6px;
	margin-bottom: 16px;
	padding-bottom: 4px;
	scrollbar-width: none;
}
.cm-week-tabs::-webkit-scrollbar {
	display: none;
}
.cm-week-tab {
	flex: 1 1 0;
	padding: 8px 4px;
	background: #f9f9f9;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	cursor: pointer;
	font-size: 12px;
	text-align: center;
	color: #333;
	transition: background .2s, border-color .2s;
}
.cm-week-tab.cm-tab-active {
	background: #c8a96e;
	color: #fff;
	border-color: #c8a96e;
}
.cm-week-tab .cm-tab-date {
	display: block;
	font-weight: 700;
	font-size: 14px;
}
.cm-week-tab .cm-tab-dow {
	display: block;
	font-size: 11px;
}
.cm-tab-today {
	display: block;
	font-size: 10px;
	background: #e74c3c;
	color: #fff;
	border-radius: 3px;
	padding: 1px 4px;
	margin-top: 2px;
}
@media (max-width: 767px) {
	.cm-week-tab {
		flex: 0 0 70px;
	}
}
.cm-tab-badge {
	display: inline-block;
	background: #2271b1;
	color: #fff;
	font-size: 10px;
	padding: 1px 6px;
	border-radius: 20px;
	margin-top: 2px;
}
.cm-tab-rest {
	background: #c0392b;
}
.cm-tab-sun { color: #d63638; }
.cm-tab-sat { color: #2271b1; }
.cm-week-panel {
	display: none;
}
.cm-week-panel.cm-panel-active {
	display: block;
}
.cm-week-rest,
.cm-week-empty {
	padding: 20px;
	text-align: center;
	color: #999;
	background: #f9f9f9;
	border-radius: 8px;
}

/* キャスト個別：週間スケジュール */
.cm-cast-week {
	margin-top: 24px;
}
.cm-cast-week-title {
	font-size: 1.1em;
	font-weight: 700;
	margin: 0 0 12px;
	padding-bottom: 6px;
	border-bottom: 1px solid #e8e0d0;
}
.cm-cast-week-list {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.cm-cw-day {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border-radius: 6px;
	background: #f9f9f9;
	font-size: 13px;
}
.cm-cw-today {
	background: #fdf6e8;
	border: 1px solid #c8a96e;
}
.cm-cw-work { color: #1a5c2a; }
.cm-cw-rest { color: #888; font-style: italic; }
.cm-cw-off  { color: #aaa; }
.cm-cw-date { font-weight: 700; min-width: 36px; }
.cm-cw-dow  { min-width: 20px; color: #888; }
.cm-cw-sun .cm-cw-date,
.cm-cw-sun .cm-cw-dow { color: #d63638; }
.cm-cw-sat .cm-cw-date,
.cm-cw-sat .cm-cw-dow { color: #2271b1; }
.cm-cw-today-badge {
	background: #c8a96e;
	color: #fff;
	font-size: 10px;
	padding: 1px 6px;
	border-radius: 20px;
}
.cm-cw-status { margin-left: auto; }

/* テンプレート共通ナビ */
.cm-site-header {
	background: #fff;
	border-bottom: 1px solid #e8e8e8;
	padding: 0 20px;
}
.cm-site-header__inner {
	max-width: 1200px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 60px;
}
.cm-site-logo {
	font-weight: 700;
	font-size: 18px;
	text-decoration: none;
	color: #1a1a1a;
}
.cm-nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 20px;
}
.cm-breadcrumb {
	padding: 10px 20px;
	font-size: 12px;
	color: #888;
}
.cm-breadcrumb__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}
.cm-breadcrumb__item::after {
	content: '›';
	margin-left: 6px;
}
.cm-breadcrumb__item:last-child::after {
	content: none;
}
.cm-main {
	padding: 20px;
}
.cm-container {
	max-width: 1200px;
	margin: 0 auto;
	padding-top: 32px;
	padding-bottom: 60px;
	padding-inline: 5px;
}
@media (max-width: 767px) {
	.cm-container {
		padding-bottom: 10px;
	}
	.cm-schedule {
		margin-bottom: 0;
	}
}
.cm-page-title {
	font-size: 1.8em;
	font-weight: 900;
	margin: 0 0 20px;
	color: #1a1a1a;
}
.cm-site-footer {
	border-top: 1px solid #e8e8e8;
	padding: 20px;
	text-align: center;
	font-size: 13px;
	color: #888;
	margin-top: 40px;
}
.cm-back-link {
	margin-top: 24px;
	text-align: center;
}
.cm-btn {
	display: inline-block;
	padding: 10px 24px;
	background: #c8a96e;
	color: #fff;
	border-radius: 999px;
	text-decoration: none;
	font-weight: 700;
	font-size: 14px;
	border: none;
	cursor: pointer;
}
.cm-btn--secondary {
	background: #f0ece3;
	color: #8a6428;
}

/* アーカイブ */
.cm-archive-today-banner {
	display: flex;
	align-items: center;
	gap: 12px;
	background: #e0f7fa;
	border: 1px solid rgba(0, 167, 196,.3);
	border-radius: 8px;
	padding: 12px 16px;
	margin-bottom: 20px;
	flex-wrap: wrap;
}
.cm-archive-today-badge {
	background: #00a7c4;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	padding: 2px 10px;
	border-radius: 999px;
}
.cm-archive-today-count {
	font-weight: 700;
	color: #00a7c4;
}
.cm-archive-today-link {
	margin-left: auto;
	font-size: 13px;
	color: #00a7c4;
	text-decoration: none;
}
.cm-grade-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 16px;
}
.cm-grade-tab {
	padding: 6px 16px;
	border: 1px solid #ddd;
	border-radius: 999px;
	font-size: 13px;
	text-decoration: none;
	color: #555;
	transition: background .2s, color .2s;
}
.cm-grade-tab--active,
.cm-grade-tab:hover {
	background: #c8a96e;
	color: #fff;
	border-color: #c8a96e;
}
.cm-grade-tab-count {
	font-size: 11px;
	opacity: .8;
	margin-left: 4px;
}
.cm-type-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-bottom: 20px;
}
.cm-type-filter-label {
	font-size: 13px;
	color: #888;
}
.cm-type-tag--active {
	background: #c8a96e;
	color: #fff;
}
.cm-archive-section {
	margin-bottom: 32px;
}

/* 詳細フィルタ（折りたたみ） */
.cm-detail-filter {
	margin-bottom: 16px;
	border: 1px solid #e8e0d0;
	border-radius: 8px;
	overflow: hidden;
}
.cm-detail-filter__toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 16px;
	background: #faf7f0;
	border: none;
	cursor: pointer;
	font-size: 13px;
	font-weight: 700;
	color: #8a6428;
	text-align: left;
}
.cm-detail-filter__toggle:hover {
	background: #f5f0e6;
}
.cm-detail-filter__icon {
	width: 10px;
	height: 10px;
	border-right: 2px solid #c8a96e;
	border-bottom: 2px solid #c8a96e;
	transform: rotate(45deg);
	transition: transform .2s;
	flex-shrink: 0;
}
.cm-detail-filter--open .cm-detail-filter__icon {
	transform: rotate(-135deg);
}
.cm-detail-filter__body {
	padding: 12px 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.cm-detail-filter__row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	flex-wrap: wrap;
}
.cm-detail-filter__name {
	font-size: 12px;
	font-weight: 700;
	color: #888;
	padding-top: 4px;
	min-width: 40px;
	flex-shrink: 0;
}
.cm-detail-filter__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

/* ランキングアーカイブ */
.cm-ranking-archive-item {
	margin-bottom: 48px;
	padding-bottom: 48px;
	border-bottom: 1px solid #e8e0d0;
}
.cm-ranking-archive-item:last-child {
	border-bottom: none;
}
.cm-ranking-archive-title {
	font-size: 1.4em;
	font-weight: 800;
	margin: 0 0 16px;
}
.cm-ranking-archive-title a {
	color: #1a1a1a;
	text-decoration: none;
}
.cm-ranking-archive-title a:hover {
	color: #c8a96e;
}
.cm-ranking-archive-link {
	margin-top: 16px;
	text-align: right;
}

/* タクソノミーページ */
.cm-tax-header {
	margin-bottom: 24px;
}
.cm-tax-label {
	display: inline-block;
	background: #c8a96e;
	color: #fff;
	font-size: 12px;
	padding: 2px 10px;
	border-radius: 3px;
	margin-right: 8px;
}
.cm-tax-count {
	font-size: 14px;
	color: #888;
	margin: 4px 0;
}
.cm-tax-description {
	font-size: 14px;
	color: #555;
	margin-top: 8px;
}
