/* =========================================================
   Termékek / kategória oldal
   Felépítés:
   1. Layout
   2. Oldalsáv
   3. Kategória fejléc + morzsamenü
   4. Közös: kép placeholder
   5. Alkategória kártyák
   6. Terméklista + termékkártya
   7. Reszponzív
   8. Kevesebb mozgás
   ========================================================= */

/* ===== 1. Layout ===== */
.shop-layout { display: flex; align-items: flex-start; border-top: 1px solid #E4E5E1; }
.shop-main { flex: 1 1 0; min-width: 0; }
.shop-content { padding: 32px 40px 64px; }

/* Billentyűzetes fókusz (a globális css minden outline-t kikapcsol) */
.sb-link:focus-visible, .sb-toggle:focus-visible, .sb-sub a:focus-visible, .sidebar-extra a:focus-visible,
.subcat-card:focus-visible, .fav-btn:focus-visible, .add-to-cart:focus-visible,
.product-card:has(h3 a:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ===== 2. Oldalsáv ===== */
.shop-sidebar { flex: 0 0 340px; width: 340px; position: sticky; top: var(--header-h, 96px); height: calc(100vh - var(--header-h, 96px)); overflow-y: auto; overscroll-behavior: contain; background: white; border-right: 1px solid #E4E5E1; scrollbar-width: thin; scrollbar-color: rgba(0, 0, 0, .25) transparent; transition: top .4s cubic-bezier(.2, .8, .2, 1), height .4s cubic-bezier(.2, .8, .2, 1); }
.shop-sidebar::-webkit-scrollbar { width: 6px; }
.shop-sidebar::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .25); border-radius: 3px; }
/* Amikor a header elrejtőzik (header.is-hidden), az oldalsáv felcsúszik a képernyő tetejére */
body:has(header.is-hidden) .shop-sidebar { top: 0; height: 100vh; }

ul.sidebar-categories { list-style: none; margin: 0; padding: 20px 16px; display: flex; flex-direction: column; gap: 4px; background: #fafaf9; }

.sb-row { display: flex; align-items: center; border-radius: 8px; transition: background-color .2s ease; }
.sb-row:hover { background: #eeece7; }
.sb-item.is-active > .sb-row { background: var(--pearl); }
.sb-item.has-sub > .sb-row { cursor: pointer; }

.sb-link { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 10px 12px; font-family: var(--font-heading); font-size: 14px; font-weight: 700; line-height: 20px; color: var(--deep-olive); text-decoration: none; cursor: pointer; }
.sb-link:hover { text-decoration: none; }
.sb-item.has-sub > .sb-row .sb-link { flex: 0 1 auto; }

.sb-icon { width: 20px; height: 20px; flex-shrink: 0; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.sb-icon img { display: block; width: 100%; height: 100%; }
.sb-row:hover .sb-icon { transform: scale(1.15) rotate(-6deg); }

.sb-name { position: relative; }
.sb-name::after { content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.sb-link:hover .sb-name::after, .sb-item.is-active > .sb-row .sb-name::after { transform: scaleX(1); }

.sb-toggle { flex-shrink: 0; width: 36px; height: 40px; margin-left: auto; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; border-radius: 8px; color: var(--deep-olive); }
.sb-chevron { display: block; width: 20px; height: 20px; background: url('/modules/_global/images/chevron-down.svg') no-repeat center / contain; transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.sb-item.is-open > .sb-row .sb-chevron { transform: rotate(180deg); }

.sb-sub { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .35s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .35s; }
.sb-item.is-open > .sb-sub { grid-template-rows: 1fr; visibility: visible; transition-delay: 0s; }
.sb-sub > ul { min-height: 0; overflow: hidden; list-style: none; margin: 0; padding: 0 0 0 40px; display: flex; flex-direction: column; gap: 2px; }
.sb-item.is-open > .sb-sub > ul { padding-top: 4px; padding-bottom: 8px; }
.sb-sub li { opacity: 0; transform: translateX(-8px); transition: opacity .25s ease, transform .3s cubic-bezier(.2, .8, .2, 1); }
.sb-item.is-open .sb-sub li { opacity: 1; transform: translateX(0); transition-delay: calc(60ms + var(--i, 0) * 30ms); }
.sb-sub a { display: block; padding: 7px 12px; border-radius: 6px; font-family: var(--font-heading); font-size: 13px; font-weight: 400; line-height: 18px; color: var(--deep-olive); text-decoration: none; transition: background-color .2s ease, color .2s ease; }
.sb-sub a:hover { background: #eeece7; color: var(--olive); text-decoration: none; }
.sb-sub a.is-current { font-weight: 700; color: var(--olive); }

ul.sidebar-extra { list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(0, 0, 0, .08); }
ul.sidebar-extra a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; font-family: var(--font-heading); font-size: 14px; font-weight: 700; line-height: 20px; color: var(--deep-olive); text-decoration: none; transition: background-color .2s ease; }
ul.sidebar-extra a:hover { background: #eeece7; text-decoration: none; }

/* ===== 3. Kategória fejléc + morzsamenü ===== */
/* A kép bal széle világos, ezért a szöveg a kép bal oldalára kerül. */
.category-hero { position: relative; overflow: hidden; display: flex; align-items: center; aspect-ratio: 40 / 9; min-height: 220px; background: #fafafa; }
.category-hero img { position: absolute; z-index: 1; top: 0; right: 0; height: 100%; width: auto; max-width: none; }
.hero-text { position: relative; z-index: 2; width: 50%; padding: 32px 40px; }
.hero-text h1 { margin-top: 20px; font-size: clamp(32px, 3.4vw, 56px); line-height: 1.15; overflow-wrap: break-word; }
.hero-text p { margin: 12px 0 0; font-size: 16px; line-height: 24px; }

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; padding: 0; margin: 0; list-style: none; line-height: 20px; color: var(--deep-olive); }
.breadcrumb li { display: flex; align-items: center; font-size: 12px; }
.breadcrumb li + li::before { content: ""; flex-shrink: 0; width: 16px; height: 16px; margin: 0 8px; background: currentColor; -webkit-mask: url("/libraries/Feather/chevron-right.svg") no-repeat center / contain; mask: url("/libraries/Feather/chevron-right.svg") no-repeat center / contain; }
.breadcrumb a { color: inherit; text-decoration: none; font-family: var(--font-heading); font-size: 12px; font-weight: 700; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb li[aria-current="page"] { font-weight: 400; }

/* ===== 4. Közös: kép placeholder (ha nincs vagy nem töltődik be a fotó) ===== */
.media-placeholder { display: block; width: 100%; height: 100%; background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, .55), transparent 55%), linear-gradient(135deg, var(--pearl) 0%, var(--sand-beige) 50%, var(--olive) 140%); }

/* ===== 5. Alkategória kártyák ===== */
.subcategories { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; margin: 0 0 40px; }
.subcat-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(0, 0, 0, .08); border-radius: 16px; background: #f8f6f3; color: var(--deep-olive); text-decoration: none; transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s ease; }
.subcat-card:hover { text-decoration: none; }
.subcat-card img, .subcat-card .media-placeholder { aspect-ratio: 1 / 1; height: auto; object-fit: cover; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.subcat-card img { display: block; width: 100%; }
.subcat-name { flex: 1; display: flex; align-items: center; padding: 16px 18px; font-family: var(--font-heading); font-size: 16px; font-weight: 700; line-height: 22px; }

/* ===== 6. Terméklista + termékkártya ===== */
/* Az oszlopok automatikusan kitöltik a teljes szélességet */
ul.product-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
ul.product-grid > li { min-width: 0; }

.product-card { position: relative; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: #f8f6f3; border: 1px solid rgba(0, 0, 0, .06); border-radius: 20px; transition: transform .3s cubic-bezier(.2, .8, .2, 1), box-shadow .3s ease; }

.product-media { position: relative; aspect-ratio: 1 / 1; overflow: hidden; }
.product-media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }

.product-badge { position: absolute; z-index: 1; top: 12px; left: 12px; padding: 6px 16px; background: #fff; border-radius: 999px; font-family: var(--font-heading); font-size: 13px; font-weight: 700; line-height: 18px; color: var(--deep-olive); }

.fav-btn { position: absolute; z-index: 2; top: 8px; right: 8px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; padding: 0; background: none; border: 0; border-radius: 50%; color: #fff; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .35)); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.fav-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: fill .2s ease; }
.fav-btn[aria-pressed="true"] { color: #d9534f; }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }

.product-body { flex: 1; display: flex; flex-direction: column; padding: 16px 18px 18px; }
.product-body h3 { margin: 0; font-family: var(--font-heading); font-size: 18px; font-weight: 700; line-height: 24px; color: var(--deep-olive); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.product-body h3 a { color: inherit; text-decoration: none; }
.product-body h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* az egész kártya kattintható */
.product-unit { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: #7a7a72; }

.product-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 14px; }
.product-price { min-width: 0; display: flex; flex-direction: column; font-family: var(--font-heading); color: var(--deep-olive); }
.product-price strong { font-family: var(--font-heading); font-size: 20px; font-weight: 700; line-height: 26px; white-space: nowrap; }
.product-price small { font-family: var(--font-heading); font-size: 12px; font-weight: 400; line-height: 16px; color: #7a7a72; }

.add-to-cart { position: relative; z-index: 2; flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; padding: 0; background: var(--olive); color: #fff; border: 0; border-radius: 50%; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), background-color .2s ease; }
.add-to-cart svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.add-to-cart:active { transform: scale(.95); }

/* Hover hatások csak egérrel (érintőképernyőn ne ragadjon be) */
@media (hover: hover) {
	.subcat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 24px -12px rgba(0, 0, 0, .25); }
	.subcat-card:hover img, .subcat-card:hover .media-placeholder { transform: scale(1.05); }
	.product-card:hover { transform: translateY(-4px); box-shadow: 0 14px 28px -14px rgba(0, 0, 0, .3); }
	.product-card:hover .product-media img, .product-card:hover .media-placeholder { transform: scale(1.05); }
	.fav-btn:hover { transform: scale(1.15); }
	.add-to-cart:hover { background: var(--deep-olive); transform: scale(1.1) rotate(90deg); }
}
.product-card .media-placeholder { transition: transform .5s cubic-bezier(.2, .8, .2, 1); }

/* ===== 7. Reszponzív ===== */
@media (max-width: 1440px) {
	.shop-layout { --header-h: 80px; } /* a header ilyenkor 80px magas (global css) */
	.subcategories, ul.product-grid { gap: 16px; }
}

/* Oldalsáv eltűnik, helyette a mobil menü (global css) jelenik meg */
@media (max-width: 1280px) {
	.shop-sidebar { display: none; }
	.shop-content { padding: 28px 24px calc(var(--mobil-nav-h, 72px) + 40px); } /* a fix alsó menü ne takarja a tartalmat */
	.hero-text { padding: 28px 24px; }
}

@media (max-width: 768px) {
	/* A fejléc egymás alá kerül: felül a szöveg, alatta a kép */
	.category-hero { display: block; aspect-ratio: auto; min-height: 0; }
	.category-hero img { position: static; display: block; width: 100%; height: auto; }
	.hero-text { width: 100%; padding: 20px 16px 8px; }
	.hero-text h1 { margin-top: 14px; }
	.hero-text p { font-size: 14px; line-height: 22px; }
	.shop-content { padding: 20px 16px calc(var(--mobil-nav-h, 72px) + 32px); }
	.subcategories { margin-bottom: 28px; }
	.breadcrumb { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
	.breadcrumb::-webkit-scrollbar { display: none; }
	.breadcrumb li { flex-shrink: 0; }
}

@media (max-width: 600px) {
	.subcategories, ul.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.subcat-card { border-radius: 12px; }
	.subcat-name { padding: 12px; font-size: 14px; line-height: 20px; }
	.product-card { border-radius: 16px; }
	.product-badge { top: 8px; left: 8px; padding: 4px 10px; font-size: 12px; line-height: 16px; }
	.fav-btn { top: 4px; right: 4px; }
	.product-body { padding: 12px 12px 14px; }
	.product-body h3 { font-size: 15px; line-height: 20px; }
	.product-unit { font-size: 13px; line-height: 18px; }
	.product-bottom { padding-top: 10px; }
	.product-price strong { font-size: 16px; line-height: 22px; }
	.add-to-cart { width: 36px; height: 36px; }
}

/* ===== 8. Kevesebb mozgás ===== */
@media (prefers-reduced-motion: reduce) {
	.shop-layout *, .shop-layout *::before, .shop-layout *::after { transition-duration: .01ms !important; transition-delay: 0s !important; }
}
