/**
 * Pelagia Book Store — Shop Archive CSS
 */

/* ── Layout ──────────────────────────────────────── */
.shop-page {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-8);
	align-items: flex-start;
	padding-top: var(--space-6);
	padding-bottom: var(--space-12);
}

.shop-sidebar {
	flex: 0 0 20%;
	max-width: 20%;
	position: sticky;
	top: 100px; /* Below sticky header */
}

.shop-content {
	flex: 1;
	min-width: 0;
}

/* ── Sidebar Filters ─────────────────────────────── */
.shop-sidebar__search {
	margin-bottom: var(--space-6);
	position: relative;
}

.shop-sidebar__search input[type="search"] {
	width: 100%;
	padding: 0.75rem 1rem 0.75rem 2.5rem;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	font-family: var(--font-family);
	font-size: var(--text-sm);
	transition: border-color var(--transition-fast);
}

.shop-sidebar__search input[type="search"]:focus {
	outline: none;
	border-color: var(--color-primary);
}

.shop-sidebar__search svg {
	position: absolute;
	left: 0.75rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--color-muted);
}

.shop-sidebar__group {
	margin-bottom: var(--space-6);
}

.shop-sidebar__title {
	font-size: var(--text-base); /* Increased from xs */
	font-weight: var(--font-weight-bold);
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--color-dark);
	margin-bottom: var(--space-3);
}

.shop-sidebar__list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.shop-sidebar__list li {
	margin-bottom: var(--space-2);
}

.shop-sidebar__list a {
	color: var(--color-body);
	text-decoration: none;
	font-size: var(--text-base); /* Increased from sm */
	transition: color var(--transition-fast);
	display: inline-block;
}

.shop-sidebar__list a:hover,
.shop-sidebar__list li.current-cat > a {
	color: var(--color-primary);
	font-weight: var(--font-weight-medium);
}

/* ── Tabs ────────────────────────────────────────── */
.shop-tabs {
	display: flex;
	gap: var(--space-6);
	margin-bottom: var(--space-6);
	border-bottom: 1px solid var(--color-border);
}

.shop-tab {
	padding: 0 0 var(--space-2);
	margin-bottom: -1px;
	font-size: var(--text-md);
	font-weight: var(--font-weight-medium);
	color: var(--color-muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	transition: all var(--transition-fast);
}

.shop-tab:hover {
	color: var(--color-dark);
}

.shop-tab.is-active {
	color: var(--color-primary);
	border-bottom-color: var(--color-primary);
	font-weight: var(--font-weight-bold);
}

/* ── Toolbar ─────────────────────────────────────── */
.shop-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: var(--space-6);
}

.shop-toolbar__count {
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.shop-toolbar__actions {
	display: flex;
	align-items: center;
	gap: var(--space-4);
}

.shop-view-toggle {
	display: flex;
	gap: var(--space-2);
}

.shop-view-btn {
	background: none;
	border: none;
	padding: var(--space-1);
	color: var(--color-muted);
	cursor: pointer;
	border-radius: var(--radius-sm);
	transition: all var(--transition-fast);
}

.shop-view-btn:hover,
.shop-view-btn.is-active {
	color: var(--color-primary);
	background: var(--color-bg-light);
}

/* ── Grid Layout ─────────────────────────────────── */
.shop-grid {
	display: grid;
	gap: 32px 16px; /* 32px vertical, 16px horizontal */
	grid-template-columns: repeat(5, 1fr); /* 5 columns on large desktop */
	margin: 0 !important;
	padding: 0 !important;
	list-style: none !important;
}

.shop-grid__item {
	min-width: 0;
}

.shop-grid.shop-grid--list-view {
	grid-template-columns: 1fr;
	gap: 12px; /* Tighter gap for list view */
}

/* ── Card Visibility Toggles ── */
.shop-card-list {
	display: none; /* Hidden in Grid View */
}

.shop-grid--list-view .product-card {
	display: none !important; /* Hide Grid card in List View */
}

.shop-grid--list-view .shop-card-list {
	display: flex; /* Show List card in List View */
}



/* ── 2. List View Card ───────────────────────────── */
.shop-card-list {
	background: var(--color-white);
	border-radius: var(--radius-md);
	overflow: hidden;
	/* display: flex; REMOVED! Controlled by visibility toggle now */
	align-items: stretch;
	gap: var(--space-4);
	padding: var(--space-4);
	border: 1px solid var(--color-border);
}

.shop-card-list__image-wrap {
	flex: 0 0 80px;
	height: auto;
	min-height: 100px;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: var(--radius-sm);
	overflow: hidden;
	padding: var(--space-2);
	position: relative;
}

.shop-card-list__badge {
	position: absolute;
	top: 4px;
	right: 4px;
	color: var(--color-white);
	font-size: 8px;
	font-weight: var(--font-weight-bold);
	text-transform: uppercase;
	padding: 2px 6px;
	border-radius: var(--radius-full);
	z-index: 2;
	background-color: #022062; /* Default (e.g. Best Seller) */
}
.shop-card-list__badge--sale {
	background-color: var(--color-primary);
}
.shop-card-list__badge--bestseller {
	background: #022062; /* Dark navy updated */
}

.shop-card-list__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.shop-card-list__body {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-4);
}

