<template>
	<div id="home-page">
		<IntegratedLayout>
			<div class="top-title">
				<div class="first-text gradient-color">
					AIToolsFinder
				</div>
				<div class="second-text">
					Get global AI tools in one stop
				</div>
				<div class="third-text">
					It includes over a <a href="/" class="special">thousand global AI tools</a>, covering writing, images,
					videos, audio, programming,
					music, design, chatting, etc., and recommends learning platforms, frameworks and models
				</div>
				<!-- 修改输入框容器 -->
				<div style="margin: 68px auto 62px">
					<SearchSelectInput />
				</div>
			</div>

			<div class="card flex">
				<div class="left-card card-box">
					<el-carousel :autoplay="false" height="354px" autoplay :interval="8000">
						<el-carousel-item v-for="(item, i) in banner" :key="i">
							<img :src="item.imageUrl || ''" alt="" style="height: 354px; width: 100%; border-radius: 12px" />
						</el-carousel-item>
					</el-carousel>
				</div>
				<div class="right-card card-box">
					<PopularToolList />
				</div>
			</div>
			<NuxtChild />
		</IntegratedLayout>
	</div>
</template>

<script>
import PopularToolList from "@/pages/Home/components/PopularToolList.vue";
import GlobalLoading from "@/components/GlobalLoading.vue";

export default {
	name: 'Home',
	components: {
		PopularToolList,
		GlobalLoading,
	},
	computed: {
		banner() {
			const bannerConfig = this.$store.getters.bannerConfig;
			if (bannerConfig.home && bannerConfig.home.length > 0) {
				return bannerConfig.home;
			}
			return [];
		}
	},
	data() {
		return {}
	},
	methods: {
	},
	mounted() {
		this.$store.dispatch('getBannerConfig');
	}
}
</script>

<style lang="scss" scoped>	#home-page {
	flex: 1;
	overflow-y: auto; // 必须启用滚动
	position: relative; // 添加相对定位
	background-repeat: no-repeat;
	background-size: contain; // 控制图片自适应
	background-position: top center;
	background-image: url('/logo/mask.png');
}

.top-title {
	@include flex-center;
	flex-direction: column;
	font-weight: bold;
	margin-top: 120px;

	div {
		text-align: center;
	}

	.first-text {
		line-height: 90px;
		font-size: $huge-font-size3;
		font-weight: 900;
		font-family: 'Poppins-Bold', serif;
	}

	.second-text {
		margin: 18px 0;
		font-family: 'Poppins-Bold', serif;
		font-size: $huge-font-size2;
		font-weight: 900;
		line-height: 75px;
	}

	.third-text {
		width: 716px;
		font-weight: 500;
		color: $grey-color;
		font-size: $normal-font-size;
		margin-top: 8px;
		font-family: 'Poppins-Medium', serif;

		.special {
			color: $main-color;
		}
	}
}

.card {
	display: grid;
	grid-template-columns: 2fr 1fr; // 4列布局
	gap: 11px; // 网格间距
	margin: 0 auto;

	.card-box {
		background: $white;
		box-shadow: 0 18px 33px 0 rgba(0, 0, 0, 0.05);
		border-radius: 12px;
		border: 1px solid #FFFFFF;
	}

	.left-card {
		// min-width: 805px;
		overflow: hidden;
		box-sizing: border-box;
		::v-deep .el-carousel {
			.el-carousel__arrow {
				opacity: 0 !important;
				transition: none !important;
			}
			.el-carousel__indicators {
				.el-carousel__indicator {
					height: 4px !important;
					width: 12px !important;
					border-radius: 2.66px !important;
					border: 0.66px solid #2563eb !important;
					background: transparent !important;
					margin: 0 3px 0 3px !important;
					padding: 0 !important;

					.el-carousel__button {
						background-color: transparent;
					}

					&.is-active {
						border: none !important;
						width: 20px !important;
						background: linear-gradient(0deg, #2563EB 22%, #7B61FF 73%) !important;
					}

					// 重置其他可能的默认样式
					&:before,
					&:after {
						display: none !important;
					}
				}
			}
		}
	}

	.right-card {
		padding: 20px;
		max-width: 372px;
	}
}
</style>
