/**
 * Frontend styles for Affiliate Category Engine.
 *
 * @package AffiliateCategoryEngine
 */

/* ============================================
   BASE & GLOBAL STYLES
   ============================================ */

* {
	box-sizing: border-box;
}

.ace-category-page {
	max-width: 100%;
	padding: 1rem;
	margin: 0 auto;
	background: #ffffff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	line-height: 1.6;
	color: #212529;
	position: relative;
	z-index: 0;
}

/* ============================================
   HEADER - H1 AT TOP (Fixed spacing from site header)
   ============================================ */

.ace-page-header-wrapper {
	margin-top: 3rem;
	margin-bottom: 2.5rem;
	padding-top: 1rem;
}

.ace-category-header-top {
	margin-bottom: 2rem;
	padding: 2rem 0 1.5rem 0;
	border-bottom: 2px solid #e9ecef;
	position: relative;
	z-index: 1;
}

.ace-category-title {
	font-size: 2rem;
	font-weight: 700;
	margin: 0 0 1rem 0;
	padding: 0;
	line-height: 1.2;
	color: #212529;
	letter-spacing: -0.02em;
	clear: both;
}

.ace-category-subtitle {
	font-size: 1.125rem;
	color: #6c757d;
	margin: 0;
	line-height: 1.7;
	max-width: 800px;
}

.ace-category-subtitle p {
	margin: 0 0 0.5rem 0;
}

.ace-category-subtitle p:last-child {
	margin-bottom: 0;
}

.ace-category-excerpt {
	font-size: 1.125rem;
	color: #6c757d;
	margin: 0;
	line-height: 1.6;
}

/* ============================================
   RESULTS HEADER
   ============================================ */

.ace-results-header {
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid #e9ecef;
}

.ace-results-count {
	font-size: 0.9375rem;
	color: #495057;
	font-weight: 600;
}

.ace-results-text {
	color: #212529;
}

/* ============================================
   PRODUCTS WRAPPER - CSS GRID LAYOUT
   ============================================ */

.ace-products-wrapper {
	display: grid;
	grid-template-columns: 1fr;
	gap: 2rem;
}

/* ============================================
   SIDEBAR
   ============================================ */

.ace-sidebar {
	background: #ffffff;
	border: 1px solid #dee2e6;
	border-radius: 12px;
	padding: 1.5rem;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	height: fit-content;
	position: sticky;
	top: 20px;
	transition: box-shadow 0.3s;
}

.ace-sidebar:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.ace-sidebar-inner {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.ace-sidebar-title {
	font-size: 1.125rem;
	font-weight: 700;
	margin: 0 0 1rem 0;
	color: #212529;
	padding-bottom: 0.75rem;
	border-bottom: 2px solid #e9ecef;
}

.ace-sort-group {
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 2px solid #e9ecef;
}

.ace-filter-group {
	margin-bottom: 0;
}

.ace-filter-title {
	font-size: 0.8125rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 0.75rem;
	color: #495057;
	display: block;
}

/* Checkbox Filters (for new columns) */
.ace-checkbox-filters {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	max-height: 200px;
	overflow-y: auto;
	padding-right: 0.5rem;
}

.ace-checkbox-filters::-webkit-scrollbar {
	width: 6px;
}

.ace-checkbox-filters::-webkit-scrollbar-track {
	background: #f8f9fa;
	border-radius: 3px;
}

.ace-checkbox-filters::-webkit-scrollbar-thumb {
	background: #ced4da;
	border-radius: 3px;
}

.ace-checkbox-filters::-webkit-scrollbar-thumb:hover {
	background: #adb5bd;
}

.ace-filter-checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s;
	font-size: 0.875rem;
}

.ace-filter-checkbox:hover {
	background: #f8f9fa;
}

.ace-filter-checkbox-input {
	width: 18px;
	height: 18px;
	margin: 0;
	cursor: pointer;
	accent-color: #007bff;
	flex-shrink: 0;
}

.ace-filter-checkbox-label {
	cursor: pointer;
	color: #495057;
	font-weight: 400;
	user-select: none;
	line-height: 1.4;
}

.ace-filter-empty {
	font-size: 0.875rem;
	color: #6c757d;
	font-style: italic;
	margin: 0.5rem 0;
	padding: 0.5rem;
	background: #f8f9fa;
	border-radius: 4px;
}

