/*
Theme Name:   Kształty Natury
Theme URI:    https://ksztaltyznatury.pl/
Description:  Motyw potomny Storefront dla sklepu Kształty Natury (rękodzieło, biżuteria).
Author:       wkuba
Author URI:   https://ksztaltyznatury.pl/
Template:     storefront
Version:      0.1.0
Text Domain:  ksztaltynatury-child
*/

/* ═══════════════════════════════════════════════════════════
   DRAWER KATEGORII — mobile + tablet (< 1024 px)
   Na desktop drawer i przycisk są ukryte; sidebar normalny.
   ═══════════════════════════════════════════════════════════ */

/* Ukryj oryginalny sidebar — widget przeniesiony do drawera przez JS.
   Specyficzność z `.site-content` (1,2,0) > reguła `display:block` w 50-woocommerce.css (1,1,0),
   więc pusty #secondary NIGDY nie zostawi pionowej luki nad treścią (order:-1 w flex column). */
@media ( max-width: 1023px ) {
	.woocommerce-page .site-content #secondary,
	.post-type-archive-product .site-content #secondary,
	.tax-product_cat .site-content #secondary {
		display: none !important;
		width: 0 !important;
		min-width: 0 !important;
		height: 0 !important;
		min-height: 0 !important;
		margin: 0 !important;
		padding: 0 !important;
		flex: 0 0 0 !important;
		order: 0 !important;
	}

	/* Bez resztkowego gap flexa nad treścią, gdy sidebar zniknął */
	.woocommerce-page .site-content,
	.post-type-archive-product .site-content,
	.tax-product_cat .site-content {
		gap: 0 !important;
	}
}

/* Zablokuj scroll body gdy drawer otwarty */
body.kn-drawer-open {
	overflow: hidden;
}

/* ── Przycisk „☰ Kategorie" ── */
.kn-filter-btn {
	display: none; /* pokazany tylko < 1024 px przez @media poniżej */
}

@media ( max-width: 1023px ) {
	.kn-filter-btn {
		display: inline-flex;
		align-items: center;
		gap: 8px;
		background: #fff;
		border: 1.5px solid #c8b99a;
		border-radius: 24px;
		padding: 8px 20px;
		font-size: 0.88rem;
		letter-spacing: 0.05em;
		cursor: pointer;
		margin-bottom: 1.2em;
		color: #3d3d3d;
		transition: background 0.15s ease, border-color 0.15s ease;
		font-family: inherit;
	}
	.kn-filter-btn:hover {
		background: #faf9f7;
		border-color: #a8935c;
	}
}

/* ── Overlay ── */
.kn-drawer-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	z-index: 9990;
}
.kn-drawer-overlay.is-open {
	display: block;
}

/* ── Drawer ── */
.kn-drawer {
	position: fixed;
	top: 0;
	left: 0;
	width: 280px;
	height: 100vh;
	background: #fff;
	z-index: 9999;
	transform: translateX(-100%);
	transition: transform 0.3s ease;
	display: flex;
	flex-direction: column;
	box-shadow: 4px 0 24px rgba(0, 0, 0, 0.14);
}
.kn-drawer.is-open {
	transform: translateX(0);
}

.kn-drawer-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	border-bottom: 1px solid #efe9e1;
	font-size: 0.78rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #9a9087;
	font-weight: 600;
	flex-shrink: 0;
}

.kn-drawer-close {
	background: none;
	border: none;
	font-size: 1.1rem;
	cursor: pointer;
	color: #888;
	padding: 4px 8px;
	line-height: 1;
	border-radius: 4px;
	transition: color 0.15s ease, background 0.15s ease;
}
.kn-drawer-close:hover {
	color: #3d3d3d;
	background: #f5f0ea;
}

.kn-drawer-content {
	flex: 1;
	overflow-y: auto;
	padding: 8px 0;
}

/* Wewnątrz drawera — styl listy taki sam jak na desktopie */
.kn-drawer-content .widget_product_categories {
	background: transparent;
	box-shadow: none;
	border-radius: 0;
	padding: 0;
}
.kn-drawer-content .widget_product_categories .widget-title {
	display: none; /* nagłówek już jest w drawer-header */
}

