/**
 * Shop / Category page UX redesign — Fazė 5.
 *
 * Stiliuoja TIK esamą, native WoodMart/WooCommerce markup'ą (žr.
 * inc/category-page.php komentarą su tikslia hook/DOM struktūra).
 * Jokio naujo markup, jokio template override.
 *
 * Vizualinė kryptis: švari balta bazė, grafitinis tekstas, subtilūs
 * 1px border'ai, 6-8px radius tik kur reikia, be gradientų/shadow/
 * pastelinių blokų. Accent (#e83a17) TIK: sale kaina, CTA mygtukas,
 * aktyvios pagination, subcategory chip hover/active.
 */

:root {
	--ps-ink: #1f2937;
	--ps-ink-muted: #6b7280;
	--ps-border: #e5e7eb;
	--ps-accent: #e83a17;
	--ps-radius: 8px;
}

/* ================================================================
   1. KATEGORIJOS HEADER ZONA — breadcrumbs + H1, kompaktiška
   ================================================================ */

.wd-breadcrumbs .woocommerce-breadcrumb {
	font-size: 13px;
	color: var(--ps-ink-muted);
	margin: 0 0 6px;
}

.woocommerce-products-header__title.page-title {
	font-size: 26px;
	font-weight: 700;
	color: var(--ps-ink);
	line-height: 1.25;
	margin: 0 0 4px !important;
}

@media (max-width: 767px) {
	.woocommerce-products-header__title.page-title {
		font-size: 20px;
		margin-bottom: 2px !important;
	}

	.wd-breadcrumbs .woocommerce-breadcrumb {
		font-size: 12px;
		margin-bottom: 4px;
	}
}

/* ================================================================
   2. SUBCATEGORY QUICK NAV (ps-subcat-chips)
   ================================================================ */

.ps-subcat-chips {
	margin: 10px 0 4px;
}

.ps-subcat-chips ul {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ps-subcat-chips a {
	display: inline-flex;
	align-items: center;
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ps-ink);
	background: #fff;
	border: 1px solid var(--ps-border);
	border-radius: 999px;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color .15s ease, color .15s ease;
}

.ps-subcat-chips a:hover,
.ps-subcat-chips a:focus {
	border-color: var(--ps-accent);
	color: var(--ps-accent);
}

