/**
 * WooCommerce Category Explorer Styles
 */

.wce-widget-wrapper {
	--wce-primary-color: #3f2a56;
	--wce-border-color: #e2e8f0;
	--wce-border-radius: 8px;
	--wce-transition: all 0.3s ease;

	font-family: inherit;
	display: flex;
	flex-direction: column;
	gap: 30px;
}

/* Search Bar */
.wce-search-wrapper {
	position: relative;
	width: 100%;
}

.wce-search-input {
	width: 100%;
	padding: 15px 45px 15px 20px;
	border: 1px solid var(--wce-border-color);
	border-radius: var(--wce-border-radius);
	font-size: 16px;
	outline: none;
	transition: var(--wce-transition);
}

.wce-search-input:focus {
	border-color: var(--wce-primary-color);
	box-shadow: 0 0 0 3px rgba(63, 42, 86, 0.1);
}

.wce-search-icon {
	position: absolute;
	right: 20px;
	top: 50%;
	transform: translateY(-50%);
	color: #94a3b8;
}

.wce-search-loading {
	position: absolute;
	right: 45px;
	top: 50%;
	transform: translateY(-50%);
	width: 16px;
	height: 16px;
	border: 2px solid #e2e8f0;
	border-top-color: var(--wce-primary-color);
	border-radius: 50%;
	animation: wce-spin 1s linear infinite;
}

.wce-search-results {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: #fff;
	border: 1px solid var(--wce-border-color);
	border-radius: var(--wce-border-radius);
	margin-top: 5px;
	box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
	z-index: 10;
	max-height: 300px;
	overflow-y: auto;
}

.wce-search-results-item {
	display: flex;
	align-items: center;
	padding: 10px 15px;
	text-decoration: none;
	color: inherit;
	border-bottom: 1px solid var(--wce-border-color);
	transition: var(--wce-transition);
}

.wce-search-results-item:last-child {
	border-bottom: none;
}

.wce-search-results-item:hover {
	background-color: #f8fafc;
}

.wce-search-results-img {
	width: 30px;
	height: 30px;
	object-fit: cover;
	border-radius: 4px;
	margin-right: 15px;
}

.wce-search-results-empty {
	padding: 15px;
	color: #64748b;
	text-align: center;
}

/* Main Layout */
.wce-main-layout {
	display: flex;
	align-items: flex-start;
	gap: 30px;
}

/* Sidebar */
.wce-sidebar {
	width: 250px;
	flex-shrink: 0;
}

.wce-sidebar-list {
	list-style: none;
	padding: 0;
	margin: 0;
}

.wce-sidebar-item {
	display: flex;
	align-items: center;
	padding: 12px 15px;
	margin-bottom: 5px;
	border-radius: var(--wce-border-radius);
	cursor: pointer;
	transition: var(--wce-transition);
	color: #475569;
}

.wce-sidebar-item:hover {
	background-color: #f1f5f9;
}

.wce-sidebar-item.active {
	background-color: #f8f1ff;
	color: var(--wce-primary-color);
	font-weight: 600;
}

.wce-sidebar-img {
	width: 24px;
	height: 24px;
	object-fit: cover;
	border-radius: 4px;
	margin-right: 12px;
}

.wce-sidebar-item-name {
	flex-grow: 1;
}

.wce-sidebar-item-count {
	font-size: 0.85em;
	color: #94a3b8;
	margin-left: 8px;
}

/* Grid Area */
.wce-grid-area {
	flex-grow: 1;
	min-width: 0;
}

.wce-breadcrumbs {
	margin-bottom: 20px;
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: #64748b;
}

.wce-back-btn {
	background: none;
	border: none;
	padding: 0;
	color: var(--wce-primary-color);
	cursor: pointer;
	font-weight: 500;
	display: inline-flex;
	align-items: center;
}

.wce-back-btn::before {
	content: "\f104"; /* FontAwesome angle-left */
	font-family: "Font Awesome 5 Free", "FontAwesome";
	font-weight: 900;
	margin-right: 5px;
}

.wce-back-btn:hover {
	text-decoration: underline;
}

.wce-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 20px;
}

/* Category Card */
.wce-card {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--wce-border-color);
	border-radius: var(--wce-border-radius);
	overflow: hidden;
	text-decoration: none;
	color: inherit;
	transition: var(--wce-transition);
	background-color: #fff;
	height: 100%;
}

.wce-card:hover {
	border-color: #cbd5e1;
	box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
	transform: translateY(-2px);
}

.wce-card-image {
	width: 100%;
	aspect-ratio: 4/3;
	overflow: hidden;
	background-color: #f8fafc;
}

.wce-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

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

.wce-card-content {
	padding: 15px;
	text-align: center;
	flex-grow: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.wce-card-title {
	margin: 0 0 5px 0;
	font-size: 16px;
	font-weight: 600;
	color: #334155;
}

.wce-card-count {
	font-size: 13px;
	color: #94a3b8;
}

.wce-grid-loading {
	display: none !important;
}

/* Skeleton Loader */
.wce-skeleton-card {
	pointer-events: none;
}

.wce-skeleton-card:hover {
	border-color: var(--wce-border-color) !important;
	box-shadow: none !important;
	transform: none !important;
}

.wce-skeleton-image,
.wce-skeleton-title,
.wce-skeleton-count {
	background: #e2e8f0;
	position: relative;
	overflow: hidden;
}

.wce-skeleton-image::after,
.wce-skeleton-title::after,
.wce-skeleton-count::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	transform: translateX(-100%);
	background-image: linear-gradient(
		90deg,
		rgba(255, 255, 255, 0) 0,
		rgba(255, 255, 255, 0.4) 20%,
		rgba(255, 255, 255, 0.4) 60%,
		rgba(255, 255, 255, 0)
	);
	animation: wce-shimmer 1.5s infinite;
}

@keyframes wce-shimmer {
	100% {
		transform: translateX(100%);
	}
}

.wce-skeleton-image {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
}

.wce-skeleton-card .wce-card-image {
	position: relative;
}

.wce-skeleton-title {
	height: 16px;
	width: 70%;
	margin: 0 auto 10px auto;
	border-radius: 4px;
}

.wce-skeleton-count {
	height: 12px;
	width: 40%;
	margin: 0 auto;
	border-radius: 4px;
}

/* Recently Viewed */
.wce-recent-wrapper {
	margin-top: 20px;
	padding-top: 30px;
	border-top: 1px solid var(--wce-border-color);
}

.wce-recent-heading {
	margin-top: 0;
	margin-bottom: 20px;
	font-size: 20px;
}

/* Animations */
@keyframes wce-spin {
	to { transform: translateY(-50%) rotate(360deg); }
}

.wce-fade-in {
	animation: wce-fade-in 0.3s ease-in;
}

@keyframes wce-fade-in {
	from { opacity: 0; transform: translateY(10px); }
	to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
	.wce-main-layout {
		flex-direction: column;
	}
	.wce-sidebar {
		width: 100% !important;
	}
	.wce-sidebar-list {
		display: flex;
		overflow-x: auto;
		padding-bottom: 10px;
	}
	.wce-sidebar-item {
		flex-shrink: 0;
		margin-right: 10px;
		margin-bottom: 0;
		border: 1px solid var(--wce-border-color);
	}
	.wce-grid-area {
		width: 100% !important;
	}
}
