/*
 * Search overlay — header search (toggled by .gk-header__icon w `#gk-search-toggle`).
 *
 * IMMUTABLE — wydzielony plik per user mandate 2026-05-28:
 * "header i footer jest globalny, wbij go do glownego pliku".
 *
 * Renderowane w site-header.php (shared partial) + inline w page-strona-glowna.php.
 * Self-contained — solid kolory + brand emerald/forest tokens. NIE polega na home.css scope.
 * Vanilla CSS, no Tailwind. Inline SVG ikony (NIE Material Symbols).
 */

.gk-search-overlay {
	position: fixed;
	top: 82px; /* pod fixed header (82px high) */
	left: 0;
	right: 0;
	z-index: 60; /* powyżej header z-index 50 */
	background: #ffffff;
	box-shadow:
		0 12px 28px rgba(31, 61, 20, 0.10),
		0 24px 60px rgba(0, 0, 0, 0.08);
	border-bottom: 1px solid rgba(31, 61, 20, 0.08);
	transform: translateY(-100%);
	opacity: 0;
	pointer-events: none;
	transition: transform .35s cubic-bezier(.16,1,.3,1), opacity .25s ease;
}
.gk-search-overlay.is-open {
	transform: translateY(0);
	opacity: 1;
	pointer-events: auto;
}

.gk-search-overlay__form {
	max-width: 1440px;
	margin: 0 auto;
	padding: 24px clamp(20px, 4vw, 56px);
	display: flex;
	align-items: center;
	gap: 16px;
}

.gk-search-overlay__icon {
	flex-shrink: 0;
	color: #1F3D14;
	display: block;
}

.gk-search-overlay__input {
	flex: 1;
	background: transparent;
	border: 0;
	font-family: 'Inter', system-ui, -apple-system, sans-serif;
	font-size: 18px;
	font-weight: 500;
	color: #1F3D14;
	padding: 12px 0;
	outline: none;
	min-width: 0; /* flex shrink z input */
}
.gk-search-overlay__input::placeholder {
	color: #9CA3AF;
	font-weight: 400;
}

.gk-search-overlay__submit {
	flex-shrink: 0;
	padding: 14px 28px;
	background: #1F3D14;
	color: #ffffff;
	border: 0;
	border-radius: 9999px;
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.gk-search-overlay__submit:hover {
	background: #5DA935;
	transform: translateY(-1px);
	box-shadow: 0 8px 20px rgba(93, 169, 53, 0.25);
}
.gk-search-overlay__submit:focus-visible {
	outline: 2px solid #5DA935;
	outline-offset: 3px;
}

.gk-search-overlay__close {
	flex-shrink: 0;
	background: transparent;
	border: 0;
	padding: 8px;
	color: #6B7280;
	cursor: pointer;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	transition: background .2s ease, color .2s ease;
}
.gk-search-overlay__close:hover {
	background: #FAF8F4;
	color: #1F3D14;
}
.gk-search-overlay__close svg {
	display: block;
	pointer-events: none;
}

.gk-search-overlay__pills {
	/* 2026-05-31: ukryte na życzenie ("usuń te popularne") — czysty pasek wyszukiwania */
	display: none !important;
	max-width: 1440px;
	margin: 0 auto;
	padding: 0 clamp(20px, 4vw, 56px) 24px;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
}
.gk-search-overlay__pills-label {
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 11px;
	font-weight: 700;
	color: #9CA3AF;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	margin-right: 4px;
}
.gk-search-overlay__pills a {
	padding: 8px 16px;
	background: #FAF8F4;
	border: 1px solid rgba(31, 61, 20, 0.08);
	border-radius: 9999px;
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 13px;
	font-weight: 600;
	color: #1F3D14;
	text-decoration: none;
	transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease;
}
.gk-search-overlay__pills a:hover {
	background: #5DA935;
	border-color: #5DA935;
	color: #ffffff;
	transform: translateY(-1px);
}

/* Mobile — FIX 2026-05-31: overlay miał min-height:280px + padding-top:32px (per-page,
   pod pills które są teraz ukryte) → 200px pustego białego tła. #id (1,0,0) bije
   page-scoped body.X .gk-search-overlay (0,2,0). Cel: wysokość ~ header. */
@media (max-width: 767px) {
	#gk-search-overlay { min-height: 0 !important; padding-top: 6px !important; }
	#gk-search-overlay .gk-search-overlay__form { padding-top: 10px; padding-bottom: 12px; }
}

/* Mobile */
@media (max-width: 640px) {
	.gk-search-overlay__form {
		padding: 16px 18px;
		gap: 10px;
	}
	.gk-search-overlay__input {
		font-size: 16px;
	}
	.gk-search-overlay__submit {
		padding: 12px 18px;
		font-size: 12px;
	}
	.gk-search-overlay__pills {
		padding: 0 18px 18px;
	}
}

/* ───────────────────────────────────────────────────────────────
   LIVE SEARCH RESULTS — debounce 250ms / min 3 chars / max 6 cards
   Per user mandate 2026-05-28. Hardcoded hex (globalny komponent).
   ─────────────────────────────────────────────────────────── */
.gk-live-search {
	max-width: 1200px;
	margin: 24px auto 0;
	padding: 0 28px 28px;
	width: 100%;
	box-sizing: border-box;
}
.gk-live-search[hidden] { display: none; }

.gk-live-search__grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 12px;
}

