/**
 * 美国苹果ID购买 - 主页样式
 * 独立本地文件，无外部依赖
 */

*,
*::before,
*::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
	font-size: 14px;
	line-height: 1.6;
	color: #333;
	background: #f0f0f0;
}

a {
	color: #0066cc;
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

/* ---- Header ---- */
.site-header {
	background: #333;
	color: #fff;
}

.header-inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 48px;
}

.site-logo {
	display: flex;
	align-items: center;
	gap: 8px;
	color: #fff;
	text-decoration: none;
	font-size: 16px;
	font-weight: 700;
}

.site-logo:hover {
	text-decoration: none;
	color: #fff;
}

.site-logo svg {
	flex-shrink: 0;
}

.main-nav ul {
	display: flex;
	flex-wrap: wrap;
	list-style: none;
	gap: 4px 20px;
}

.main-nav a {
	color: #fff;
	font-size: 14px;
	text-decoration: none;
	white-space: nowrap;
}

.main-nav a:hover {
	color: #ffb400;
	text-decoration: none;
}

/* ---- Layout ---- */
.site-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 16px 40px;
}

/* ---- Notice ---- */
.site-notice {
	margin: 16px 0;
	padding: 12px 16px;
	background: #f6ffed;
	border: 1px solid #b7eb8f;
	border-radius: 2px;
	font-size: 13px;
	line-height: 1.8;
}

.site-notice p {
	margin: 0;
}

.notice-red {
	color: #cf1322;
}

.notice-blue {
	color: #0066cc;
}

.notice-green {
	color: #389e0d;
}

/* ---- Products ---- */
.products-section {
	margin-bottom: 24px;
}

.product-category {
	--col-delivery: 96px;
	--col-stock: 64px;
	--col-price: 88px;
	--col-action: 80px;
}

.section-title-bar {
	background: #f5f5f5;
	border: 1px solid #e8e8e8;
	border-bottom: none;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
}

.section-title-bar h2 {
	font-size: 15px;
	font-weight: 700;
	color: #333;
}

.table-header-cols {
	display: flex;
	gap: 0;
	font-size: 13px;
	color: #666;
	font-weight: 400;
}

.table-header-cols span {
	text-align: center;
}

.product-table {
	width: 100%;
	border-collapse: collapse;
	border: 1px solid #e8e8e8;
	background: #fff;
	table-layout: fixed;
}

.product-table .col-delivery {
	width: var(--col-delivery);
}

.product-table .col-stock {
	width: var(--col-stock);
}

.product-table .col-price {
	width: var(--col-price);
}

.product-table .col-action {
	width: var(--col-action);
}

.product-table tbody tr:nth-child(odd) {
	background: #fff;
}

.product-table tbody tr:nth-child(even) {
	background: #fafafa;
}

.product-table td {
	padding: 12px 16px;
	border-bottom: 1px solid #f0f0f0;
	vertical-align: middle;
}

.product-table td:nth-child(n+2) {
	padding-left: 8px;
	padding-right: 8px;
}

.product-table tr:last-child td {
	border-bottom: none;
}

.product-info {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	min-width: 0;
}

.product-icon {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f5f5f5;
	border-radius: 4px;
}

.product-text h3 {
	font-size: 14px;
	font-weight: 600;
	color: #333;
	margin-bottom: 2px;
	line-height: 1.4;
}

.product-text p {
	font-size: 12px;
	color: #888;
	line-height: 1.4;
}

.cell-center {
	text-align: center;
}

.badge-auto {
	display: inline-block;
	padding: 2px 8px;
	background: #27ba9b;
	color: #fff;
	font-size: 12px;
	border-radius: 3px;
	white-space: nowrap;
}

.stock-in {
	color: #27ba9b;
	font-weight: 600;
}

.stock-out {
	color: #999;
}

.price-value {
	color: #ff4d4f;
	font-weight: 700;
	font-size: 15px;
	white-space: nowrap;
}

.btn-buy {
	display: inline-block;
	padding: 6px 16px;
	background: #ffb400;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.2s;
}

.btn-buy:hover {
	background: #e6a200;
	color: #fff;
	text-decoration: none;
}

.btn-buy:disabled,
.btn-buy.is-disabled {
	background: #ccc;
	cursor: not-allowed;
}

/* ---- Articles ---- */
.articles-section {
	margin: 32px 0 24px;
}