@media (max-width: 767px) {
	.ps-subcat-chips {
		margin: 8px 0 2px;
	}

	.ps-subcat-chips ul {
		flex-wrap: nowrap;
		overflow-x: auto;
		scroll-snap-type: x proximity;
		padding-bottom: 4px;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	.ps-subcat-chips ul::-webkit-scrollbar {
		display: none;
	}

	.ps-subcat-chips li {
		scroll-snap-align: start;
		flex: 0 0 auto;
	}

	.ps-subcat-chips a {
		padding: 8px 14px;
		font-size: 13px;
	}
}

/* ================================================================
   3. TOOLBAR (.shop-loop-head — breadcrumbs+count / sort+filter btn)
   ================================================================ */

.shop-loop-head {
	margin-bottom: 14px;
}

.woocommerce-result-count {
	font-size: 13px;
	color: var(--ps-ink-muted);
	margin: 0;
}

.wd-show-sidebar-btn a,
.woocommerce-ordering select {
	font-size: 13px;
	font-weight: 600;
	color: var(--ps-ink);
}

@media (max-width: 767px) {
	.shop-loop-head {
		margin-bottom: 10px;
	}

	/* Filtrai / Rūšiuoti — vienodo svarbumo, kompaktiška eilutė */
	.wd-shop-tools.woodmart-shop-tools {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
	}

	.wd-show-sidebar-btn {
		min-height: 44px;
		display: flex;
		align-items: center;
	}
}

/* ================================================================
   4. ACTIVE FILTERS — spacing suderinimas su nauju layout (markup ir
   spalvos jau apibrėžtos category-filters.css, ČIA tik tarpai).
   ================================================================ */

.wd-active-filters {
	margin-top: 4px;
	margin-bottom: 18px;
}

/* ================================================================
   5. PRODUCT GRID / CARD
   ================================================================ */

.products.wd-products {
	margin-top: 0;
}

/* Vienodo aukščio kortelės: tinklelio / karuselės elementas ištempiamas
   per visą eilutės aukštį, o kortelės turinys yra stulpelis, kurio
   apačioje (margin-top: auto ant kainos) visada stovi kaina + mygtukas.
   Tvarka nustatoma per `order`, HTML nekeičiamas. */
.product-grid-item {
	height: 100%;
}

/* Produktų karuselės (pvz. susijusios prekės): skaidrė ištempiama per
   visą karuselės aukštį. :has() riboja tik produktų karuseles —
   gamintojų ir kitos karuselės nepaliečiamos. */
.wd-carousel-wrap:has(> .wd-carousel-item > .product-grid-item) {
	align-items: stretch;
}

.wd-carousel-item:has(> .product-grid-item) {
	display: flex;
	height: auto;
}

.wd-carousel-item > .product-grid-item {
	flex: 1 1 auto;
	height: auto;
}

.product-grid-item .product-wrapper {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding-bottom: 14px;
	border: 1px solid var(--ps-border);
	border-radius: var(--ps-radius);
	overflow: hidden;
	background: #fff;
	transition: border-color .2s ease, box-shadow .2s ease;
}

.product-grid-item .product-wrapper > .product-element-top { order: 0; }
.product-grid-item .product-wrapper > .wd-entities-title { order: 1; }
.product-grid-item .product-wrapper > .wd-product-cats { order: 2; }
.product-grid-item .product-wrapper > .ps-savings-bar { order: 3; }
.product-grid-item .product-wrapper > .price { order: 4; }
.product-grid-item .product-wrapper > .wd-add-btn { order: 5; }

.product-grid-item .product-wrapper > .wd-entities-title,
.product-grid-item .product-wrapper > .wd-product-cats,
.product-grid-item .product-wrapper > .price,
.product-grid-item .product-wrapper > .wd-add-btn,
.product-grid-item .product-wrapper > .ps-savings-bar {
	padding-right: 12px;
	padding-left: 12px;
}

@media (min-width: 1025px) {
	.product-grid-item:hover .product-wrapper {
		border-color: #d1d5db;
		box-shadow: 0 4px 14px rgba(16, 24, 40, .06);
	}
}

.product-grid-item .product-element-top {
	position: relative;
}

/* Stabilus 1:1 aspect ratio — vienodo aukščio kortelės nepriklausomai
   nuo originalaus paveikslėlio dydžio; object-fit saugo nuo ištempimo. */
.product-image-link,
.product-image-link img,
.hover-img img {
	aspect-ratio: 1 / 1;
	width: 100%;
	height: auto;
	object-fit: contain;
	background: #fff;
}

.product-labels .onsale.product-label {
	background: var(--ps-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: 4px;
	line-height: 1.4;
}

/* Wishlist / quick view — subtilios ikonos, ne "AI card" mygtukai */
.wd-buttons .wd-action-btn {
	background: rgba(255, 255, 255, .92);
	border-radius: 50%;
}

@media (min-width: 1025px) {
	.wd-buttons {
		opacity: 0;
		transition: opacity .15s ease;
	}

	.product-grid-item:hover .wd-buttons {
		opacity: 1;
	}
}

/* Pavadinimas: tas pats teksto šriftas kaip visame puslapyje (ne
   platus Michroma), visada lygiai 2 eilučių aukščio — trumpas
   pavadinimas nebepakelia kategorijų / kainos eilutės. */
.wd-entities-title {
	font-family: var(--wd-text-font, "Fira Sans", Arial, Helvetica, sans-serif);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ps-ink);
	margin: 12px 0 4px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Specifiškumas didesnis už WoodMart `.wd-entities-title`
   (--wd-entities-title-font), kuris įkeliamas vėliau. */
.product-grid-item .wd-entities-title {
	min-height: calc(2 * 1.4em);
	font-family: var(--wd-text-font, "Fira Sans", Arial, Helvetica, sans-serif);
}

.wd-entities-title a {
	color: inherit;
}

/* Kategorijos: visada viena eilutė (su „…“), kad nekeistų aukščio. */
.wd-product-cats {
	font-size: 12px;
	line-height: 1.5;
	color: var(--ps-ink-muted);
	margin: 0 0 8px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.wd-product-cats a {
	display: inline;
	color: inherit;
}

/* Kortelėje rodoma tik paskutinė (tiksliausia) kategorija, pvz.
   „Spininginės meškerės“ vietoj „Meškerės, …“. font-size: 0 paslepia
   kablelius tarp nuorodų (jie yra teksto mazgai). */
.product-grid-item .product-wrapper > .wd-product-cats {
	font-size: 0;
}

.product-grid-item .product-wrapper > .wd-product-cats a {
	font-size: 12px;
}

.product-grid-item .product-wrapper > .wd-product-cats a:not(:last-of-type) {
	display: none;
}

.price {
	font-size: 15px;
	font-weight: 700;
	color: var(--ps-ink);
}

/* Kaina + mygtukas prispaudžiami prie kortelės apačios. Jei yra
   „Sutaupote“ eilutė, apačion stumiama ji (kaina seka iškart po jos),
   todėl kainos ir mygtukai eilutėje visada vienoje linijoje. */
.product-grid-item .product-wrapper > .price {
	margin-top: auto;
	margin-bottom: 10px;
}

.product-grid-item .product-wrapper:has(> .ps-savings-bar) > .price {
	margin-top: 0;
}

/* „Sutaupote“ (Code Snippet #9) — ne žalia juosta po kortele, o
   santūri akcento eilutė virš kainos. Specifiškumas didesnis už
   snippet'o inline <style> (įkeliamas vėliau). */
.product-grid-item.product .product-wrapper > .ps-savings-bar {
	margin: auto 0 4px;
	padding-top: 0;
	padding-bottom: 0;
	border-radius: 0;
	background: none;
	color: var(--ps-accent);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.4;
	text-align: center;
}

.price ins {
	color: var(--ps-accent);
	text-decoration: none;
}

.price del {
	color: var(--ps-ink-muted);
	font-weight: 400;
	font-size: 13px;
	opacity: .8;
}

.wd-add-btn .add_to_cart_button {
	background: var(--ps-accent);
	border-color: var(--ps-accent);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	border-radius: 6px;
}

/* Mygtukas per visą kortelės turinio plotį ir vienodo aukščio,
   nepriklausomai nuo teksto („Į krepšelį“ / „Pasirinkti variantus“). */
.product-grid-item .product-wrapper > .wd-add-btn {
	width: 100%;
}

.product-grid-item .wd-add-btn .add_to_cart_button {
	width: 100%;
	min-height: 40px;
	justify-content: center;
	text-align: center;
}

.wd-add-btn .add_to_cart_button:hover {
	background: #c9330f;
	border-color: #c9330f;
}

@media (max-width: 767px) {
	.wd-entities-title {
		font-size: 13px;
		margin: 8px 0 3px;
	}

	.price {
		font-size: 14px;
	}
}

/* ================================================================
   6. PAGINATION
   ================================================================ */

.woocommerce-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 40px;
	padding: 0 10px;
	border: 1px solid var(--ps-border);
	border-radius: 6px;
	color: var(--ps-ink);
	font-weight: 600;
	font-size: 14px;
}

.woocommerce-pagination .page-numbers.current {
	background: var(--ps-accent);
	border-color: var(--ps-accent);
	color: #fff;
}

.woocommerce-pagination .page-numbers:not(.current):not(.dots):hover {
	border-color: var(--ps-accent);
	color: var(--ps-accent);
}

@media (max-width: 767px) {
	.woocommerce-pagination .page-numbers {
		min-width: 44px;
		min-height: 44px;
	}
}

/* ================================================================
   7. CATEGORY DESCRIPTION BLOKAI (po produktų) — tik vizualinis
   apvalkalas, TEKSTAS nekeičiamas.
   ================================================================ */

.term-description,
.wd-term-desc {
	max-width: 860px;
	margin: 32px auto 0;
	padding-top: 24px;
	border-top: 1px solid var(--ps-border);
	color: var(--ps-ink-muted);
	font-size: 14px;
	line-height: 1.7;
}

.term-description h1,
.term-description h2,
.wd-term-desc h2 {
	font-size: 19px;
	color: var(--ps-ink);
	margin: 0 0 12px;
}

.term-description h3,
.wd-term-desc h3 {
	font-size: 16px;
	color: var(--ps-ink);
	margin: 16px 0 8px;
}

/* ================================================================
   8. SIDEBAR — KATEGORIJŲ NAVIGACIJA (.ps-shop-cats, inc/category-page.php)
   ================================================================ */

.sidebar-container .widget-title {
	margin-bottom: 12px;
	color: var(--ps-ink);
	font-family: var(--wd-text-font, "Fira Sans", Arial, Helvetica, sans-serif);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
	line-height: 1.35;
	text-transform: uppercase;
}

.ps-shop-cats {
	font-size: 14px;
	line-height: 1.4;
}

.ps-shop-cats a {
	color: #34383d;
	text-decoration: none;
}

.ps-shop-cats a:hover,
.ps-shop-cats a:focus-visible {
	color: var(--ps-accent);
}

/* Grupė (akordeonas) */
.ps-shop-cats__group {
	border-bottom: 1px solid var(--ps-border);
}

.ps-shop-cats__group:first-child {
	border-top: 1px solid var(--ps-border);
}

.ps-shop-cats summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 11px 2px;
	color: var(--ps-ink);
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}

.ps-shop-cats summary::-webkit-details-marker {
	display: none;
}

.ps-shop-cats summary::after {
	content: "";
	flex: 0 0 auto;
	width: 7px;
	height: 7px;
	margin-right: 4px;
	border-right: 1.5px solid #9aa0a6;
	border-bottom: 1.5px solid #9aa0a6;
	transform: rotate(45deg) translateY(-2px);
	transition: transform .15s ease;
}

.ps-shop-cats details[open] > summary::after {
	transform: rotate(-135deg) translateY(-2px);
}

.ps-shop-cats summary:hover,
.ps-shop-cats details[open] > summary {
	color: var(--ps-accent);
}

.ps-shop-cats__panel {
	padding: 0 2px 12px;
}

.ps-shop-cats__all {
	display: inline-block;
	margin: 0 0 6px;
	color: var(--ps-accent) !important;
	font-size: 13px;
	font-weight: 600;
}

.ps-shop-cats__all::after {
	content: " →";
}

.ps-shop-cats__section {
	margin: 10px 0 2px;
	color: #73777d;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .05em;
	text-transform: uppercase;
}

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

.ps-shop-cats__list li {
	margin: 0;
}

.ps-shop-cats__list a,
.ps-shop-cats__list span {
	display: block;
	padding: 5px 0;
}

/* Kategorijos kontekstas */
.ps-shop-cats__back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 10px;
	color: #5b6168 !important;
	font-size: 13px;
}

