/* WooCommerce Mobile Category Browser */

.wc-mc-browser {
	--wc-mc-accent: #00a049;
	--wc-mc-accent-soft: #e8f7ee;
	--wc-mc-bg: #f5f5f7;
	--wc-mc-sidebar-bg: #ececee;
	--wc-mc-text: #1a1a1a;
	--wc-mc-muted: #6b7280;
	--wc-mc-radius: 12px;
	--wc-mc-sidebar-w: 92px;
	font-family: inherit;
	color: var(--wc-mc-text);
	background: var(--wc-mc-bg);
	border-radius: var(--wc-mc-radius);
	overflow: hidden;
	max-width: 960px;
	margin: 0 auto;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
	direction: rtl;
	text-align: right;
}

.wc-mc-header {
	padding: 12px 16px;
	background: #fff;
	border-bottom: 1px solid #eee;
}

.wc-mc-search {
	direction: rtl;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 8px;
	background: var(--wc-mc-bg);
	border-radius: 999px;
	padding: 6px 10px;
	border: 1px solid #e5e7eb;
	margin: 0;
	width: 100%;
	box-sizing: border-box;
}

.wc-mc-search__input {
	flex: 1 1 auto;
	border: 0 !important;
	background: transparent !important;
	box-shadow: none !important;
	font-size: 14px;
	line-height: 1.4;
	min-width: 0;
	width: 100%;
	outline: none;
	padding: 8px 4px !important;
	margin: 0 !important;
	appearance: none;
	-webkit-appearance: none;
	color: var(--wc-mc-text);
}

.wc-mc-search__input::placeholder {
	color: #9ca3af;
}

.wc-mc-search__input::-webkit-search-decoration,
.wc-mc-search__input::-webkit-search-cancel-button,
.wc-mc-search__input::-webkit-search-results-button,
.wc-mc-search__input::-webkit-search-results-decoration {
	-webkit-appearance: none;
	appearance: none;
	display: none;
}

.wc-mc-search__btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	min-width: 40px;
	padding: 0 !important;
	margin: 0 !important;
	border: 0 !important;
	border-radius: 50%;
	background: #fff !important;
	color: #4b5563 !important;
	cursor: pointer;
	flex: 0 0 40px;
	box-shadow: 0 0 0 1px #e5e7eb;
	line-height: 1;
}

.wc-mc-search__btn:hover,
.wc-mc-search__btn:focus {
	color: var(--wc-mc-accent) !important;
	box-shadow: 0 0 0 1px var(--wc-mc-accent);
	outline: none;
}

.wc-mc-search__icon {
	display: block;
	width: 20px;
	height: 20px;
	pointer-events: none;
}

/* Physical columns: LEFT = children panel | RIGHT = parent sidebar
   (direction:ltr so RTL on parent does not reverse grid columns) */
.wc-mc-body {
	direction: ltr;
	display: grid !important;
	grid-template-columns: minmax(0, 1fr) var(--wc-mc-sidebar-w) !important;
	grid-template-areas: "panel sidebar";
	align-items: stretch;
	min-height: 420px;
}

.wc-mc-sidebar {
	grid-area: sidebar;
	direction: rtl;
	background: var(--wc-mc-sidebar-bg);
	border-left: 1px solid #e5e7eb;
	overflow-y: auto;
	max-height: 70vh;
	-webkit-overflow-scrolling: touch;
}

.wc-mc-sidebar__list {
	list-style: none;
	margin: 0;
	padding: 8px 0;
}

.wc-mc-sidebar__item {
	margin: 0;
}

.wc-mc-sidebar__btn {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 12px 6px;
	border: 0;
	background: transparent;
	cursor: pointer;
	color: var(--wc-mc-muted);
	font-size: 11px;
	line-height: 1.3;
	text-align: center;
	transition: background 0.15s ease, color 0.15s ease;
}

.wc-mc-sidebar__btn.is-active {
	background: #fff;
	color: var(--wc-mc-accent);
	font-weight: 600;
}

