/**
 * Shopping flow: cart, checkout, account, shipping
 */

/* Free shipping bar */
.yunfanzhi-free-shipping-bar {
	margin-bottom: 24px;
	padding: 16px 20px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.free-shipping-message {
	margin: 0 0 10px;
	font-size: 14px;
	font-weight: 600;
	color: var(--color-text);
}

.free-shipping-message--success {
	color: var(--color-primary);
}

.free-shipping-progress {
	height: 8px;
	background: var(--color-border);
	border-radius: 999px;
	overflow: hidden;
}

.free-shipping-progress-fill {
	height: 100%;
	background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
	border-radius: 999px;
	transition: width 0.3s ease;
}

.free-shipping-meta {
	display: flex;
	justify-content: flex-end;
	gap: 6px;
	margin: 8px 0 0;
	font-size: 12px;
	color: var(--color-text-muted);
}

.free-shipping-bar--mini-cart {
	margin: 0 0 12px;
	padding: 12px;
}

/* Checkout steps */
.yunfanzhi-checkout-steps {
	margin-bottom: 28px;
}

.yunfanzhi-checkout-steps ol {
	display: flex;
	list-style: none;
	margin: 0;
	padding: 0;
	gap: 8px;
}

.checkout-step {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 12px 16px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	font-size: 14px;
	color: var(--color-text-muted);
}

.checkout-step a {
	display: flex;
	align-items: center;
	gap: 8px;
	color: inherit;
	text-decoration: none;
}

.checkout-step.is-current {
	border-color: var(--color-primary);
	background: var(--color-primary-light);
	color: var(--color-primary);
	font-weight: 600;
}

.checkout-step.is-done {
	color: var(--color-text);
}

.step-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--color-border);
	font-size: 12px;
	font-weight: 700;
}

.checkout-step.is-current .step-number,
.checkout-step.is-done .step-number {
	background: var(--color-primary);
	color: #fff;
}

/* Cart */
.cart-continue-shopping {
	margin: 0 0 16px;
}

.yunfanzhi-cart-trust {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--color-border);
}

.cart-trust-item {
	padding: 8px 14px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	font-size: 13px;
	font-weight: 500;
}

/* Checkout shipping note */
.yunfanzhi-checkout-shipping-note {
	margin-bottom: 16px;
	padding: 12px 16px;
	background: var(--color-bg-alt);
	border-radius: var(--radius-md);
	font-size: 14px;
}

/* Product shipping info */
.yunfanzhi-product-shipping-info {
	margin: 16px 0;
	padding: 16px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.shipping-info-item {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
	font-size: 14px;
	border-bottom: 1px solid var(--color-border);
}

.shipping-info-item:last-child {
	border-bottom: 0;
}

.shipping-info-item strong {
	color: var(--color-text-muted);
	font-weight: 500;
}

.shipping-info-item span {
	text-align: right;
}

.shipping-info-link {
	display: inline-block;
	margin-left: 8px;
	font-size: 13px;
	color: var(--color-primary);
	text-decoration: none;
	white-space: nowrap;
}

.shipping-info-link:hover {
	text-decoration: underline;
}

/* Order tracking */
.yunfanzhi-order-tracking {
	margin-bottom: 32px;
	padding: 20px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.yunfanzhi-order-tracking h3 {
	margin: 0 0 16px;
	font-size: 18px;
}

.order-tracking-number,
.order-shipping-method {
	margin: 0 0 12px;
	font-size: 14px;
}

.order-timeline {
	list-style: none;
	margin: 0;
	padding: 0;
}

.order-timeline-step {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 0;
	color: var(--color-text-muted);
	font-size: 14px;
}

.order-timeline-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--color-border);
	flex-shrink: 0;
}

.order-timeline-step.is-done {
	color: var(--color-text);
}

.order-timeline-step.is-done .order-timeline-dot {
	background: var(--color-primary);
}

.order-timeline-step.is-current {
	font-weight: 600;
	color: var(--color-primary);
}

.order-timeline-step.is-current .order-timeline-dot {
	box-shadow: 0 0 0 4px var(--color-primary-light);
	background: var(--color-primary);
}

/* Account dashboard */
.yunfanzhi-account-dashboard {
	margin-bottom: 32px;
}

.account-welcome h2 {
	margin: 0 0 8px;
	font-size: 24px;
}

.account-welcome p {
	margin: 0 0 20px;
	color: var(--color-text-muted);
}

.account-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-bottom: 24px;
}

.account-stat-card {
	padding: 20px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	text-align: center;
}

.account-stat-card strong {
	display: block;
	margin-bottom: 6px;
	font-size: 22px;
	color: var(--color-primary);
}

.account-stat-card span {
	font-size: 13px;
	color: var(--color-text-muted);
}

.account-quick-links h3 {
	margin: 0 0 12px;
	font-size: 16px;
}

.account-quick-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
}

.account-quick-link {
	display: block;
	padding: 14px 16px;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	text-decoration: none;
	color: var(--color-text);
	font-weight: 500;
	transition: border-color 0.2s, color 0.2s;
}

.account-quick-link:hover {
	border-color: var(--color-primary);
	color: var(--color-primary);
}

@media (max-width: 768px) {
	.yunfanzhi-checkout-steps ol {
		flex-direction: column;
	}

	.account-stats {
		grid-template-columns: 1fr;
	}

	.account-quick-grid {
		grid-template-columns: 1fr;
	}
}

[data-theme="dark"] .checkout-step.is-current {
	background: rgba(13, 148, 136, 0.15);
}