.ps-shop-cats__back:hover {
	color: var(--ps-accent) !important;
}

.ps-shop-cats__current {
	margin: 0 0 4px;
	padding-left: 10px;
	border-left: 2px solid var(--ps-accent);
	color: var(--ps-ink);
	font-weight: 700;
}

.ps-shop-cats__list--context {
	margin-bottom: 16px;
}

/* Visi konteksto punktai turi tą patį 2px (permatomą) kairį rėmelį —
   aktyvus punktas keičia tik jo spalvą, tekstas nepasislenka. */
.ps-shop-cats__list--context a,
.ps-shop-cats__list--context span {
	padding-left: 10px;
	border-left: 2px solid transparent;
}

.ps-shop-cats__current + .ps-shop-cats__list--context a {
	padding-left: 22px;
}

.ps-shop-cats__list--context .is-current span {
	border-left-color: var(--ps-accent);
	color: var(--ps-ink);
	font-weight: 700;
}

.ps-shop-cats__more {
	border-top: 1px solid var(--ps-border);
}

.ps-shop-cats__more > summary {
	color: #5b6168;
	font-size: 13px;
	font-weight: 600;
}

.ps-shop-cats__more .ps-shop-cats__group:first-child {
	border-top: 0;
}

.ps-shop-cats__more .ps-shop-cats__group summary {
	padding-left: 10px;
	font-weight: 500;
}

.ps-shop-cats__more .ps-shop-cats__panel {
	padding-left: 10px;
}