/* Price Range Filter */
.ace-price-range {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.ace-price-slider {
	width: 100%;
	height: 6px;
	border-radius: 3px;
	background: #dee2e6;
	outline: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	cursor: pointer;
	transition: background 0.2s;
}

.ace-price-slider:hover {
	background: #ced4da;
}

.ace-price-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	-moz-appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #007bff;
	cursor: pointer;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s, box-shadow 0.2s;
}

.ace-price-slider::-webkit-slider-thumb:hover {
	transform: scale(1.1);
	box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.ace-price-slider::-moz-range-thumb {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #007bff;
	cursor: pointer;
	border: none;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s, box-shadow 0.2s;
}

.ace-price-slider::-moz-range-thumb:hover {
	transform: scale(1.1);
	box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.ace-price-display {
	display: flex;
	justify-content: space-between;
	font-size: 0.875rem;
	font-weight: 600;
	color: #495057;
	padding: 0 0.25rem;
}

.ace-filter-select {
	width: 100%;
	padding: 0.625rem 0.75rem;
	border: 1px solid #ced4da;
	border-radius: 6px;
	font-size: 0.875rem;
	background: white;
	cursor: pointer;
	transition: border-color 0.2s, box-shadow 0.2s;
	font-family: inherit;
}

.ace-filter-select:focus {
	outline: none;
	border-color: #007bff;
	box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Brand Filters - Checkboxes */
.ace-brand-filters {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	max-height: 300px;
	overflow-y: auto;
	padding-right: 0.5rem;
}

.ace-brand-filters::-webkit-scrollbar {
	width: 6px;
}

.ace-brand-filters::-webkit-scrollbar-track {
	background: #f8f9fa;
	border-radius: 3px;
}

.ace-brand-filters::-webkit-scrollbar-thumb {
	background: #ced4da;
	border-radius: 3px;
}

.ace-brand-filters::-webkit-scrollbar-thumb:hover {
	background: #adb5bd;
}

.ace-brand-checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.5rem;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.2s;
	font-size: 0.875rem;
}

.ace-brand-checkbox:hover {
	background: #f8f9fa;
}

.ace-brand-checkbox-input {
	width: 18px;
	height: 18px;
	margin: 0;
	cursor: pointer;
	accent-color: #007bff;
}

.ace-brand-checkbox-label {
	cursor: pointer;
	color: #495057;
	font-weight: 400;
	user-select: none;
}

.ace-show-more-brands {
	width: 100%;
	padding: 0.5rem;
	margin-top: 0.5rem;
	background: transparent;
	border: 1px solid #ced4da;
	border-radius: 4px;
	color: #007bff;
	font-size: 0.875rem;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, border-color 0.2s;
}

.ace-show-more-brands:hover {
	background: #f8f9fa;
	border-color: #007bff;
}

.ace-brand-filters-more {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

/* Filter Buttons */
.ace-filter-button {
	width: 100%;
	padding: 0.75rem 1rem;
	margin-top: 0.5rem;
	background: #007bff;
	color: white;
	border: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.875rem;
	cursor: pointer;
	transition: background 0.2s, transform 0.1s;
	font-family: inherit;
}

.ace-filter-button:hover {
	background: #0056b3;
	transform: translateY(-1px);
}

.ace-filter-button:active {
	transform: translateY(0);
}

.ace-filter-button-secondary {
	background: #6c757d;
}

.ace-filter-button-secondary:hover {
	background: #545b62;
}

/* ============================================
   PRODUCT GRID
   ============================================ */

.ace-products-container {
	width: 100%;
}

.ace-products-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
}

/* Product Card */
.ace-product-card {
	background: white;
	border: 1px solid #e9ecef;
	border-radius: 12px;
	padding: 1.5rem;
	position: relative;
	transition: box-shadow 0.3s, transform 0.2s, border-color 0.2s;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ace-product-card:hover {
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
	transform: translateY(-6px);
	border-color: #007bff;
}

.ace-product-badges {
	position: absolute;
	top: 1rem;
	right: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	z-index: 2;
}

.ace-badge {
	display: inline-block;
	padding: 0.375rem 0.625rem;
	border-radius: 4px;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	line-height: 1;
	white-space: nowrap;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.ace-badge-amazon-choice {
	background: #ff9900;
	color: white;
}

.ace-badge-best-seller {
	background: #ffc107;
	color: #000;
}

.ace-badge-prime {
	background: #007bff;
	color: white;
}

.ace-badge-climate {
	background: #28a745;
	color: white;
}

.ace-product-image {
	width: 100%;
	height: 200px;
	margin-bottom: 1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f8f9fa;
	border-radius: 6px;
	overflow: hidden;
	position: relative;
}

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

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

.ace-product-content {
	flex: 1;
	display: flex;
	flex-direction: column;
}

.ace-product-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.75rem 0;
	line-height: 1.4;
	min-height: 2.8em;
}

.ace-product-title a {
	color: #212529;
	text-decoration: none;
	transition: color 0.2s;
}

.ace-product-title a:hover {
	color: #007bff;
}

.ace-product-rating {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
	font-size: 0.875rem;
	flex-wrap: wrap;
}

.ace-stars {
	color: #ffc107;
	font-size: 0.875rem;
	letter-spacing: 1px;
	display: inline-flex;
	gap: 1px;
}

.ace-star {
	display: inline-block;
}

.ace-star.filled {
	color: #ffc107;
}

.ace-star.half {
	background: linear-gradient(90deg, #ffc107 50%, #dee2e6 50%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.ace-rating-value {
	font-weight: 600;
	color: #212529;
}

.ace-reviews-count {
	color: #6c757d;
}

.ace-product-specs {
	list-style: none;
	padding: 0;
	margin: 0 0 1rem 0;
	font-size: 0.875rem;
	color: #495057;
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.ace-product-specs li {
	padding: 0;
	position: relative;
	padding-left: 1.25rem;
	line-height: 1.4;
}

.ace-product-specs li::before {
	content: '✓';
	position: absolute;
	left: 0;
	color: #28a745;
	font-weight: 700;
	font-size: 0.875rem;
}

.ace-product-price {
	margin-bottom: 1rem;
	font-size: 1.25rem;
	font-weight: 700;
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.ace-price-current {
	color: #dc3545;
	font-size: 1.5rem;
}

.ace-price-original {
	color: #6c757d;
	text-decoration: line-through;
	font-size: 1rem;
	font-weight: 400;
}

.ace-price-lowest {
	color: #28a745;
	font-size: 0.875rem;
	font-weight: 600;
}

.ace-price-check {
	color: #007bff;
	font-size: 1rem;
	font-weight: 600;
}

.ace-product-actions {
	margin-top: auto;
	padding-top: 0.5rem;
}

.ace-cta-button {
	display: block;
	width: 100%;
	padding: 0.875rem 1rem;
	background: #ff9900;
	color: white;
	text-align: center;
	text-decoration: none;
	border-radius: 6px;
	font-weight: 600;
	font-size: 0.9375rem;
	transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
	border: none;
	cursor: pointer;
	box-shadow: 0 2px 4px rgba(255, 153, 0, 0.3);
}

.ace-cta-button:hover {
	background: #e68900;
	color: white;
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(255, 153, 0, 0.4);
}

.ace-cta-button:active {
	transform: translateY(0);
}

/* ============================================
   CONTENT (Gutenberg Blocks)
   ============================================ */

.ace-category-content {
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 2px solid #e9ecef;
}

.ace-category-content > * {
	margin-bottom: 1.5rem;
}

.ace-category-content > *:last-child {
	margin-bottom: 0;
}

/* Trust Block, Buying Guide, FAQ */
.ace-trust-block,
.ace-buying-guide {
	background: #f8f9fa;
	border-left: 4px solid #007bff;
	padding: 2rem;
	margin: 2rem 0;
	border-radius: 6px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.ace-trust-title,
.ace-buying-guide-title {
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 1rem;
	color: #212529;
}

.ace-internal-links {
	margin: 2rem 0;
}

.ace-internal-links-title {
	font-size: 1.25rem;
	font-weight: 700;
	margin-bottom: 1rem;
	color: #212529;
}

.ace-internal-links-list {
	list-style: none;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0.75rem;
}

.ace-internal-links-list li a {
	color: #007bff;
	text-decoration: none;
	padding: 0.5rem;
	display: block;
	border-radius: 4px;
	transition: background 0.2s, color 0.2s;
}

.ace-internal-links-list li a:hover {
	background: #f8f9fa;
	color: #0056b3;
	text-decoration: underline;
}

.ace-faq {
	margin: 2rem 0;
}

.ace-faq-title {
	font-size: 1.5rem;
	font-weight: 700;
	margin-bottom: 1.5rem;
	color: #212529;
}

.ace-faq-list {
	margin: 0;
}

.ace-faq-question {
	font-weight: 700;
	font-size: 1.125rem;
	margin-top: 1.5rem;
	margin-bottom: 0.5rem;
	color: #212529;
}

.ace-faq-answer {
	margin-bottom: 1rem;
	color: #495057;
	line-height: 1.7;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.ace-loading {
	text-align: center;
	padding: 3rem;
	color: #6c757d;
	font-size: 1.125rem;
}

.ace-no-products {
	padding: 3rem;
	text-align: center;
	color: #6c757d;
	background: #f8f9fa;
	border-radius: 8px;
	border: 1px solid #e9ecef;
}

.ace-no-products p {
	margin: 0;
	font-size: 1.125rem;
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */

@media (min-width: 768px) {
	.ace-category-page {
		max-width: 1200px;
		padding: 2rem;
	}

	.ace-category-title {
		font-size: 2.5rem;
	}

	.ace-products-wrapper {
		grid-template-columns: 280px 1fr;
		gap: 2rem;
	}

	.ace-products-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 1.75rem;
	}

	.ace-product-image {
		height: 240px;
	}

	.ace-sidebar {
		padding: 1.75rem;
	}
}

/* ============================================
   RESPONSIVE - DESKTOP
   ============================================ */

@media (min-width: 1024px) {
	.ace-category-page {
		padding: 2.5rem;
	}

	.ace-category-title {
		font-size: 3rem;
	}

	.ace-products-wrapper {
		grid-template-columns: 320px 1fr;
		gap: 3rem;
	}

	.ace-products-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 2rem;
	}

	.ace-product-image {
		height: 260px;
	}
}

/* ============================================
   INTERNAL LINKING CHIPS
   ============================================ */

.ace-internal-links-section {
	margin-top: 4rem;
	padding-top: 2.5rem;
	border-top: 2px solid #e9ecef;
}

.ace-internal-links-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.875rem;
	align-items: center;
	justify-content: flex-start;
}

.ace-internal-link-chip {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.75rem 1.5rem;
	background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
	border: 2px solid #e0e0e0;
	border-radius: 25px;
	color: #2c3e50;
	text-decoration: none;
	font-size: 0.9375rem;
	font-weight: 600;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	line-height: 1.4;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
	position: relative;
	overflow: hidden;
	white-space: nowrap;
}

.ace-internal-link-chip::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
	transition: left 0.5s;
}

.ace-internal-link-chip:hover {
	background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
	border-color: #007bff;
	color: #ffffff;
	text-decoration: none;
	transform: translateY(-3px) scale(1.02);
	box-shadow: 0 8px 16px rgba(0, 123, 255, 0.3);
}

.ace-internal-link-chip:hover::before {
	left: 100%;
}

.ace-internal-link-chip:active {
	transform: translateY(-1px) scale(1);
	box-shadow: 0 4px 8px rgba(0, 123, 255, 0.25);
}

.ace-internal-link-chip:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* Responsive adjustments for chips */
@media (max-width: 767px) {
	.ace-internal-links-section {
		margin-top: 3rem;
		padding-top: 2rem;
	}

	.ace-internal-links-chips {
		gap: 0.625rem;
	}

	.ace-internal-link-chip {
		padding: 0.625rem 1.25rem;
		font-size: 0.875rem;
		border-radius: 20px;
	}
}

/* ============================================
   RESPONSIVE - LARGE DESKTOP
   ============================================ */

@media (min-width: 1440px) {
	.ace-category-page {
		max-width: 1400px;
	}

	.ace-products-grid {
		grid-template-columns: repeat(4, 1fr);
	}

	.ace-product-image {
		height: 280px;
	}
}