/* Thank you page */
.yunfanzhi-thankyou-banner {
	margin-bottom: 32px;
	padding: 32px;
	text-align: center;
	background: var(--color-bg-alt);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
}

.thankyou-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin-bottom: 16px;
	background: var(--color-primary);
	color: #fff;
	border-radius: 50%;
	font-size: 28px;
	font-weight: 700;
}

.yunfanzhi-thankyou-banner h2 {
	margin: 0 0 8px;
	font-size: 24px;
}

.yunfanzhi-thankyou-banner p {
	margin: 0 0 8px;
	color: var(--color-text-muted);
}

.thankyou-delivery {
	font-size: 14px;
}

.thankyou-actions {
	display: flex;
	justify-content: center;
	gap: 12px;
	margin-top: 20px;
	flex-wrap: wrap;
}

.yunfanzhi-thankyou-banner--pending .thankyou-icon {
	background: #f59e0b;
}

.yunfanzhi-thankyou-banner--failed .thankyou-icon {
	background: #ef4444;
}

.api-tracking-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.api-tracking-header h4 {
	margin: 0;
}

.order-carrier-label {
	font-size: 14px;
	color: var(--color-text-muted, #64748b);
}

.aftersales-badge {
	display: inline-block;
	padding: 2px 8px;
	font-size: 12px;
	border-radius: 999px;
	background: rgba(13, 148, 136, 0.12);
	color: var(--color-primary);
}

/* Empty cart */
.yunfanzhi-empty-cart-extra {
	margin-top: 16px;
	text-align: center;
}

.empty-cart-hint {
	color: var(--color-text-muted);
	font-size: 15px;
}

.empty-cart-action .button {
	margin-top: 8px;
}

/* Mobile cart sticky checkout */
.yunfanzhi-cart-sticky-bar {
	display: none;
}

@media (max-width: 768px) {
	.yunfanzhi-cart-sticky-bar {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 90;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
		background: var(--color-bg, #fff);
		border-top: 1px solid var(--color-border);
		box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
	}

	body.has-mobile-tab-bar .yunfanzhi-cart-sticky-bar {
		bottom: calc(56px + env(safe-area-inset-bottom, 0px));
	}

	body.is-cart-page.has-mobile-tab-bar {
		padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
	}

	.cart-sticky-summary {
		display: flex;
		flex-direction: column;
		gap: 2px;
		min-width: 0;
	}

	.cart-sticky-label {
		font-size: 12px;
		color: var(--color-text-muted);
	}

	.cart-sticky-total {
		font-size: 16px;
		line-height: 1.2;
	}

	.cart-sticky-checkout {
		flex-shrink: 0;
		white-space: nowrap;
	}
}

/* Save for later */
.cart-save-later-link {
	display: inline-block;
	margin-top: 6px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--color-primary);
	font-size: 13px;
	cursor: pointer;
	text-decoration: underline;
}

.yunfanzhi-saved-cart {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--color-border);
}

.yunfanzhi-saved-cart--compact .saved-list-page,
.yunfanzhi-saved-cart--compact .saved-list-header,
.yunfanzhi-saved-cart--compact .saved-list-cart-link {
	display: none;
}

.saved-cart-section-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.saved-cart-section-header h2 {
	margin: 0;
	font-size: 20px;
}

.saved-cart-view-all {
	font-size: 14px;
	color: var(--color-primary);
	text-decoration: none;
}

.saved-cart-view-all:hover {
	text-decoration: underline;
}

.saved-list-page {
	padding: 32px 0 48px;
}

.saved-list-header {
	margin-bottom: 20px;
}

.saved-list-title {
	margin: 0 0 8px;
}

.saved-list-count-text {
	margin: 0;
	color: var(--color-text-muted);
}

.saved-list-cart-link {
	margin-top: 20px;
}

.account-link-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	margin-left: 6px;
	padding: 0 5px;
	border-radius: 999px;
	background: var(--color-primary);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
}

.yunfanzhi-saved-cart h2 {
	margin: 0 0 8px;
	font-size: 20px;
}

.saved-cart-intro {
	margin: 0 0 16px;
	color: var(--color-text-muted);
	font-size: 14px;
}

.saved-cart-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 12px;
}

.saved-cart-item {
	display: grid;
	grid-template-columns: 72px 1fr auto;
	gap: 12px;
	align-items: center;
	padding: 12px;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-bg-alt);
}

.saved-cart-actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.saved-cart-name {
	font-weight: 600;
	color: var(--color-text);
	text-decoration: none;
}

.saved-cart-qty,
.saved-cart-price {
	display: block;
	font-size: 13px;
	color: var(--color-text-muted);
}

/* Free shipping upsell */
.yunfanzhi-free-shipping-upsell {
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--color-border);
}

.yunfanzhi-free-shipping-upsell h2 {
	margin: 0 0 8px;
	font-size: 20px;
}

.upsell-intro {
	margin: 0 0 16px;
	color: var(--color-text-muted);
}

.upsell-products {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: 16px;
}

.upsell-product-card {
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	background: var(--color-bg);
}

.upsell-product-body {
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.upsell-product-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--color-text);
	text-decoration: none;
}

.upsell-product-price {
	font-size: 14px;
	color: var(--color-primary);
}

@media (max-width: 768px) {
	.saved-cart-item {
		grid-template-columns: 64px 1fr;
	}

	.saved-cart-actions {
		grid-column: 1 / -1;
		flex-direction: row;
		flex-wrap: wrap;
	}
}
