/*
 * Smart Menu for WooCommerce – mobile-first stylesheet
 * Text Domain: smart-menu-for-woocommerce
 */

/* =========================================================
   Design tokens
   ========================================================= */
.smart-menu {
	--sm-font:          inherit;
	--sm-radius-card:   14px;
	--sm-radius-sm:     8px;
	--sm-color-bg:      #ffffff;
	--sm-color-surface: #f7f7f7;
	--sm-color-border:  #ebebeb;
	--sm-color-text:    #1a1a1a;
	--sm-color-muted:   #999999;
	--sm-color-price:   #1a1a1a;
	--sm-color-accent:  #c0392b;   /* red accent – used sparingly */
	--sm-shadow-card:   0 2px 12px rgba(0, 0, 0, 0.10);
	--sm-shadow-hover:  0 6px 24px rgba(0, 0, 0, 0.16);
	--sm-spacing:       20px;
	--sm-spacing-sm:    12px;
}

/* =========================================================
   Visibility helpers
   ========================================================= */
.sm-hidden { display: none  !important; }
.sm-active { display: block !important; }
.sm-level--1.sm-active { display: grid !important; }

/* =========================================================
   Wrapper
   ========================================================= */
.smart-menu {
	width: 100%;
	max-width: 680px;
	margin-left: auto;
	margin-right: auto;
	font-family: var(--sm-font);
	background-color: var(--sm-color-bg);
	box-sizing: border-box;
}

.smart-menu *,
.smart-menu *::before,
.smart-menu *::after { box-sizing: inherit; }

/* =========================================================
   Level base
   ========================================================= */
.sm-level { width: 100%; }

/* =========================================================
   Level header  – back button row only
   ========================================================= */
.sm-level-header {
	padding: var(--sm-spacing) var(--sm-spacing) 0;
}

/* =========================================================
   Back button  – minimal text + CSS arrow, no circle/border
   ========================================================= */
.sm-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--sm-color-muted);
	font-size: 0.8125rem;   /* 13px */
	font-weight: 500;
	letter-spacing: 0.03em;
	line-height: 1;
	-webkit-tap-highlight-color: transparent;
	position: relative;
}

/* Invisible tap-area expansion – keeps 44px touch target */
.sm-back::before {
	content: '';
	position: absolute;
	inset: -14px -10px;
}

.sm-back:hover  { color: var(--sm-color-text); }
.sm-back:active { opacity: 0.5; }

/* CSS-only left-pointing chevron */
.sm-back__arrow {
	display: inline-block;
	width: 6px;
	height: 6px;
	border-left:   1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg) translateY(-1px);
	flex-shrink: 0;
}

.sm-back__label {
	/* inherits color/size from .sm-back */
}

/* =========================================================
   Level title  – the commanding heading of each sub-level
   Full-width, well separated from the back button above
   and from the list below.
   ========================================================= */
.sm-level-title {
	margin: 0;
	padding: 14px var(--sm-spacing) 18px;
	font-size: 1.55rem;
	font-weight: 800;
	letter-spacing: -0.025em;
	line-height: 1.15;
	color: var(--sm-color-text);
	/* Red accent: a single left border stripe */
	border-left: 3px solid var(--sm-color-accent);
	padding-left: calc(var(--sm-spacing) - 3px);
}

/* =========================================================
   Level 1 – Macro-cards grid
   ========================================================= */
.sm-level--1 {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--sm-spacing-sm);
	padding: var(--sm-spacing);
}

.sm-macro-card {
	position: relative;
	aspect-ratio: 16 / 7;
	border-radius: var(--sm-radius-card);
	overflow: hidden;
	cursor: pointer;
	display: flex;
	align-items: flex-end;
	justify-content: flex-start;
	box-shadow: var(--sm-shadow-card);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
	-webkit-tap-highlight-color: transparent;
}

.sm-macro-card:hover  { box-shadow: var(--sm-shadow-hover); transform: translateY(-2px); }
.sm-macro-card:active { transform: translateY(0); box-shadow: var(--sm-shadow-card); }

.sm-macro-card__bg {
	position: absolute; inset: 0;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	transition: transform 0.3s ease;
}
.sm-macro-card:hover .sm-macro-card__bg { transform: scale(1.03); }

