/**
 * Afoomart Shop & Category Architecture Stylesheet
 *
 * Implements Chapter 06: Product Discovery UI
 * - Shop & Category Hero Header
 * - Subcategory Navigation Rail
 * - Product Discovery Toolbar
 * - Active Filter Chips
 * - Desktop Filter Sidebar & Category Tree
 * - Grid & List View Layouts
 * - Touch-Optimized Mobile Filter Drawer
 * - Pagination & Empty States
 *
 * @package Afoomart
 */

/* ==========================================================================
   1. SHOP ARCHIVE CONTAINER & LAYOUT
   ========================================================================== */

.af-shop-archive-container {
	padding-top: var(--af-space-4, 16px);
	padding-bottom: var(--af-space-12, 48px);
}

.af-shop-marketplace-layout {
	display: grid;
	grid-template-columns: 270px 1fr;
	gap: var(--af-space-6, 24px);
	align-items: start;
}

@media (max-width: 1023px) {
	.af-shop-marketplace-layout {
		grid-template-columns: 1fr;
	}
	.af-shop-sidebar-column {
		display: none;
	}
}

/* ==========================================================================
   2. SHOP / CATEGORY HERO CARD
   ========================================================================== */

.af-shop-hero-card {
	position: relative;
	background: var(--af-color-surface, #ffffff);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-lg, 12px);
	padding: var(--af-space-6, 24px) var(--af-space-8, 32px);
	overflow: hidden;
	box-shadow: var(--af-shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.af-shop-hero-card.af-has-hero-bg {
	color: #ffffff;
	background-color: var(--af-color-primary, #113F6D);
	border-color: transparent;
}

.af-shop-hero-bg-media {
	position: absolute;
	inset: 0;
	z-index: 1;
	overflow: hidden;
}

.af-shop-hero-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.af-shop-hero-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, rgba(17, 63, 109, 0.92) 0%, rgba(17, 63, 109, 0.65) 100%);
}

.af-shop-hero-content {
	position: relative;
	z-index: 2;
	max-width: 760px;
}

.af-shop-hero-meta {
	display: flex;
	align-items: center;
	gap: var(--af-space-3, 12px);
	flex-wrap: wrap;
	margin-bottom: var(--af-space-2, 8px);
}

.af-shop-hero-title {
	font-family: var(--af-font-primary, system-ui, sans-serif);
	font-size: var(--af-font-size-2xl, 24px);
	font-weight: 700;
	line-height: 1.25;
	margin: 0;
	color: inherit;
}

.af-shop-hero-badge {
	font-size: var(--af-font-size-xs, 12px);
	font-weight: 600;
	padding: 4px 10px;
	border-radius: var(--af-radius-full, 9999px);
}

.af-shop-hero-desc p {
	font-size: var(--af-font-size-sm, 14px);
	line-height: 1.5;
	margin: 0;
	color: inherit;
	opacity: 0.88;
}

@media (max-width: 767px) {
	.af-shop-hero-card {
		padding: var(--af-space-4, 16px);
	}
	.af-shop-hero-title {
		font-size: var(--af-font-size-xl, 20px);
	}
}

/* ==========================================================================
   3. SUBCATEGORY NAVIGATION RAIL
   ========================================================================== */

.af-subcategory-rail-section {
	background: var(--af-color-surface, #ffffff);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-md, 8px);
	padding: var(--af-space-3, 12px) var(--af-space-4, 16px);
}

.af-subcategory-rail-header {
	margin-bottom: var(--af-space-2, 8px);
}

.af-subcategory-rail-label {
	font-size: var(--af-font-size-xs, 12px);
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--af-color-text-muted, #6b7280);
}

.af-subcategory-rail-track {
	display: flex;
	gap: var(--af-space-2, 8px);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	padding-bottom: 4px;
}

.af-subcategory-rail-track::-webkit-scrollbar {
	height: 4px;
}

.af-subcategory-rail-track::-webkit-scrollbar-thumb {
	background: var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-full, 9999px);
}

.af-subcat-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--af-space-2, 8px);
	padding: 6px 14px;
	background: var(--af-color-bg, #f8fafc);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-full, 9999px);
	font-size: var(--af-font-size-sm, 14px);
	font-weight: 500;
	color: var(--af-color-text, #1e293b);
	text-decoration: none;
	white-space: nowrap;
	scroll-snap-align: start;
	transition: all 0.2s ease;
}

.af-subcat-chip:hover {
	background: #ffffff;
	border-color: var(--af-color-primary, #113F6D);
	color: var(--af-color-primary, #113F6D);
	box-shadow: var(--af-shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.af-subcat-chip.af-active {
	background: var(--af-color-primary, #113F6D);
	border-color: var(--af-color-primary, #113F6D);
	color: #ffffff;
}

.af-subcat-chip-thumb img {
	width: 20px;
	height: 20px;
	border-radius: var(--af-radius-full, 9999px);
	object-fit: cover;
	display: block;
}

.af-subcat-chip-icon {
	display: flex;
	align-items: center;
	color: inherit;
}

.af-subcat-chip-count {
	font-size: var(--af-font-size-xs, 12px);
	opacity: 0.7;
}

/* ==========================================================================
   4. ACTIVE FILTERS CHIPS BAR
   ========================================================================== */

.af-active-filters-bar {
	display: flex;
	align-items: center;
	gap: var(--af-space-3, 12px);
	flex-wrap: wrap;
	padding: var(--af-space-3, 12px) var(--af-space-4, 16px);
	background: #f1f5f9;
	border-radius: var(--af-radius-md, 8px);
}

.af-active-filters-label {
	font-size: var(--af-font-size-xs, 12px);
	font-weight: 600;
	text-transform: uppercase;
	color: var(--af-color-text-muted, #6b7280);
}

.af-active-filters-list {
	display: flex;
	align-items: center;
	gap: var(--af-space-2, 8px);
	flex-wrap: wrap;
}

.af-filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: var(--af-radius-full, 9999px);
	font-size: var(--af-font-size-xs, 12px);
	font-weight: 500;
	color: var(--af-color-text, #1e293b);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.af-filter-chip-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border-radius: var(--af-radius-full, 9999px);
	color: var(--af-color-text-muted, #6b7280);
	text-decoration: none;
	transition: background 0.15s, color 0.15s;
}

.af-filter-chip-remove:hover {
	background: var(--af-color-danger, #DE2C27);
	color: #ffffff;
}

.af-clear-all-filters-btn {
	font-size: var(--af-font-size-xs, 12px);
	font-weight: 600;
	color: var(--af-color-danger, #DE2C27);
	text-decoration: underline;
	cursor: pointer;
	padding: 4px 6px;
}

.af-clear-all-filters-btn:hover {
	color: #b91c1c;
}

/* ==========================================================================
   5. PRODUCT DISCOVERY TOOLBAR
   ========================================================================== */

.af-shop-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--af-space-4, 16px);
	padding: var(--af-space-3, 12px) var(--af-space-4, 16px);
	background: var(--af-color-surface, #ffffff);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-md, 8px);
	box-shadow: var(--af-shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.05));
}

.af-shop-result-count {
	font-size: var(--af-font-size-sm, 14px);
	color: var(--af-color-text-muted, #6b7280);
	margin: 0;
}

.af-shop-toolbar-right {
	display: flex;
	align-items: center;
	gap: var(--af-space-3, 12px);
}

.af-sorting-select-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: var(--af-space-2, 8px);
}

.af-sorting-label {
	font-size: var(--af-font-size-sm, 14px);
	color: var(--af-color-text-muted, #6b7280);
}

.af-sorting-select {
	appearance: none;
	-webkit-appearance: none;
	background: var(--af-color-bg, #f8fafc);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-md, 8px);
	padding: 6px 30px 6px 12px;
	font-size: var(--af-font-size-sm, 14px);
	font-weight: 500;
	color: var(--af-color-text, #1e293b);
	cursor: pointer;
	outline: none;
	transition: border-color 0.2s;
}

.af-sorting-select:focus {
	border-color: var(--af-color-primary, #113F6D);
	box-shadow: 0 0 0 3px rgba(17, 63, 109, 0.1);
}

.af-sorting-arrow {
	position: absolute;
	right: 10px;
	pointer-events: none;
	color: var(--af-color-text-muted, #6b7280);
}

.af-view-switcher {
	display: inline-flex;
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-md, 8px);
	overflow: hidden;
}

.af-view-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	background: var(--af-color-surface, #ffffff);
	border: none;
	color: var(--af-color-text-muted, #6b7280);
	cursor: pointer;
	transition: all 0.2s;
}

.af-view-btn:hover {
	color: var(--af-color-primary, #113F6D);
}

.af-view-btn.af-active {
	background: var(--af-color-primary, #113F6D);
	color: #ffffff;
}

.af-mobile-filter-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	position: relative;
}

.af-filter-count-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: var(--af-radius-full, 9999px);
	background: var(--af-color-danger, #DE2C27);
	color: #ffffff;
	font-size: 10px;
	font-weight: 700;
}

/* ==========================================================================
   6. DESKTOP FILTER SIDEBAR
   ========================================================================== */

.af-shop-sidebar {
	position: sticky;
	top: 90px;
	display: flex;
	flex-direction: column;
	gap: var(--af-space-4, 16px);
}

.af-filter-widget {
	background: var(--af-color-surface, #ffffff);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-md, 8px);
	overflow: hidden;
	box-shadow: var(--af-shadow-xs, 0 1px 2px rgba(0, 0, 0, 0.04));
}

.af-filter-widget-title {
	font-size: var(--af-font-size-sm, 14px);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--af-color-text, #1e293b);
	margin: 0;
	padding: var(--af-space-3, 12px) var(--af-space-4, 16px);
	background: var(--af-color-bg, #f8fafc);
	border-bottom: 1px solid var(--af-color-border, #e5e7eb);
}

.af-filter-widget-content {
	padding: var(--af-space-3, 12px) var(--af-space-4, 16px);
}

/* Category Tree */
.af-cat-tree-list,
.af-cat-sub-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.af-cat-tree-item {
	margin-bottom: 6px;
}

.af-cat-tree-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--af-space-2, 8px);
}

.af-cat-tree-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-grow: 1;
	font-size: var(--af-font-size-sm, 14px);
	color: var(--af-color-text, #334155);
	text-decoration: none;
	padding: 4px 6px;
	border-radius: var(--af-radius-sm, 4px);
	transition: background 0.15s, color 0.15s;
}

.af-cat-tree-link:hover {
	background: var(--af-color-bg, #f8fafc);
	color: var(--af-color-primary, #113F6D);
}

.af-cat-current > .af-cat-tree-row > .af-cat-tree-link,
.af-cat-current > .af-cat-sub-link {
	font-weight: 700;
	color: var(--af-color-primary, #113F6D);
	background: rgba(17, 63, 109, 0.08);
}

.af-cat-tree-count {
	font-size: 11px;
	color: var(--af-color-text-muted, #6b7280);
	font-weight: 500;
}

.af-cat-toggle-btn {
	background: transparent;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: var(--af-color-text-muted, #6b7280);
	transition: transform 0.2s;
}

.af-cat-expanded .af-cat-toggle-btn svg {
	transform: rotate(180deg);
}

.af-cat-sub-list {
	padding-left: var(--af-space-4, 16px);
	margin-top: 4px;
	display: none;
}

.af-cat-expanded .af-cat-sub-list {
	display: block;
}

.af-cat-sub-link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: var(--af-font-size-xs, 12px);
	color: var(--af-color-text-muted, #64748b);
	text-decoration: none;
	padding: 3px 6px;
	border-radius: var(--af-radius-sm, 4px);
	transition: color 0.15s;
}

.af-cat-sub-link:hover {
	color: var(--af-color-primary, #113F6D);
}

/* Price Filter */
.af-price-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.af-price-preset-chip {
	font-size: 11px;
	font-weight: 500;
	background: var(--af-color-bg, #f8fafc);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-full, 9999px);
	padding: 3px 8px;
	color: var(--af-color-text, #334155);
	cursor: pointer;
	transition: all 0.15s;
}

.af-price-preset-chip:hover {
	border-color: var(--af-color-primary, #113F6D);
	color: var(--af-color-primary, #113F6D);
}

.af-price-inputs-row {
	display: flex;
	align-items: center;
	gap: var(--af-space-2, 8px);
}

.af-price-input-group {
	position: relative;
	flex: 1;
}

.af-currency-prefix {
	position: absolute;
	left: 8px;
	top: 50%;
	transform: translateY(-50%);
	font-size: var(--af-font-size-xs, 12px);
	font-weight: 600;
	color: var(--af-color-text-muted, #6b7280);
	pointer-events: none;
}

.af-price-input {
	width: 100%;
	padding: 6px 8px 6px 20px;
	border: 1px solid var(--af-color-border, #cbd5e1);
	border-radius: var(--af-radius-sm, 4px);
	font-size: var(--af-font-size-sm, 14px);
	outline: none;
	transition: border-color 0.2s;
}

.af-price-input:focus {
	border-color: var(--af-color-primary, #113F6D);
	box-shadow: 0 0 0 2px rgba(17, 63, 109, 0.15);
}

.af-price-separator {
	color: var(--af-color-text-muted, #6b7280);
}

/* Checkbox & Radio Labels */
.af-filter-checkbox-label,
.af-filter-radio-label {
	display: flex;
	align-items: center;
	gap: var(--af-space-2, 8px);
	font-size: var(--af-font-size-sm, 14px);
	color: var(--af-color-text, #334155);
	cursor: pointer;
	margin-bottom: 8px;
}

.af-filter-checkbox-label:last-child,
.af-filter-radio-label:last-child {
	margin-bottom: 0;
}

.af-filter-checkbox,
.af-filter-radio {
	accent-color: var(--af-color-primary, #113F6D);
	width: 16px;
	height: 16px;
	cursor: pointer;
}

.af-rating-stars-preview {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	color: #f59e0b;
}

.af-rating-text-label {
	font-size: var(--af-font-size-xs, 12px);
	color: var(--af-color-text-muted, #6b7280);
}

.af-attr-term-count {
	font-size: 11px;
	color: var(--af-color-text-muted, #6b7280);
	margin-left: auto;
}

/* ==========================================================================
   7. PRODUCTS CATALOG GRID & LIST VIEWS
   ========================================================================== */

.af-products-catalog-wrapper {
	position: relative;
	min-height: 300px;
}

/* Default Grid View */
.af-products-grid-view {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--af-space-4, 16px);
}

@media (min-width: 1440px) {
	.af-products-grid-view {
		grid-template-columns: repeat(4, 1fr);
		gap: var(--af-space-5, 20px);
	}
}

@media (max-width: 1279px) and (min-width: 768px) {
	.af-products-grid-view {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 767px) {
	.af-products-grid-view {
		grid-template-columns: repeat(2, 1fr);
		gap: var(--af-space-3, 12px);
	}
}

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

/* List View */
.af-products-list-view {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--af-space-4, 16px);
}

.af-products-list-view .af-loop-product-item .af-product-card {
	display: grid;
	grid-template-columns: 200px 1fr auto;
	gap: var(--af-space-5, 20px);
	align-items: center;
	height: auto;
	padding: var(--af-space-4, 16px);
}

@media (max-width: 767px) {
	.af-products-list-view .af-loop-product-item .af-product-card {
		grid-template-columns: 110px 1fr;
		gap: var(--af-space-3, 12px);
		padding: var(--af-space-3, 12px);
	}
}

/* ==========================================================================
   8. MOBILE FILTER DRAWER (< 1024px)
   ========================================================================== */

.af-mobile-filter-drawer-wrapper {
	position: fixed;
	inset: 0;
	z-index: 9999;
	visibility: hidden;
	opacity: 0;
	transition: visibility 0.3s ease, opacity 0.3s ease;
}

.af-mobile-filter-drawer-wrapper.af-drawer-open {
	visibility: visible;
	opacity: 1;
}

.af-mobile-filter-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.6);
	backdrop-filter: blur(2px);
}

.af-mobile-filter-drawer {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 85vh;
	background: var(--af-color-surface, #ffffff);
	border-top-left-radius: var(--af-radius-xl, 16px);
	border-top-right-radius: var(--af-radius-xl, 16px);
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}

.af-mobile-filter-drawer-wrapper.af-drawer-open .af-mobile-filter-drawer {
	transform: translateY(0);
}

.af-mobile-filter-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--af-space-4, 16px) var(--af-space-5, 20px);
	border-bottom: 1px solid var(--af-color-border, #e5e7eb);
}

.af-mobile-filter-header-title {
	display: flex;
	align-items: center;
	gap: var(--af-space-2, 8px);
}

.af-mobile-filter-heading {
	font-size: var(--af-font-size-lg, 18px);
	font-weight: 700;
	margin: 0;
	color: var(--af-color-text, #1e293b);
}

.af-mobile-filter-close-btn {
	background: var(--af-color-bg, #f1f5f9);
	border: none;
	width: 32px;
	height: 32px;
	border-radius: var(--af-radius-full, 9999px);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--af-color-text-muted, #64748b);
	cursor: pointer;
}

.af-mobile-filter-form {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	height: 100%;
}

.af-mobile-filter-body {
	flex-grow: 1;
	overflow-y: auto;
	padding: var(--af-space-4, 16px) var(--af-space-5, 20px);
	-webkit-overflow-scrolling: touch;
}

.af-mobile-filter-group {
	padding-bottom: var(--af-space-4, 16px);
	margin-bottom: var(--af-space-4, 16px);
	border-bottom: 1px solid var(--af-color-border, #f1f5f9);
}

.af-mobile-filter-group-title {
	font-size: var(--af-font-size-sm, 14px);
	font-weight: 700;
	color: var(--af-color-text, #1e293b);
	margin-bottom: var(--af-space-2, 8px);
}

.af-mobile-cat-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.af-mobile-cat-link {
	display: inline-block;
	font-size: 13px;
	background: var(--af-color-bg, #f8fafc);
	border: 1px solid var(--af-color-border, #e2e8f0);
	border-radius: var(--af-radius-full, 9999px);
	padding: 4px 12px;
	color: var(--af-color-text, #334155);
	text-decoration: none;
}

.af-mobile-cat-link.af-active {
	background: var(--af-color-primary, #113F6D);
	border-color: var(--af-color-primary, #113F6D);
	color: #ffffff;
}

.af-mobile-filter-footer {
	display: flex;
	align-items: center;
	gap: var(--af-space-3, 12px);
	padding: var(--af-space-3, 12px) var(--af-space-5, 20px);
	border-top: 1px solid var(--af-color-border, #e5e7eb);
	background: var(--af-color-surface, #ffffff);
}

.af-mobile-clear-btn {
	flex: 1;
}

.af-mobile-apply-btn {
	flex: 2;
}

/* ==========================================================================
   9. EMPTY STATE WRAPPER
   ========================================================================== */

.af-shop-empty-state-wrapper {
	background: var(--af-color-surface, #ffffff);
	border: 1px solid var(--af-color-border, #e5e7eb);
	border-radius: var(--af-radius-lg, 12px);
	padding: var(--af-space-8, 32px) var(--af-space-6, 24px);
	text-align: center;
}
