/* Variables */
:root {
	--cws-primary: #10666c;
	--cws-primary-hover: #219EA7;
	--cws-secondary: #ff2424;
	--cws-secondary-hover: #219EA7;
	--cws-text: #1f2937;
	--cws-text-light: #4b5563;
	--cws-text-lighter: #9ca3af;
	--cws-bg: #f3f4f6;
	--cws-border: #e5e7eb;
	--cws-card-bg: #ffffff;
	--cws-radius: 6px; /* Sharper for hardware */
	--cws-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
	--cws-shadow-hover: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	--cws-transition: all 0.2s ease-in-out;
}

/* Container Layout */
.cws-shop-container {
	display: flex;
	flex-wrap: wrap;
	gap: 30px;
	margin: 0 auto;
	max-width: 1200px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--cws-text);
}

.cws-sidebar {
	flex: 0 0 240px;
}

.cws-main-content {
	flex: 1;
	position: relative;
}

/* Sidebar Widgets */
.cws-filter-widget {
	margin-bottom: 30px;
}

.cws-widget-title {
	font-size: 14px;
	font-weight: 700;
	margin-bottom: 15px;
	color: var(--cws-text);
	text-transform: uppercase;
	letter-spacing: 0.5px;
	border-bottom: 2px solid var(--cws-border);
	padding-bottom: 10px;
}

.cws-input, .cws-select {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--cws-border);
	border-radius: var(--cws-radius);
	font-size: 14px;
	transition: var(--cws-transition);
	box-sizing: border-box;
	background: #fff;
	color: var(--cws-text);
	box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
}

.cws-input:focus, .cws-select:focus {
	outline: none;
	border-color: var(--cws-primary);
	box-shadow: 0 0 0 2px rgba(21, 57, 121, 0.15);
}

.cws-checkbox-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.cws-checkbox-list li {
	margin-bottom: 10px;
}

.cws-checkbox-list label {
	display: flex;
	align-items: flex-start;
	font-size: 14px;
	cursor: pointer;
	color: var(--cws-text-light);
	transition: var(--cws-transition);
	line-height: 1.4;
}

.cws-checkbox-list label:hover {
	color: var(--cws-primary);
}

.cws-checkbox-list input[type="radio"] {
	margin-right: 10px;
	margin-top: 3px; /* Align with first line of text */
	accent-color: var(--cws-primary);
	width: 15px;
	height: 15px;
	cursor: pointer;
	flex-shrink: 0; /* Prevent radio button from shrinking */
}

.cws-cat-name {
	flex: 1; /* Allow text to take remaining space and wrap */
	word-break: break-word;
}

.cws-checkbox-list .count {
	font-size: 12px;
	color: var(--cws-text-lighter);
	font-weight: 500;
	white-space: nowrap;
	margin-left: 3px;
}

/* Product Grid */
.cws-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 20px;
}

/* Loading Overlay */
.cws-loader {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(255, 255, 255, 0.7);
	display: flex;
	justify-content: center;
	align-items: center;
	z-index: 10;
	border-radius: var(--cws-radius);
	backdrop-filter: blur(1px);
}

.cws-loader .spinner {
	width: 36px;
	height: 36px;
	border: 3px solid rgba(21, 57, 121, 0.1);
	border-top-color: var(--cws-primary);
	border-radius: 50%;
	animation: cws-spin 0.8s linear infinite;
}

@keyframes cws-spin {
	to { transform: rotate(360deg); }
}

/* Product Card */
.cws-product-card {
	background: var(--cws-card-bg);
	border-radius: var(--cws-radius);
	border: 1px solid var(--cws-border);
	box-shadow: var(--cws-shadow);
	overflow: hidden;
	transition: var(--cws-transition);
	display: flex;
	flex-direction: column;
	position: relative;
}

.cws-product-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--cws-shadow-hover);
	border-color: #d1d5db;
}

