@media (max-width: 1200px) {
	:root { --columns: 4; }
}

@media (max-width: 768px) {
	:root { --columns: 2; }
}

@media (max-width: 480px) {
	:root { --columns: 1; }
}

:root {
	--columns: 6;
	--bg: #fff;
	--text: #000;
	--border: #ddd;
	--primary: #4a6fa5;
	--secondary: #f8f9fa;
	--error: #dc3545;
}

[data-theme="dark"] {
	--bg: #000;
	--text: #fff;
	--border: #444;
	--primary: #6c8fc7;
	--secondary: #333;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: Tahoma, sans-serif;
	margin: 2rem;
}

#theme-toggle {
	justify-content: center;
	position: fixed;
	z-index: 100;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 50%;
	padding: 0.5rem;
	cursor: pointer;
}

#products-container {
	margin-top: 2rem;
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

.category-card {
	background: var(--secondary);
	border-radius: 8px;
	padding: 1rem;
}

.category-title {
	color: var(--primary);
	margin-bottom: 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--primary);
	text-align: center;
}

.products-grid {
	display: grid;
	grid-template-columns: repeat(var(--columns), 1fr);
	gap: 3rem;
	justify-items: center;
}

@media (max-width: 1200px) {
	.products-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 768px) {
	.products-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.products-grid {
		grid-template-columns: 1fr;
	}
}

.product-item {
	width: 100%;
	max-width: 300px;
	border: 1px solid var(--border);
	border-radius: 8px;
	padding: 1rem;
	background: var(--bg);
	text-align: center;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.product-image-container {
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	margin-bottom: 0.5rem;
}

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

.product-item h3 {
	margin: 0.5rem 0;
	color: var(--primary);
	font-size: 1.1rem;
	min-height: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
}

.price {
	font-weight: bold;
	color: green;
	margin: 0.5rem 0;
}

.description {
	font-size: 0.9rem;
	line-height: 1.4;
	margin: 0.5rem 0;
	flex-grow: 1;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	min-height: 4.2rem;
}

.view-btn {
	background: var(--secondary);
	color: var(--text);
	border: 1px solid var(--border) !important;
	text-decoration: none;
	margin-top: 1rem;
	display: block;
	padding-block: 0.5rem;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9rem;
	width: 100%;
}

.error {
	padding: 1rem;
	background: #f8d7da;
	color: var(--error);
	border-radius: 4px;
	border: 1px solid #f5c6cb;
	text-align: center;
}

footer {
	text-align: center;
	margin-top: 3rem;
	padding-top: 1rem;
	border-top: 1px solid var(--border);
}

/* product.html */
.product-detail-container {
	max-width: 1000px;
	margin: 0 auto;
	padding: 20px;
	box-sizing: border-box;
	width: 100%;
}

.breadcrumb {
	margin-bottom: 20px;
	color: #6c757d;
}

.breadcrumb a {
	color: var(--primary);
	text-decoration: none;
}

.product-detail {
	display: flex;
	flex-wrap: wrap;
	gap: 30px;
}

.product-gallery {
	flex: 1;
	min-width: 300px;
}

.product-main-image {
	width: 100%;
	border-radius: 8px;
	overflow: hidden;
	position: relative;
	background: var(--secondary);
	height: 400px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.product-main-image img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.product-thumbnails {
	display: flex;
	gap: 10px;
	margin-top: 15px;
	overflow-x: auto;
	padding-bottom: 10px;
}

.product-thumbnail {
	width: 80px;
	height: 80px;
	object-fit: cover;
	border-radius: 4px;
	cursor: pointer;
	border: 2px solid transparent;
	background: var(--secondary);
	padding: 2px;
}

.product-thumbnail.active {
	border-color: var(--primary);
}

.product-info {
	flex: 1;
	min-width: 300px;
}

.product-title {
	color: var(--primary);
	margin-bottom: 15px;
}

.product-price {
	font-size: 1.5em;
	color: green;
	margin-bottom: 15px;
}

.product-description {
	line-height: 1.6;
	margin-bottom: 20px;
}

.add-to-cart-section {
	margin-top: 30px;
}

.buy-btn {
	text-decoration: none;
	padding: 15px 30px;
	margin-bottom: 15px;
	background: var(--primary);
	color: white;
	border-radius: 8px;
	cursor: pointer;
	font-size: 18px;
	width: 100%;
}

.continue-shopping {
	display: inline-block;
	padding: 10px 20px;
	background: var(--primary);
	color: white;
	text-decoration: none;
	border-radius: 4px;
	margin-top: 20px;
}

@media (min-width: 769px) {
	.product-detail {
		flex-direction: row-reverse;
	}
}

@media (max-width: 768px) {
	.product-detail {
		flex-direction: column;
	}

	.product-gallery, .product-info {
		width: 100%;
	}

	.product-main-image {
		height: 300px;
	}
}
