/* 九宫格模板样式 */

/* ========== 基础样式 ========== */
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

html {
	font-size: 14px;
	overflow-x: hidden;
}

body {
	background-color: #f5f5f5;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: #333;
	line-height: 1.5;
}

a {
	color: #333;
	text-decoration: none;
}

a:hover {
	text-decoration: none;
}

img {
	max-width: 100%;
	vertical-align: middle;
}

/* ========== 顶部导航栏 ========== */
.jg-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 44px;
	background: linear-gradient(135deg, #4a90e2 0%, #2d6bb8 100%);
	color: #fff;
	z-index: 1000;
	display: flex;
	align-items: center;
	padding: 0 15px;
}

.jg-header-back,
.jg-header-btn {
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 18px;
}

.jg-header-back:active,
.jg-header-btn:active {
	opacity: 0.7;
}

.jg-header-title {
	flex: 1;
	text-align: center;
	font-size: 16px;
	font-weight: 500;
}

.jg-header-search {
	flex: 1;
	padding: 0 10px;
}

.jg-header-search input {
	width: 100%;
	height: 30px;
	background: rgba(255, 255, 255, 0.2);
	border: none;
	border-radius: 15px;
	padding: 0 15px;
	color: #fff;
	font-size: 13px;
	outline: none;
}

.jg-header-search input::placeholder {
	color: rgba(255, 255, 255, 0.7);
}

/* ========== 主体内容区域 ========== */
.jg-container {
	padding-bottom: 0px;
}

/* ========== 首页九宫格 ========== */
.jg-grid {
	padding: 15px;
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1px;
	background: #fff;
}

.jg-grid-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 20px 10px;
	background: #fff;
	text-decoration: none;
	transition: background 0.2s;
}

.jg-grid-item:active {
	background: #f5f5f5;
}

.jg-grid-icon {
	width: 50px;
	height: 50px;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 24px;
	margin-bottom: 10px;
}

