<template>
	<div class="info-card">
		<div class="color-bar" :style="{ backgroundColor: color }"></div>
		<div class="card-content">
			<div class="title-section">
				<div class="main-title">{{ title }}</div>
				<div class="sub-title">{{ subtitle }}</div>
			</div>
			<div class="description">{{ description }}</div>
			<div v-if="quantity > 0" class="quantity" :style="{ color: color }">{{ quantity }}个</div>
		</div>
	</div>
</template>

<script setup>
defineProps({
	title: {
		type: String,
		default: "标题"
	},
	subtitle: {
		type: String,
		default: "Subtitle"
	},
	description: {
		type: String,
		default: "描述信息"
	},
	quantity: {
		type: [Number, String],
		default: 0
	},
	color: {
		type: String,
		default: "#409EFF"
	}
});
</script>

<style scoped lang="scss">
.info-card {
	max-width: 388px;
	min-width: 200px;
	height: 150px;
	border-radius: 12px;
	background-color: white;
	display: flex;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	position: relative;
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
	transform: translateY(-3px);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.color-bar {
	width: 6px;
	height: 120px;
	flex-shrink: 0;
	margin-top: 15px;
}

.card-content {
	flex: 1;
	padding: 20px;
	display: flex;
	flex-direction: column;
	position: relative;
}

.title-section {
	margin-bottom: 12px;
}

.main-title {
	font-family: $base-font-family;
	font-size: 24px;
	font-weight: 700;
	color: #1f2937;
	line-height: 1.2;
	max-width: 70%;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.sub-title {
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	color: #6b7280;
	margin-top: 2px;
}

.description {
	font-size: 16px;
	font-weight: 400;
	color: rgba(95, 101, 108, 1);
	line-height: 1.4;
	flex: 1;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.quantity {
	position: absolute;
	top: 20px;
	right: 20px;
	font-size: 32px;
	font-weight: 700;
}
</style>