.articles-section > h2 {
	text-align: center;
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 16px;
	color: #333;
}

.articles-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.article-column {
	border: 1px solid #e8e8e8;
	background: #fff;
}

.column-header {
	background: #f5f5f5;
	padding: 10px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	border-bottom: 1px solid #e8e8e8;
}

.column-header h3 {
	font-size: 14px;
	font-weight: 700;
	color: #333;
}

.column-header a {
	font-size: 13px;
	color: #27ba9b;
	text-decoration: none;
}

.column-header a:hover {
	text-decoration: underline;
}

.article-list {
	list-style: none;
	padding: 8px 0;
}

.article-list li {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 16px;
	border-bottom: 1px solid #f5f5f5;
}

.article-list li:last-child {
	border-bottom: none;
}

.rank-badge {
	flex-shrink: 0;
	width: 22px;
	height: 22px;
	background: #27ba9b;
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 2px;
}

.article-list a {
	flex: 1;
	color: #333;
	font-size: 13px;
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.article-list a:hover {
	color: #0066cc;
	text-decoration: underline;
}

.article-date {
	flex-shrink: 0;
	font-size: 12px;
	color: #999;
}

.article-empty {
	padding: 24px 16px;
	text-align: center;
	color: #999;
	font-size: 13px;
}

.btn-read-all {
	display: block;
	width: fit-content;
	margin: 20px auto 0;
	padding: 10px 40px;
	background: #ffb400;
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	border: none;
	border-radius: 3px;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
}

.btn-read-all:hover {
	background: #e6a200;
	color: #fff;
	text-decoration: none;
}

/* ---- Footer ---- */
.site-footer {
	background: #f5f5f5;
	border-top: 1px solid #e8e8e8;
	padding: 24px 16px;
}

.copyright {
	text-align: center;
	font-size: 12px;
	color: #999;
}

/* ---- Desktop table column alignment ---- */
@media (min-width: 769px) {
	.section-title-bar {
		display: grid;
		grid-template-columns: 1fr var(--col-delivery) var(--col-stock) var(--col-price) var(--col-action);
		align-items: center;
		padding: 0;
		gap: 0;
	}

	.section-title-bar h2 {
		padding: 10px 16px;
		min-width: 0;
	}

	.table-header-cols {
		display: contents;
	}

	.table-header-cols span {
		padding: 10px 8px;
		box-sizing: border-box;
	}

	.table-header-cols .col-delivery {
		width: var(--col-delivery);
	}

	.table-header-cols .col-stock {
		width: var(--col-stock);
	}

	.table-header-cols .col-price {
		width: var(--col-price);
	}

	.table-header-cols .col-action {
		width: var(--col-action);
	}
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
	.header-inner {
		flex-direction: column;
		padding: 10px 16px;
		gap: 8px;
	}

	.main-nav ul {
		justify-content: center;
		gap: 8px 16px;
	}

	.section-title-bar {
		flex-direction: column;
		align-items: flex-start;
	}

	.table-header-cols {
		display: none;
	}

	.product-table,
	.product-table tbody {
		display: block;
		width: 100%;
	}

	.product-table {
		table-layout: auto;
	}

	.product-table tr {
		display: grid;
		grid-template-columns: auto 1fr auto;
		grid-template-areas:
			"info info info"
			"delivery price action";
		gap: 6px 8px;
		align-items: center;
		padding: 12px 16px;
		border-bottom: 1px solid #e8e8e8;
	}

	.product-table td {
		display: block;
		width: auto;
		padding: 0;
		border: none;
	}

	.product-table td:first-child {
		grid-area: info;
	}

	.product-table td:nth-child(2) {
		grid-area: delivery;
	}

	.product-table td:nth-child(3) {
		display: none;
	}

	.product-table td:nth-child(4) {
		grid-area: price;
		text-align: left;
		white-space: nowrap;
	}

	.product-table td:nth-child(5) {
		grid-area: action;
		justify-self: end;
		text-align: right;
		white-space: nowrap;
	}

	.product-table .badge-auto {
		font-size: 11px;
		padding: 2px 6px;
	}

	.product-table .price-value {
		font-size: 14px;
	}

	.product-table .btn-buy {
		padding: 5px 12px;
		font-size: 12px;
	}

	.articles-grid {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	body {
		font-size: 13px;
	}

	.product-text h3 {
		font-size: 13px;
	}
}

/* ---- Screen reader only ---- */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