.cws-product-link {
	text-decoration: none;
	color: inherit;
	flex: 1;
	display: flex;
	flex-direction: column;
}

.cws-product-image {
	position: relative;
	width: 100%;
	aspect-ratio: 1;
	overflow: hidden;
	background: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 15px;
	box-sizing: border-box;
	border-bottom: 1px solid var(--cws-border);
}

.cws-product-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform 0.3s ease;
}

.cws-product-card:hover .cws-product-image img {
	transform: scale(1.05);
}

.cws-sale-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	background: var(--cws-secondary);
	color: white;
	padding: 3px 8px;
	font-size: 11px;
	font-weight: 700;
	border-radius: 3px;
	text-transform: uppercase;
	z-index: 2;
	letter-spacing: 0.5px;
}

.cws-product-details {
	padding: 15px;
	flex: 1;
	display: flex;
	flex-direction: column;
}

/* FORCE title size to overcome theme styles */
.cws-shop-container .cws-product-title,
.cws-shop-container h3.cws-product-title {
	font-size: 14px !important;
	margin: 0 0 8px 0 !important;
	color: var(--cws-text) !important;
	line-height: 1.4 !important;
	font-weight: 600 !important;
	transition: color 0.2s ease;
}

.cws-product-card:hover .cws-product-title {
	color: var(--cws-primary) !important;
}

.cws-product-price {
	font-size: 15px;
	font-weight: 700;
	color: var(--cws-text);
	margin-top: auto;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.cws-product-price del {
	color: var(--cws-text-lighter);
	font-weight: 400;
	font-size: 12px;
}

.cws-product-price ins,
.cws-product-price > .amount {
	text-decoration: none;
	color: var(--cws-secondary);
	font-size: 16px;
}

.cws-product-actions {
	padding: 0 15px 15px;
}

/* Solid, robust button for hardware */
.cws-shop-container .cws-add-to-cart {
	display: block;
	width: 100%;
	text-align: center;
	padding: 10px 15px;
	background: var(--cws-primary);
	color: white;
	border: 1px solid var(--cws-primary);
	text-decoration: none;
	border-radius: 4px;
	font-weight: 600;
	font-size: 13px;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	transition: var(--cws-transition);
	cursor: pointer;
}

.cws-shop-container .cws-add-to-cart:hover {
	background: var(--cws-primary-hover);
	border-color: var(--cws-primary-hover);
	color: white;
}

.cws-add-to-cart.loading {
	opacity: 0.7;
	pointer-events: none;
}

.cws-add-to-cart.added {
	background: #10b981;
	border-color: #10b981;
	color: white;
}

/* Pagination */
.cws-pagination {
	margin-top: 40px;
	text-align: center;
}

.cws-pagination .page-numbers {
	display: inline-flex;
	justify-content: center;
	align-items: center;
	width: 36px;
	height: 36px;
	margin: 0 3px;
	background: white;
	border: 1px solid var(--cws-border);
	color: var(--cws-text);
	border-radius: var(--cws-radius);
	text-decoration: none;
	transition: var(--cws-transition);
	font-weight: 500;
	font-size: 14px;
}

.cws-pagination .page-numbers:hover {
	border-color: var(--cws-primary);
	color: var(--cws-primary);
}

.cws-pagination .page-numbers.current {
	background: var(--cws-primary);
	color: white;
	border-color: var(--cws-primary);
}

.cws-no-products {
	grid-column: 1 / -1;
	text-align: center;
	padding: 60px 20px;
	background: white;
	border-radius: var(--cws-radius);
	border: 1px dashed #cbd5e1;
	color: var(--cws-text-light);
	font-size: 15px;
}

/* Responsive */
@media (max-width: 768px) {
	.cws-shop-container {
		flex-direction: column;
		gap: 20px;
	}
	.cws-sidebar {
		flex: none;
		width: 100%;
	}
	.cws-grid {
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	}
}