.shop-card-list__meta {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.shop-card-list__title {
	font-size: 14px;
	font-weight: 800;
	margin: 0 0 4px 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-transform: uppercase;
}

.shop-card-list__title a {
	color: var(--color-dark);
	text-decoration: none;
}
.shop-card-list__title a:hover {
	color: var(--color-primary);
}

.shop-card-list__author {
	font-size: 12px;
	color: var(--color-muted);
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.shop-card-list__author a { color: inherit; text-decoration: none; }
.shop-card-list__author a:hover { color: var(--color-primary); }
.shop-card-list__author .by { font-style: italic; margin-right: 2px; }

.shop-card-list__right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
	gap: var(--space-2);
}

.shop-card-list__price {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
}

.shop-card-list__price del {
	color: var(--color-muted);
	font-size: 11px;
	font-weight: normal;
	text-decoration: line-through;
}

.shop-card-list__price ins,
.shop-card-list__price > span.woocommerce-Price-amount {
	font-weight: 800;
	color: var(--color-primary); /* Terracotta highlight */
	font-size: 16px;
	text-decoration: none;
}

.shop-card-list__actions {
	flex: 0 0 auto;
}

.shop-card-list__add {
	background: transparent;
	color: var(--color-primary);
	border: 2px solid var(--color-primary);
	border-radius: var(--radius-sm);
	padding: 6px 12px;
	font-size: 11px;
	font-weight: var(--font-weight-bold);
	text-transform: uppercase;
	cursor: pointer;
	text-decoration: none;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background var(--transition-fast), color var(--transition-fast);
}

.shop-card-list__add:hover {
	background: var(--color-primary);
	color: var(--color-white);
}

/* ── Mobile Sidebar Toggle ───────────────────────── */
.shop-sidebar-toggle {
	display: none;
	background: var(--color-dark);
	color: var(--color-white);
	border: none;
	padding: var(--space-2) var(--space-4);
	border-radius: var(--radius-sm);
	font-weight: var(--font-weight-bold);
	text-transform: uppercase;
	font-size: var(--text-xs);
	margin-bottom: var(--space-4);
	cursor: pointer;
	width: 100%;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1280px) {
	.shop-grid {
		grid-template-columns: repeat(4, 1fr);
		gap: 28px 16px;
	}
}

@media (max-width: 1024px) {
	.shop-sidebar {
		flex: 0 0 30%;
		max-width: 30%;
	}
	.shop-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 24px 12px;
	}
}

@media (max-width: 767px) {
	.shop-sidebar-toggle {
		display: block;
	}
	.shop-sidebar {
		display: none;
		flex: 100%;
		max-width: 100%;
		position: static;
		margin-bottom: var(--space-6);
	}
	.shop-sidebar.is-open {
		display: block;
	}
	.shop-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 20px 12px;
	}

	/* Fix Toolbar visibility on mobile */
	.shop-toolbar {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-4);
	}
	
	.shop-toolbar__actions {
		width: 100%;
		justify-content: space-between;
	}
	
	.shop-view-btn {
		padding: var(--space-2);
		border: 1px solid var(--color-border);
		border-radius: var(--radius-md);
	}
	
	.shop-view-btn svg {
		width: 22px;
		height: 22px;
	}

	/* Adjust list view for mobile to stack elements */
	.shop-card-list__body {
		flex-direction: column;
		align-items: flex-start;
		gap: var(--space-2);
	}
}

@media (max-width: 480px) {
	.shop-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px 8px;
	}
}
