:root {
	--radius: 6px;
	--radius-card: 8px;
	--color-primary: #00b19a;
	--color-primary-hover: #009b85;
	--color-dark: #14141c;
	--color-dark-hover: #2a2a36;
	--color-muted: #5c5c6a;
	--color-surface: #fff;
	--color-bg: #f4f8f7;
	--color-border: #d9e5e3;
	--gray-200: #e5ebea;
	--gray-300: #d1ddd9;
	--gray-700: #14141c;
	--shadow: 0 1px 3px rgba(20, 20, 28, 0.06);
	--shadow-hover: 0 4px 12px rgba(20, 20, 28, 0.1);
	--focus-ring: 0 0 0 3px rgba(0, 177, 154, 0.25);
	--bp-md: 768px;
	--bp-lg: 1024px;
	--ease-out-smooth: cubic-bezier(0.33, 1, 0.68, 1);
	--ease-out-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
	--ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
	--duration-fast: 0.2s;
	--duration-normal: 0.35s;
	--duration-slow: 0.5s;
	--duration-toggle: 0.32s;
}

*, *::before, *::after { box-sizing: border-box; }

@keyframes fadeSlideUp {
	from {
		opacity: 0;
		transform: translateY(20px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}
@keyframes badgePop {
	0% { transform: scale(0); opacity: 0; }
	60% { transform: scale(1.15); opacity: 1; }
	100% { transform: scale(1); opacity: 1; }
}
@keyframes cardEnter {
	from {
		opacity: 0;
		transform: translateY(24px) scale(0.97);
	}
	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}
@keyframes emptyStateIn {
	from { opacity: 0; transform: translateY(-8px); }
	to { opacity: 1; transform: translateY(0); }
}

body {
	margin: 0;
	overflow-x: hidden;
	font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	line-height: 1.5;
	color: var(--color-dark);
	background: var(--color-bg);
}

.page {
	max-width: 1200px;
	margin: 0 auto;
	padding: 1rem;
	animation: fadeSlideUp 0.55s var(--ease-out-smooth) 0.08s backwards;
}

.page-header {
	position: sticky;
	top: 0;
	z-index: 10;
	background: var(--color-bg);
	border-bottom: 1px solid var(--color-border);
	animation: fadeSlideUp var(--duration-slow) var(--ease-out-smooth) backwards;
}

.page-header__inner {
	display: flex;
	flex-direction: column;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 0.75rem;
	max-width: 1200px;
	margin: 0 auto;
	padding: 1rem;
}
.page-header__title {
	flex: 1 1 auto;
	min-width: 0;
}

.page-header__actions {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	width: 100%;
}

.page-header__row {
	display: flex;
	flex-wrap: nowrap;
	gap: 0.5rem;
	align-items: stretch;
}
.page-header__row .sort-wrap {
	flex: 1;
	min-width: 0;
}
.page-header__row .add-sample-wrap {
	flex-shrink: 0;
}

.page-title { margin: 0; font-size: 1.5rem; font-weight: 700; }

.search-wrap { flex: 1 1 100%; min-width: 0; }

.search-input {
	width: 100%;
	min-height: 44px;
	padding: 0.5rem 0.75rem;
	font-size: 1rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-surface);
	transition: border-color var(--duration-normal) var(--ease-in-out),
		box-shadow var(--duration-normal) var(--ease-in-out);
}
.search-input:focus,
.search-input:focus-visible {
	outline: none;
	border-color: var(--color-primary);
	box-shadow: var(--focus-ring);
}

.sort-wrap { min-width: 0; }
.sort-select {
	min-height: 44px;
	padding: 0.5rem 2rem 0.5rem 0.75rem;
	font-size: 0.9375rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius);
	background: var(--color-surface);
	color: var(--color-dark);
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235c5c6a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.6rem center;
	transition: border-color var(--duration-normal) var(--ease-in-out),
		box-shadow var(--duration-normal) var(--ease-in-out);
}
.sort-select:hover,
.sort-select:focus {
	border-color: var(--color-primary);
}
.sort-select:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0.5rem 1rem;
	font-size: 0.9375rem;
	font-weight: 500;
	border: none;
	border-radius: var(--radius);
	cursor: pointer;
	transition: background-color var(--duration-normal) var(--ease-in-out),
		color var(--duration-normal) var(--ease-in-out),
		opacity 0.3s var(--ease-out-smooth),
		transform var(--duration-fast) var(--ease-out-smooth),
		box-shadow var(--duration-normal) var(--ease-in-out);
}
.btn:hover {
	transform: translateY(-1px);
}
.btn:active {
	transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
	.page,
	.page-header,
	.product-card,
	.product-card--enter,
	.empty-state:not([hidden]) { animation: none; }
	.btn,
	.product-card__btn,
	.search-input,
	.sort-select,
	.product-card,
	.product-card__img { transition-duration: 0.01ms; }
	.btn:hover { transform: none; }
	.product-card:hover { transform: none; }
	.product-card:hover .product-card__img { transform: none; }
	.product-card__btn.is-updating { opacity: 0.6; }
}
.product-card__btn {
	transition: background-color var(--duration-toggle) var(--ease-in-out),
		color var(--duration-toggle) var(--ease-in-out),
		opacity var(--duration-toggle) var(--ease-out-smooth);
}
.product-card__btn.is-updating {
	opacity: 0.35;
	pointer-events: none;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-outline {
	background: var(--color-surface);
	color: var(--color-primary);
	border: 1px solid var(--color-primary);
}
.btn-outline:hover {
	background: rgba(0, 177, 154, 0.08);
	border-color: var(--color-primary-hover);
	color: var(--color-primary-hover);
}
.btn:focus-visible,
.product-card__btn:focus-visible {
	outline: none;
	box-shadow: var(--focus-ring);
}
.btn-secondary { background: var(--gray-200); color: var(--color-dark); }
.btn-secondary:hover { background: var(--gray-300); }

.product-grid-section { position: relative; }
.empty-state {
	margin: 1.5rem 0;
	text-align: center;
	color: var(--color-muted);
	font-size: 0.9375rem;
}
.empty-state:not([hidden]) {
	display: block;
	animation: emptyStateIn var(--duration-normal) var(--ease-out-smooth) forwards;
}

.product-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
	min-width: 0;
}