/* Full-image overlay: uniform dark veil over the whole photo,
   then a stronger gradient at the bottom for text legibility. */
.sm-macro-card__overlay {
	position: absolute; inset: 0;
	background:
		linear-gradient(
			to bottom,
			rgba(0, 0, 0, 0.22) 0%,
			rgba(0, 0, 0, 0.22) 40%,
			rgba(0, 0, 0, 0.60) 100%
		);
}

.sm-macro-card__name {
	position: relative; z-index: 1;
	color: #ffffff;
	font-size: 1.05rem;
	font-weight: 700;
	letter-spacing: 0.01em;
	line-height: 1.2;
	padding: 14px 16px;
	text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* =========================================================
   Level 2 – Category list
   ========================================================= */
.sm-level--2 {
	padding-bottom: var(--sm-spacing);
}

.sm-category-list {
	list-style: none;
	margin: 0;
	padding: 0 var(--sm-spacing);
}

.sm-category-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 0;
	border-bottom: 1px solid var(--sm-color-border);
	cursor: pointer;
	font-size: 1rem;
	font-weight: 400;
	color: var(--sm-color-text);
	-webkit-tap-highlight-color: transparent;
	transition: background 0.1s ease;
}

.sm-category-item:first-child { border-top: 1px solid var(--sm-color-border); }
.sm-category-item:nth-child(even) { background-color: #f9f9f9; }
.sm-category-item:hover  { background: #f2f2f2; }
.sm-category-item:active { background: #ebebeb; }

.sm-category-item__name {
	flex: 1;
	line-height: 1.4;
	font-weight: 600;
}

/* CSS-only right-pointing chevron – no SVG, no Unicode char */
.sm-category-item__chevron {
	flex-shrink: 0;
	display: inline-block;
	width: 7px;
	height: 7px;
	border-right: 2px solid #888888;
	border-top:   2px solid #888888;
	transform: rotate(45deg);
	margin-left: 12px;
	align-self: center;
}

/* =========================================================
   Level 3 – Products & subcategory sections
   ========================================================= */
.sm-level--3 {
	padding-bottom: var(--sm-spacing);
}

.sm-product-list {
	list-style: none;
	margin: 0;
	padding: 0 var(--sm-spacing);
}

.sm-product {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 0;
	border-bottom: 1px solid var(--sm-color-border);
	font-size: 0.95rem;
	color: var(--sm-color-text);
}

.sm-product:first-child { border-top: 1px solid var(--sm-color-border); }
.sm-product:nth-child(even) { background-color: #f9f9f9; }

.sm-product__name {
	flex: 1;
	font-weight: 400;
	line-height: 1.4;
}

.sm-product__price {
	flex-shrink: 0;
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--sm-color-price);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.sm-product__price .woocommerce-Price-amount,
.sm-product__price .woocommerce-Price-currencySymbol {
	font-size: inherit;
	font-weight: inherit;
	color: inherit;
}

/* Subcategory section */
.sm-subcategory-section { margin-top: 24px; }

.sm-subcategory-section__title {
	margin: 0;
	padding: 6px var(--sm-spacing);
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--sm-color-muted);
	background-color: var(--sm-color-surface);
	border-top: 1px solid var(--sm-color-border);
	border-bottom: 1px solid var(--sm-color-border);
	/* Red accent: left border on subcategory headings */
	border-left: 2px solid var(--sm-color-accent);
	padding-left: calc(var(--sm-spacing) - 2px);
}

/* =========================================================
   Empty state
   ========================================================= */
.sm-empty {
	padding: 40px var(--sm-spacing);
	text-align: center;
	color: var(--sm-color-muted);
	font-size: 0.95rem;
	font-style: italic;
}

/* =========================================================
   Responsive – wider viewports (≥ 640px)
   ========================================================= */
@media (min-width: 640px) {
	.sm-level--1 {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
		padding: var(--sm-spacing);
	}

	.sm-macro-card { aspect-ratio: 3 / 2; }

	.sm-macro-card__name {
		font-size: 1.1rem;
		padding: 16px 18px;
	}

	.sm-level-title { font-size: 1.75rem; }
}