.jg-grid-icon.icon-pink {
	background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.jg-grid-icon.icon-orange {
	background: linear-gradient(135deg, #fbb34d 0%, #fa709a 100%);
}

.jg-grid-icon.icon-green {
	background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
}

.jg-grid-icon.icon-cyan {
	background: linear-gradient(135deg, #22d3ee 0%, #06b6d4 100%);
}

.jg-grid-icon.icon-yellow {
	background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
}

.jg-grid-icon.icon-red {
	background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

.jg-grid-icon.icon-purple {
	background: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 100%);
}

.jg-grid-icon.icon-blue {
	background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
}

.jg-grid-text {
	font-size: 13px;
	color: #333;
	margin-top: 5px;
}

/* ========== 底部标签栏 ========== */
.jg-tabbar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	height: 55px;
	background: #fff;
	border-top: 1px solid #e5e5e5;
	display: flex;
	align-items: center;
	z-index: 1000;
}

.jg-tabbar-item {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: #999;
	font-size: 14px;
	text-decoration: none;
	padding: 5px 0;
}

.jg-tabbar-item i {
	font-size: 22px;
	margin-bottom: 2px;
}

.jg-tabbar-item.active {
	color: #4a90e2;
}

.jg-tabbar-item:active {
	opacity: 0.7;
}

.jg-tabbar-item .badge {
	position: absolute;
	top: 2px;
	right: 50%;
	transform: translateX(15px);
	background: #ef4444;
	color: #fff;
	font-size: 10px;
	padding: 1px 5px;
	border-radius: 10px;
	min-width: 16px;
	text-align: center;
}

/* ========== 列表页筛选 ========== */
.jg-filter {
	background: #fff;
	padding: 12px 15px;
	display: flex;
	align-items: center;
	border-bottom: 1px solid #f0f0f0;
}

.jg-filter-item {
	flex: 1;
	text-align: center;
	font-size: 14px;
	color: #333;
	padding: 5px 0;
}

.jg-filter-item.active {
	color: #4a90e2;
	font-weight: 500;
}

.jg-filter-item i {
	font-size: 12px;
	margin-left: 3px;
}

.jg-filter-item.desc i.ico-up,
.jg-filter-item.asc i.ico-down {
	color: #4a90e2;
}

/* ========== 商品列表 ========== */
.jg-product-list {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1px;
	background: #f5f5f5;
	padding: 1px;
}

.jg-product-item {
	background: #fff;
	padding: 0 0 10px 0;
	text-decoration: none;
	display: block;
}

.jg-product-img {
	width: 100%;
	aspect-ratio: 1;
	background: #f9f9f9;
	overflow: hidden;
}

.jg-product-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.jg-product-info {
	padding: 8px;
}

.jg-product-title {
	font-size: 13px;
	color: #333;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin-bottom: 8px;
}

.jg-product-price {
	display: flex;
	align-items: baseline;
	margin-bottom: 5px;
}

.jg-product-price .price {
	color: #ef4444;
	font-size: 16px;
	font-weight: 600;
}

.jg-product-price .price-symbol {
	font-size: 12px;
}

.jg-product-price .price-original {
	color: #999;
	font-size: 12px;
	text-decoration: line-through;
	margin-left: 5px;
}

.jg-product-sales {
	font-size: 11px;
	color: #999;
}

/* ========== 详情页 ========== */
.jg-detail-swiper {
	width: 100%;
	aspect-ratio: 1;
	background: #f9f9f9;
	position: relative;
}

.jg-detail-swiper .swiper {
	width: 100%;
	height: 100%;
}

.jg-detail-swiper .swiper-slide {
	display: flex;
	align-items: center;
	justify-content: center;
}

.jg-detail-swiper .swiper-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.jg-detail-swiper .swiper-pagination {
	bottom: 10px;
}

.jg-detail-swiper .swiper-pagination-bullet {
	background: rgba(255, 255, 255, 0.7);
	width: 8px;
	height: 8px;
}

.jg-detail-swiper .swiper-pagination-bullet-active {
	background: #fff;
}

.jg-detail-info {
	background: #fff;
	padding: 15px;
	margin-bottom: 10px;
}

.jg-detail-price {
	display: flex;
	align-items: baseline;
	margin-bottom: 10px;
}

.jg-detail-price .price {
	color: #ef4444;
	font-size: 24px;
	font-weight: 600;
}

.jg-detail-price .price-symbol {
	font-size: 14px;
}

.jg-detail-price .price-original {
	color: #999;
	font-size: 14px;
	text-decoration: line-through;
	margin-left: 10px;
}

.jg-detail-title {
	font-size: 16px;
	color: #333;
	line-height: 1.5;
	margin-bottom: 10px;
}

.jg-detail-desc {
	font-size: 13px;
	color: #666;
	line-height: 1.6;
}

/* ========== 规格选择 ========== */
.jg-sku {
	background: #fff;
	padding: 15px;
	margin-bottom: 10px;
}

.jg-sku-title {
	font-size: 14px;
	color: #333;
	margin-bottom: 12px;
}

.jg-sku-options {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.jg-sku-option {
	padding: 8px 16px;
	background: #f5f5f5;
	border-radius: 4px;
	font-size: 13px;
	color: #333;
	cursor: pointer;
	border: 1px solid transparent;
}

.jg-sku-option:active {
	background: #e8f0fe;
}

.jg-sku-option.active {
	background: #e8f0fe;
	border-color: #4a90e2;
	color: #4a90e2;
}

.jg-sku-option.disabled {
	color: #ccc;
	cursor: not-allowed;
}

/* ========== 详情页Tab ========== */
.jg-tabs {
	background: #fff;
	margin-bottom: 10px;
}

.jg-tabs-nav {
	display: flex;
	border-bottom: 1px solid #f0f0f0;
}

.jg-tabs-item {
	flex: 1;
	padding: 12px 0;
	text-align: center;
	font-size: 14px;
	color: #666;
	position: relative;
	cursor: pointer;
}

.jg-tabs-item.active {
	color: #4a90e2;
}

.jg-tabs-item.active::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 40px;
	height: 2px;
	background: #4a90e2;
}

.jg-tabs-content {
	padding: 15px;
}

.jg-tabs-panel {
	display: none;
}

.jg-tabs-panel.active {
	display: block;
}

.jg-tabs-panel img {
	max-width: 100%;
	height: auto;
}

/* ========== 详情页底部操作 ========== */
.jg-action {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	height: 55px;
	background: #fff;
	border-top: 1px solid #e5e5e5;
	display: flex;
	align-items: center;
	z-index: 1000;
	padding: 0 15px;
}

.jg-action-icons {
	display: flex;
	gap: 15px;
}

.jg-action-icon {
	display: flex;
	flex-direction: column;
	align-items: center;
	color: #666;
	font-size: 10px;
	position: relative;
}

.jg-action-icon i {
	font-size: 20px;
	margin-bottom: 2px;
}

.jg-action-icon:active {
	opacity: 0.7;
}

.jg-action-btn {
	flex: 1;
	display: flex;
	margin-left: 15px;
	gap: 10px;
}

.jg-action-btn a {
	flex: 1;
	height: 38px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 19px;
	font-size: 14px;
	font-weight: 500;
}

.jg-action-btn .btn-cart {
	background: linear-gradient(135deg, #ffa726 0%, #ff9800 100%);
	color: #fff;
}

.jg-action-btn .btn-buy {
	background: linear-gradient(135deg, #ef5350 0%, #e53935 100%);
	color: #fff;
}

/* ========== 空状态 ========== */
.jg-empty {
	padding: 60px 20px;
	text-align: center;
	color: #999;
}

.jg-empty i {
	font-size: 60px;
	margin-bottom: 15px;
	color: #ddd;
}

.jg-empty p {
	font-size: 14px;
}

/* ========== 加载状态 ========== */
.jg-loading {
	padding: 40px 20px;
	text-align: center;
	color: #999;
}

.jg-loading i {
	font-size: 30px;
	animation: jg-spin 1s linear infinite;
}

@keyframes jg-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

/* ========== 响应式适配 ========== */
@media screen and (max-width: 320px) {
	.jg-grid-icon {
		width: 40px;
		height: 40px;
		font-size: 20px;
	}
	
	.jg-grid-text {
		font-size: 12px;
	}
}

@media screen and (min-width: 375px) {
	.jg-grid {
		gap: 2px;
	}
}

/* ========== 页面通用样式 ========== */
.jg-page {
	min-height: 100vh;
	background: #f5f5f5;
}

.jg-main {
	padding-top: 44px;
	padding-bottom: 55px;
}

/* ========== 动画效果 ========== */
@keyframes fadeIn {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

.jg-fade-in {
	animation: fadeIn 0.3s ease;
}