.gk-live-search__card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px 10px 14px;
	background: #FFFFFF;
	border: 1px solid #EEEAE3;
	border-radius: 14px;
	text-decoration: none;
	color: #1F3D14;
	transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
	cursor: pointer;
	outline: none;
}
.gk-live-search__card:hover,
.gk-live-search__card:focus-visible {
	border-color: #5DA935;
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(31, 61, 20, 0.10);
}
.gk-live-search__card-image {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: #FAF8F4 center / contain no-repeat;
	border-radius: 10px;
}
.gk-live-search__card-title {
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.35;
	color: #1F3D14;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 36px;
}
.gk-live-search__card-title mark {
	background: #FFF3B0;
	color: #1F3D14;
	padding: 0 2px;
	border-radius: 3px;
}
.gk-live-search__card-price {
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 14px;
	font-weight: 800;
	color: #009668;
	letter-spacing: -0.01em;
}
.gk-live-search__card-price del {
	font-size: 11px;
	font-weight: 500;
	color: #9CA396;
	margin-right: 4px;
}
.gk-live-search__card-price ins {
	background: transparent;
	color: #009668;
	text-decoration: none;
}

/* Skeleton — shimmer placeholder */
.gk-live-search__card--skeleton {
	pointer-events: none;
	cursor: default;
}
.gk-live-search__card--skeleton .gk-live-search__card-image,
.gk-live-search__card--skeleton .gk-live-search__card-title,
.gk-live-search__card--skeleton .gk-live-search__card-price {
	background: linear-gradient(90deg, #F5F1EA 0%, #ECE6DC 50%, #F5F1EA 100%);
	background-size: 200% 100%;
	color: transparent;
	border-radius: 6px;
	animation: gkSearchShimmer 1.2s linear infinite;
}
.gk-live-search__card--skeleton .gk-live-search__card-image {
	border-radius: 10px;
}
.gk-live-search__card--skeleton .gk-live-search__card-title {
	height: 36px;
}
.gk-live-search__card--skeleton .gk-live-search__card-price {
	height: 18px;
	width: 60%;
}
@keyframes gkSearchShimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* Empty state */
.gk-live-search__empty {
	grid-column: 1 / -1;
	padding: 28px 24px;
	background: #FAF8F4;
	border: 1px dashed #DDD4C5;
	border-radius: 14px;
	text-align: center;
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 14px;
	color: #5A6354;
	line-height: 1.5;
}
.gk-live-search__empty strong {
	color: #1F3D14;
	font-weight: 700;
}
.gk-live-search__empty em {
	font-style: normal;
	color: #4F9028;
	font-weight: 600;
}

/* View-all link */
.gk-live-search__view-all {
	display: flex;
	width: fit-content;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 16px auto 0;          /* wyśrodkowany w kontenerze wyników */
	padding: 10px 18px;
	background: #1F3D14;
	color: #FFFFFF;
	border-radius: 9999px;
	font-family: 'Inter', system-ui, sans-serif;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.01em;
	text-decoration: none;
	transition: background .2s ease, transform .2s ease;
}
/* Napis biały — wygrywa nad globalnym kolorem linków (cascade override). */
#gk-live-results .gk-live-search__view-all,
#gk-live-results .gk-live-search__view-all:link,
#gk-live-results .gk-live-search__view-all:visited {
	color: #FFFFFF !important;
}
.gk-live-search__view-all:hover {
	background: #5DA935;
	transform: translateY(-1px);
}
.gk-live-search__view-all[hidden] { display: none; }

/* Responsive grid */
@media (max-width: 1024px) {
	.gk-live-search__grid { grid-template-columns: repeat(4, 1fr); }
	.gk-live-search { padding: 0 22px 22px; }
}
@media (max-width: 768px) {
	.gk-live-search__grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
	.gk-live-search__grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
	.gk-live-search { padding: 0 16px 18px; }
	.gk-live-search__card-title { font-size: 12px; min-height: 32px; }
	.gk-live-search__card-price { font-size: 13px; }
}