.wc-mc-sidebar__btn.is-active::before {
	content: '';
	position: absolute;
	top: 8px;
	bottom: 8px;
	left: 0;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background: var(--wc-mc-accent);
}

.wc-mc-sidebar__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
}

.wc-mc-sidebar__icon img {
	width: 32px;
	height: 32px;
	object-fit: contain;
}

.wc-mc-sidebar__label {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	max-width: 100%;
}

.wc-mc-panel {
	grid-area: panel;
	direction: rtl;
	min-width: 0;
	background: #fff;
	overflow-y: auto;
	max-height: 70vh;
	-webkit-overflow-scrolling: touch;
}

.wc-mc-panel__inner {
	padding: 16px;
}

.wc-mc-panel__see-all {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	color: var(--wc-mc-accent);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	margin-bottom: 16px;
}

.wc-mc-panel__see-all:hover {
	text-decoration: underline;
}

.wc-mc-grid-wrap {
	position: relative;
	min-height: 120px;
}

.wc-mc-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.75);
	z-index: 2;
}

.wc-mc-loading[hidden] {
	display: none !important;
}

.wc-mc-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid #e5e7eb;
	border-top-color: var(--wc-mc-accent);
	border-radius: 50%;
	animation: wc-mc-spin 0.7s linear infinite;
}

@keyframes wc-mc-spin {
	to {
		transform: rotate(360deg);
	}
}

.wc-mc-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 12px 8px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wc-mc-grid__link {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-decoration: none;
	color: inherit;
	text-align: center;
	gap: 8px;
}

.wc-mc-grid__thumb {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	background: var(--wc-mc-bg);
	border-radius: 8px;
	padding: 8px;
}

.wc-mc-grid__thumb img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.wc-mc-grid__title {
	font-size: 12px;
	line-height: 1.4;
	color: var(--wc-mc-text);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.wc-mc-grid-empty,
.wc-mc-grid__error {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--wc-mc-muted);
	font-size: 14px;
	padding: 24px;
}

.wc-mc-grid-empty[hidden] {
	display: none !important;
}

.wc-mc-panel__footer {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid #f0f0f0;
}

.wc-mc-footer-link {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 16px 12px;
	background: var(--wc-mc-bg);
	border-radius: var(--wc-mc-radius);
	text-decoration: none;
	color: var(--wc-mc-text);
	font-size: 13px;
	font-weight: 500;
	transition: background 0.15s ease;
}

.wc-mc-footer-link:hover {
	background: var(--wc-mc-accent-soft);
	color: var(--wc-mc-accent);
}

.wc-mc-footer-link__icon {
	color: var(--wc-mc-muted);
}

.wc-mc-footer-link:hover .wc-mc-footer-link__icon {
	color: var(--wc-mc-accent);
}

.wc-mc-empty {
	text-align: center;
	padding: 24px;
}

/* Desktop / tablet */
@media (min-width: 768px) {
	.wc-mc-browser {
		--wc-mc-sidebar-w: 128px;
		max-width: 1100px;
	}

	.wc-mc-body {
		min-height: 520px;
	}

	.wc-mc-sidebar,
	.wc-mc-panel {
		max-height: none;
	}

	.wc-mc-sidebar__btn {
		font-size: 12px;
		padding: 14px 8px;
	}

	.wc-mc-sidebar__icon img {
		width: 40px;
		height: 40px;
	}

	.wc-mc-grid {
		grid-template-columns: repeat(4, 1fr);
		gap: 16px 12px;
	}

	.wc-mc-grid__title {
		font-size: 13px;
	}

	.wc-mc-panel__inner {
		padding: 24px;
	}
}

@media (min-width: 1024px) {
	.wc-mc-grid {
		grid-template-columns: repeat(5, 1fr);
	}
}

/* Full-width mobile embed (theme pages) */
@media (max-width: 480px) {
	.wc-mc-browser {
		border-radius: 0;
		max-width: none;
		margin-left: calc(50% - 50vw);
		margin-right: calc(50% - 50vw);
		width: 100vw;
	}

	.wc-mc-sidebar,
	.wc-mc-panel {
		max-height: calc(100vh - 180px);
	}
}
