﻿/* ================================================
   Banner轮播图样式优化
   ================================================ */

/* 轮播图主容器 */
.hwslider {
	width: 100%;
	height: 0;
	padding-top: 51.04%; /* 980/1920*100% = 51.04%，保持宽高比 */
	position: relative;
	overflow: hidden;
	margin-bottom: -10px;
	background-color: #f8f9fa; /* 添加背景色，防止图片加载时空白 */
}

/* 轮播图列表容器 */
.hwslider ul {
	width: 100%;
	height: 100%;
	position: absolute;
	z-index: 1;
	top: 0;
	left: 0;
}

/* 轮播图项 */
.hwslider ul li {
	display: none;
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	text-align: center;
}

.hwslider ul li.active {
	display: block;
}

/* 轮播图图片 */
.hwslider ul li img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover; /* 保持图片比例，裁剪多余部分 */
	object-position: center; /* 图片居中显示 */
}

/* 指示点样式 */
.dots {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX(-50%);
	min-width: 60px;
	height: 12px;
	z-index: 2;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 8px;
}

.dots span {
	width: 12px;
	height: 12px;
	border: 1px solid #fff;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	transition: all 0.3s ease;
}

.dots span.active {
	background: #fff;
	transform: scale(1.2);
}

/* 导航箭头 */
.arr {
	display: none;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 50px;
	height: 50px;
	line-height: 50px;
	text-align: center;
	font-size: 28px;
	background: rgba(0, 0, 0, 0.4);
	color: #fff;
	text-decoration: none;
	border-radius: 50%;
	transition: all 0.3s ease;
	cursor: pointer;
}

.arr:hover {
	background: rgba(0, 0, 0, 0.7);
	text-decoration: none;
	color: #fff;
	transform: translateY(-50%) scale(1.1);
}

.hwslider:hover .arr {
	display: block;
}

.prev {
	left: 20px;
}

.next {
	right: 20px;
}

/* 为箭头添加图标 */
.prev::before {
	content: '‹';
}

.next::before {
	content: '›';
}

/* 响应式调整 */
@media (max-width: 1919px) {
	/* 在1920px以下屏幕，保持51.04%的宽高比 */
	.hwslider {
		padding-top: 51.04%;
	}

	/* 调整箭头大小 */
	.arr {
		width: 40px;
		height: 40px;
		line-height: 40px;
		font-size: 24px;
	}

	.prev {
		left: 15px;
	}

	.next {
		right: 15px;
	}
}

@media (max-width: 1200px) {
	.arr {
		width: 35px;
		height: 35px;
		line-height: 35px;
		font-size: 20px;
	}

	.prev {
		left: 10px;
	}

	.next {
		right: 10px;
	}
}

@media (max-width: 768px) {
	.hwslider {
		padding-top: 60%; /* 在移动端调整宽高比 */
	}

	.arr {
		width: 30px;
		height: 30px;
		line-height: 30px;
		font-size: 18px;
		display: block; /* 移动端始终显示箭头 */
	}

	.prev {
		left: 5px;
	}

	.next {
		right: 5px;
	}

	.dots {
		bottom: 15px;
	}

	.dots span {
		width: 10px;
		height: 10px;
	}
}

@media (max-width: 480px) {
	.hwslider {
		padding-top: 70%; /* 在小屏移动端进一步调整宽高比 */
	}

	.arr {
		width: 25px;
		height: 25px;
		line-height: 25px;
		font-size: 16px;
	}

	.dots {
		bottom: 10px;
	}

	.dots span {
		width: 8px;
		height: 8px;
	}
}

/* 确保在1920px宽度下正好显示1920×980 */
@media (min-width: 1920px) {
	.hwslider {
		max-height: 980px; /* 设置最大高度，防止在大屏幕上过高 */
	}
}

/* 为不支持object-fit的浏览器提供备用方案 */
@supports not (object-fit: cover) {
	.hwslider ul li img {
		/* 如果不支持object-fit，使用背景图片方式 */
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: auto;
		height: auto;
		min-width: 100%;
		min-height: 100%;
	}
}

/* 为图片添加加载过渡效果 */
.hwslider ul li img {
	transition: opacity 0.3s ease;
}

.hwslider ul li:not(.active) img {
	opacity: 0;
}

.hwslider ul li.active img {
	opacity: 1;
}

/* 添加轮播图计数器样式（可选） */
.slide-counter {
	position: absolute;
	bottom: 20px;
	right: 20px;
	background: rgba(0, 0, 0, 0.6);
	color: white;
	padding: 5px 10px;
	border-radius: 20px;
	font-size: 14px;
	z-index: 2;
}

@media (max-width: 768px) {
	.slide-counter {
		bottom: 15px;
		right: 15px;
		font-size: 12px;
		padding: 3px 8px;
	}
}