/* ── Na desktop — ukryj elementy drawera ── */
@media ( min-width: 1024px ) {
	.kn-drawer,
	.kn-drawer-overlay,
	.kn-filter-btn {
		display: none !important;
	}
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR KATEGORII — styl „lewy pasek akcentu" (wariant A)
   Hover/aktywna: zielony pasek po lewej + przesunięcie tekstu.
   Toggle: strzałka „›" po prawej (absolutnie), by link mógł być
   pełnej szerokości z paskiem na lewej krawędzi.
   ═══════════════════════════════════════════════════════════ */
@media ( min-width: 1024px ) {

	.widget_product_categories {
		background: transparent !important;
		border: none !important;
		box-shadow: none !important;
		padding: 0 !important;
	}

	/* Tytuł */
	.widget_product_categories .widget-title {
		font-size: 0.68rem !important;
		letter-spacing: 0.2em !important;
		text-transform: uppercase !important;
		color: #b0a090 !important;
		font-weight: 400 !important;
		margin: 0 0 1.2em !important;
		padding-bottom: 0.6em !important;
		border-bottom: 1px solid #e8e2da !important;
		font-family: inherit !important;
		display: block !important;
	}

	/* Lista */
	.widget_product_categories .product-categories,
	.widget_product_categories .product-categories .children {
		list-style: none !important;
		margin: 0 !important;
		padding: 0 !important;
		background: transparent !important;
		border: none !important;
	}

	/* Wszystkie pozycje — relative pod absolutny toggle */
	.widget_product_categories .product-categories li {
		border: none !important;
		margin: 0 !important;
		padding: 0 !important;
		position: relative;
	}

	/* Usuń border-left z linków top-level — pasek będzie na li::before */
	.widget_product_categories .product-categories > li > a,
	.widget_product_categories .product-categories > li > a:hover,
	.widget_product_categories .product-categories li.current-cat > a,
	.widget_product_categories .product-categories li.current-cat-parent > a,
	.widget_product_categories .product-categories li.current-cat-ancestor > a {
		border-left: none !important;
		padding-left: 0 !important;
	}

	/* Pasek jako pseudo-element na <li> z odstępem od tekstu */
	.widget_product_categories .product-categories > li {
		position: relative;
		padding-left: 12px;
	}
	.widget_product_categories .product-categories > li::before {
		content: '';
		position: absolute;
		left: 0;
		top: 6px;
		bottom: 6px;
		width: 2px;
		background: transparent;
		border-radius: 2px;
		transition: background 0.2s;
	}
	.widget_product_categories .product-categories > li:hover::before {
		background: #6b8f5e;
	}
	.widget_product_categories .product-categories li.current-cat::before,
	.widget_product_categories .product-categories li.current-cat-parent::before,
	.widget_product_categories .product-categories li.current-cat-ancestor::before,
	.widget_product_categories .product-categories li.is-open::before {
		background: #6b8f5e;
	}

	/* Linki top-level — pełna szerokość, oddech od lewej */
	.widget_product_categories .product-categories > li > a {
		display: block !important;
		padding: 8px 24px 8px 0 !important;
		font-size: 0.83rem !important;
		letter-spacing: 0.04em !important;
		color: #5c5047 !important;
		text-decoration: none !important;
		border-bottom: none !important;
		transition: color 0.2s ease !important;
		line-height: 1.4 !important;
	}
	.widget_product_categories .product-categories > li > a:hover {
		color: #6b8f5e !important;
	}

	/* Aktywna kategoria */
	.widget_product_categories .product-categories li.current-cat > a,
	.widget_product_categories .product-categories li.current-cat-parent > a,
	.widget_product_categories .product-categories li.current-cat-ancestor > a {
		color: #6b8f5e !important;
		font-weight: 500 !important;
	}

	/* Podkategorie — samo wcięcie + kolor, ZERO linii/kresek */
	.widget_product_categories .product-categories .children {
		padding-left: 14px !important;
		margin-bottom: 4px !important;
		border: none !important;
		border-left: none !important;
	}
	.widget_product_categories .product-categories .children li {
		border: none !important;
		border-left: none !important;
		padding-left: 0 !important;
	}
	.widget_product_categories .product-categories .children li > a {
		display: block !important;
		padding: 4px 0 4px 16px !important;
		font-size: 0.78rem !important;
		color: #8a7e75 !important;
		text-decoration: none !important;
		border: none !important;
		border-left: none !important;
		transition: color 0.15s ease !important;
		letter-spacing: 0.03em !important;
	}
	.widget_product_categories .product-categories .children li > a::before {
		content: none !important;
	}
	.widget_product_categories .product-categories .children li > a:hover {
		color: #6b8f5e !important;
		border: none !important;
		border-left: none !important;
	}

	/* Toggle „›" — po prawej, absolutnie (nie rozbija block-linka), bez kółka */
	.widget_product_categories .kn-toggle {
		position: absolute !important;
		top: 6px;
		right: 0;
		width: 18px !important;
		height: 18px !important;
		border: none !important;
		border-radius: 0 !important;
		background: none !important;
		cursor: pointer;
		padding: 0 !important;
		margin: 0 !important;
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		z-index: 2;
	}
	.widget_product_categories .kn-toggle::before {
		content: '\203A' !important; /* › */
		font-size: 1.05rem !important;
		color: #b0a090 !important;
		transition: transform 0.2s ease, color 0.2s ease !important;
		display: block !important;
		line-height: 1 !important;
		transform: none !important;
	}
	.widget_product_categories li.is-open > .kn-toggle::before {
		transform: rotate(90deg) !important;
		color: #6b8f5e !important;
	}
}

/* ═══════════════════════════════════════════════════════════
   STRONY BEZ SIDEBARA (CMS: Kontakt, Metody płatności itd.)
   Po usunięciu widżetu kategorii treść zostawała na ~70% przy lewej
   ścianie (Storefront 'right-sidebar'). Tu rozciągamy ją na pełną,
   wyśrodkowaną szerokość kontenera.
   ═══════════════════════════════════════════════════════════ */
.kn-no-sidebar #primary.content-area,
.kn-no-sidebar .content-area {
	width: 100% !important;
	float: none !important;
	margin-left: auto !important;
	margin-right: auto !important;
}
.kn-no-sidebar #secondary {
	display: none !important;
}