@media (min-width: 480px) {
	.page,
	.page-header__inner { padding: 1.25rem; }
	.page-header__inner { gap: 1rem; }
	.page-title { font-size: 1.625rem; }
	.search-wrap { flex: 1 1 auto; min-width: 200px; }
}

@media (min-width: 768px) {
	.page,
	.page-header__inner { padding: 1.5rem; }
	.page-title { font-size: 1.75rem; }
	.product-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.product-grid { grid-template-columns: repeat(3, 1fr); }
}

.product-card {
	position: relative;
	background: var(--color-surface);
	border-radius: var(--radius-card);
	overflow: hidden;
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	min-width: 0;
	border-left: 4px solid transparent;
	animation: cardEnter 0.6s var(--ease-out-smooth) backwards;
	transition: transform var(--duration-normal) var(--ease-out-smooth),
		box-shadow var(--duration-normal) var(--ease-out-smooth),
		background var(--duration-normal) var(--ease-in-out),
		border-color var(--duration-normal) var(--ease-in-out),
		opacity var(--duration-normal) var(--ease-in-out);
}
.product-card:nth-child(1) { animation-delay: 0.05s; }
.product-card:nth-child(2) { animation-delay: 0.12s; }
.product-card:nth-child(3) { animation-delay: 0.19s; }
.product-card:nth-child(4) { animation-delay: 0.26s; }
.product-card:nth-child(5) { animation-delay: 0.33s; }
.product-card:nth-child(6) { animation-delay: 0.4s; }
.product-card:nth-child(n+7) { animation-delay: 0.47s; }
.product-card--enter {
	animation: cardEnter 0.55s var(--ease-out-smooth) backwards;
	animation-delay: 0s;
}
.product-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 12px 28px rgba(20, 20, 28, 0.12), 0 4px 12px rgba(0, 177, 154, 0.08);
}
.product-card.is-hidden {
	display: none;
}

.product-card.is-added {
	background: rgba(0, 177, 154, 0.08);
	border-left-color: var(--color-primary);
	box-shadow: var(--shadow-hover);
}
.product-card.is-added::after {
	content: "✓";
	position: absolute;
	top: 0.75rem;
	right: 0.75rem;
	width: 1.75rem;
	height: 1.75rem;
	background: var(--color-primary);
	color: #fff;
	border-radius: 50%;
	font-size: 0.7rem;
	font-weight: 700;
	line-height: 1.75rem;
	text-align: center;
	animation: badgePop 0.4s var(--ease-out-bounce) forwards;
}
.product-card.is-added .product-card__btn {
	background: var(--color-dark);
}
.product-card.is-added .product-card__btn:hover {
	background: var(--color-dark-hover);
}

.product-card__media {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--gray-200);
}
.product-card__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s var(--ease-out-smooth);
}
.product-card:hover .product-card__img {
	transform: scale(1.06);
}

.product-card__body {
	padding: 1rem;
	display: flex;
	flex-direction: column;
	flex: 1;
}
.product-card__title { margin: 0 0 0.5rem; font-size: 1.125rem; font-weight: 600; }
.product-card__desc { margin: 0 0 0.75rem; font-size: 0.875rem; color: var(--color-muted); flex: 1; }
.product-card__price { margin: 0 0 1rem; font-size: 1.125rem; font-weight: 600; }
.product-card__btn { width: 100%; }

.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
