/* ==========================================================================
   UPop 影视文章样式 - 前端样式
   兼容 B2 主题：不引入额外卡片背景，严格与文章标题左右边界对齐
   ========================================================================== */

/* 使用 .entry-content .upop-movie 提升特异性，保证能覆盖主题 .box 等通用卡片样式 */
.entry-content .upop-movie,
.single-article .upop-movie {
	/* 与 .entry-content 子元素一致的垂直节奏 */
	margin: 0 0 1.7em !important;
	/* 左右无 padding，确保左边与 <h1> 标题对齐；上下无 padding，避免额外间距 */
	padding: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

.upop-movie-header {
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: flex-start;
}

/* 左侧封面 - 精准对齐文章标题左边界 */
.entry-content .upop-movie-poster,
.single-article .upop-movie-poster {
	flex: 0 0 180px;
	max-width: 180px;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

.upop-movie-poster img,
.upop-movie-poster-placeholder {
	width: 100%;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	display: block;
	border-radius: 4px;
	background: #f5f5f5;
}

/* 真实海报图才加投影，占位块保持扁平无模糊感 */
.upop-movie-poster img {
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.upop-movie-poster-placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
	font-size: 14px;
	box-shadow: none;
	border: 1px solid var(--b2-border-color, #ececec);
}

/* 评分模块 - 进度条风格（现代化），与剧情简介同级 */
.upop-movie-rating {
	margin-top: 20px;
	padding: 16px;
	background: #fafafa;
	border: 1px solid #e8e8e8;
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.upop-movie-rating-header {
	display: flex;
	align-items: baseline;
	gap: 8px;
	margin-bottom: 12px;
}

.upop-movie-rating-number {
	font-size: 32px;
	font-weight: 700;
	color: #ff6b35;
	line-height: 1;
	letter-spacing: -0.5px;
}

.upop-movie-rating-max {
	font-size: 14px;
	color: #999;
	font-weight: 400;
}

.upop-movie-rating-stars {
	display: flex;
	gap: 2px;
}

.upop-movie-rating-stars .star {
	font-size: 16px;
	color: #ddd;
	line-height: 1;
	transition: color 0.2s ease;
}

.upop-movie-rating-stars .star.filled {
	color: #ffb400;
}

/* 进度条 */
.upop-movie-rating-bar {
	height: 6px;
	background: #e8e8e8;
	border-radius: 3px;
	overflow: hidden;
	margin-bottom: 12px;
}

.upop-movie-rating-progress {
	height: 100%;
	background: linear-gradient(90deg, #ff6b35 0%, #ffb400 100%);
	border-radius: 3px;
	transition: width 0.3s ease;
}

/* 元信息行（进度条下方） */
.upop-movie-rating-meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.upop-movie-rating-meta .upop-meta-rating-count {
	margin-right: auto;
}

.upop-meta-item {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-size: 13px;
	color: #666;
	white-space: nowrap;
}

.upop-meta-item svg {
	width: 14px;
	height: 14px;
}

.upop-meta-rating-count {
	font-weight: 500;
}

.upop-meta-cats a {
	color: var(--b2-color-2, #1e88e5);
	text-decoration: none;
}

.upop-meta-cats a:hover {
	text-decoration: underline;
}

.upop-meta-edit {
	color: var(--b2-color-2, #1e88e5);
	text-decoration: none;
}

.upop-meta-edit:hover {
	text-decoration: underline;
}

/* 隐藏影视模板原始的 #post-meta */
.upop-movie-single #post-meta {
	display: none !important;
}

/* 右侧信息 */
.upop-movie-meta {
	flex: 1;
	min-width: 0;
	/* 抵消 line-height 1.5 带来的半行 leading，让“导演:”字形顶边与封面顶边对齐 */
	margin-top: -0.25em;
}

.upop-movie-title {
	font-size: 22px;
	line-height: 1.3;
	margin: 0 0 12px;
	color: var(--b2-main-text-color, #333);
}

.upop-movie-info-table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	font-size: 14px;
	line-height: 1.5;
	margin: 0 !important;
	padding: 0 !important;
	background: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
}

/* 关键：表格改为块级布局 + flex，打破 <table> 列宽对齐约束，
   让每行的字段名按自身内容宽度独立排列 */
.upop-movie-info-table,
.upop-movie-info-table tbody,
.upop-movie-info-table tr,
.upop-movie-info-table th,
.upop-movie-info-table td {
	display: block;
}

.upop-movie-info-table tr {
	display: flex !important;
	align-items: baseline;
	flex-wrap: nowrap;
	width: 100%;
	margin: 0;
}

/* 第一行顶部内边距清零，确保“导演:”紧贴容器顶部 */
.upop-movie-info-table tr:first-child th,
.upop-movie-info-table tr:first-child td {
	padding-top: 0 !important;
}

/* 彻底清除任何来自主题/WP 核心的 tr/td/th 背景色与分割线（斡马纹 / 边框）*/
.entry-content .upop-movie-info-table,
.entry-content .upop-movie-info-table tbody,
.entry-content .upop-movie-info-table thead,
.entry-content .upop-movie-info-table tfoot,
.entry-content .upop-movie-info-table tr,
.entry-content .upop-movie-info-table tr:nth-child(odd),
.entry-content .upop-movie-info-table tr:nth-child(even),
.entry-content .upop-movie-info-table th,
.entry-content .upop-movie-info-table td {
	background: transparent !important;
	background-color: transparent !important;
	border: 0 !important;
	border-bottom: 0 !important;
	border-top: 0 !important;
	box-shadow: none !important;
}

.upop-movie-info-table th,
.upop-movie-info-table td {
	/* 紧凑行高：14px 字 × 1.5 行高 + 2px×2 内边距 ≈ 25px */
	padding: 2px 0 !important;
	text-align: left;
	vertical-align: middle;
	line-height: 1.5 !important;
}

.upop-movie-info-table th {
	/* 字段名：按内容自适应宽度，不被其它行拉齐。
	   配合 tr{display:flex}，每行独立排版。 */
	flex: 0 0 auto !important;
	width: auto !important;
	white-space: nowrap;
	padding-right: 6px !important;
	color: var(--b2-light-text-color, #888);
	font-weight: 500;
}

.upop-movie-info-table td {
	flex: 1 1 auto !important;
	width: auto !important;
	color: var(--b2-main-text-color, #333);
	word-break: break-word;
}

.upop-movie-info-table a {
	color: var(--b2-color-2, #1e88e5);
	text-decoration: none;
}

.upop-movie-info-table a:hover {
	text-decoration: underline;
}

/* 剧情简介 */
.upop-movie-plot {
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px dashed var(--b2-border-color, #e5e5e5);
}

.upop-movie-plot-title {
	font-size: 16px;
	margin: 0 0 10px;
	color: var(--b2-main-text-color, #333);
	font-weight: 600;
}

.upop-movie-plot-content {
	font-size: 14px;
	line-height: 1.8;
	color: var(--b2-main-text-color, #444);
}

.upop-movie-plot-content p {
	margin: 0 0 10px;
}

.upop-movie-plot-content p:last-child {
	margin-bottom: 0;
}

/* 响应式：平板 */
@media (max-width: 768px) {
	.upop-movie {
		padding: 0;
	}
	.upop-movie-header {
		gap: 16px;
	}
	.upop-movie-poster {
		flex: 0 0 140px;
		max-width: 140px;
	}
	.upop-movie-title {
		font-size: 18px;
	}
	.upop-movie-info-table th {
		flex: 0 0 auto !important;
		width: auto !important;
		padding-right: 6px !important;
	}
}

/* 响应式：手机 */
@media (max-width: 520px) {
	.upop-movie-header {
		flex-direction: column;
		align-items: center;
		text-align: center;
	}
	.upop-movie-poster {
		flex: 0 0 auto;
		max-width: 150px;
		width: 150px;
	}
	.upop-movie-meta {
		width: 100%;
		text-align: left;
	}
	.upop-movie-title {
		text-align: center;
	}
	.upop-movie-info-table th {
		flex: 0 0 auto !important;
		width: auto !important;
		padding-right: 6px !important;
		font-size: 13px;
	}
	.upop-movie-info-table td {
		font-size: 13px;
	}
}

/* ==========================================================================
   演员表模块
   ========================================================================== */

.upop-movie-cast {
	margin-top: 2em;
	padding-top: 1.5em;
	border-top: 1px solid #eee;
}

.upop-movie-cast-title {
	font-size: 16px;
	font-weight: 600;
	margin: 0 0 10px;
	color: var(--b2-main-text-color, #333);
}

.upop-movie-cast-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 16px;
}

.upop-movie-cast-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	background: #fafafa;
	border-radius: 6px;
	transition: background 0.2s ease;
}

.upop-movie-cast-item:hover {
	background: #f0f0f0;
}

.upop-movie-cast-avatar {
	flex: 0 0 50px;
	width: 50px;
	height: 50px;
}

.upop-movie-cast-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.upop-movie-cast-avatar-placeholder {
	width: 100%;
	height: 100%;
	border-radius: 50%;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 1.4em;
	font-weight: 600;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.upop-movie-cast-info {
	flex: 1;
	min-width: 0;
}

.upop-movie-cast-name {
	font-weight: 600;
	font-size: 0.95em;
	color: #333;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.upop-movie-cast-role {
	font-size: 0.85em;
	color: #666;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* 移动端适配 */
@media (max-width: 768px) {
	.upop-movie-cast-grid {
		grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
		gap: 12px;
	}
	.upop-movie-cast-item {
		padding: 8px;
		gap: 10px;
	}
	.upop-movie-cast-avatar {
		flex: 0 0 40px;
		width: 40px;
		height: 40px;
	}
	.upop-movie-cast-name {
		font-size: 0.9em;
	}
	.upop-movie-cast-role {
		font-size: 0.8em;
	}
	.upop-movie-rating-number {
		font-size: 28px;
	}
	.upop-movie-rating-stars .star {
		font-size: 14px;
	}
	.upop-movie-rating-meta {
		gap: 8px;
	}
	.upop-meta-item {
		font-size: 12px;
	}
}
