/* ==========================================================================
   Ercik Buty – komponenty współdzielone
   ========================================================================== */

/* --- Przyciski ------------------------------------------------------------ */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	padding: 12px 20px;
	min-height: 46px;
	border-radius: var(--r-pill);
	font-weight: 700;
	font-size: var(--fs-sm);
	line-height: 1;
	border: 1px solid transparent;
	transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
	text-align: center;
}

.btn:active {
	transform: scale(0.98);
}

.btn--primary {
	background: var(--c-accent);
	color: #fff;
}

.btn--primary:hover {
	background: var(--c-accent-dark);
	color: #fff;
}

.btn--secondary {
	background: var(--c-ink);
	color: #fff;
}

.btn--secondary:hover {
	background: #000;
	color: #fff;
}

.btn--ghost {
	background: transparent;
	border-color: var(--c-line);
	color: var(--c-ink);
}

.btn--ghost:hover {
	border-color: var(--c-ink);
	color: var(--c-ink);
}

.btn--sm {
	min-height: 38px;
	padding: 8px 14px;
	font-size: var(--fs-xs);
}

.btn--lg {
	min-height: 54px;
	padding: 16px 28px;
	font-size: var(--fs-base);
}

.btn--block {
	display: flex;
	width: 100%;
}

.btn[disabled],
.btn.is-disabled {
	opacity: 0.5;
	pointer-events: none;
}

.btn.is-loading {
	position: relative;
	color: transparent !important;
}

.btn.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	margin: auto;
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	color: #fff;
	animation: ercik-spin 0.7s linear infinite;
}

@keyframes ercik-spin {
	to {
		transform: rotate(360deg);
	}
}

/* --- CTA kontaktowe ------------------------------------------------------- */

.cta-group {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
}

.cta {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--sp-2);
	flex: 1 1 140px;
	min-height: 52px;
	padding: 12px 18px;
	border-radius: var(--r-pill);
	font-weight: 700;
	font-size: var(--fs-sm);
	color: #fff;
	transition: filter 0.15s var(--ease), transform 0.1s var(--ease);
}

.cta:hover {
	color: #fff;
	filter: brightness(1.06);
}

.cta:active {
	transform: scale(0.98);
}

.cta--whatsapp { background: var(--c-whatsapp); }
.cta--messenger { background: var(--c-messenger); }
.cta--sms { background: var(--c-sms); }

.cta--phone {
	background: transparent;
	color: var(--c-ink);
	border: 1px solid var(--c-line);
}

.cta--phone:hover {
	color: var(--c-ink);
	border-color: var(--c-ink);
}

.site-footer .cta--phone {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.25);
}

.cta-group--stack .cta {
	flex: 1 1 100%;
}

/* --- Plakietki ------------------------------------------------------------ */

.badge {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 10px;
	border-radius: var(--r-pill);
	font-size: var(--fs-xs);
	font-weight: 700;
	letter-spacing: 0.02em;
	line-height: 1.4;
	white-space: nowrap;
}

.badge--new {
	background: var(--c-new-soft);
	color: var(--c-new);
}

.badge--return {
	background: var(--c-return-soft);
	color: var(--c-return);
}

.badge--used {
	background: var(--c-used-soft);
	color: var(--c-used);
}

.badge--sold {
	background: var(--c-ink);
	color: #fff;
}

.badge--size {
	background: var(--c-ink);
	color: #fff;
	font-size: var(--fs-sm);
	padding: 5px 12px;
}

.badge--outline {
	background: transparent;
	border: 1px solid var(--c-line);
	color: var(--c-ink-2);
}

/* --- Karta produktu ------------------------------------------------------- */

.product-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--sp-3);
}

@media (min-width: 620px) {
	.product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--sp-4);
	}
}

@media (min-width: 1000px) {
	.product-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--c-bg);
	border: 1px solid var(--c-line);
	border-radius: var(--r-md);
	overflow: hidden;
	transition: border-color 0.15s var(--ease), box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}

@media (hover: hover) {
	.product-card:hover {
		border-color: transparent;
		box-shadow: var(--shadow-md);
		transform: translateY(-2px);
	}
}

.product-card__media {
	position: relative;
	display: block;
	aspect-ratio: 4 / 5;
	background: var(--c-bg-alt);
	overflow: hidden;
}

.product-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s var(--ease);
}

@media (hover: hover) {
	.product-card:hover .product-card__media img {
		transform: scale(1.04);
	}
}

.product-card__badges {
	position: absolute;
	top: var(--sp-2);
	left: var(--sp-2);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	z-index: 2;
}

.product-card__size {
	position: absolute;
	right: var(--sp-2);
	bottom: var(--sp-2);
	z-index: 2;
	background: rgba(17, 20, 24, 0.88);
	color: #fff;
	border-radius: var(--r-sm);
	padding: 4px 10px;
	font-size: var(--fs-sm);
	font-weight: 800;
	letter-spacing: -0.01em;
}

.product-card__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: var(--sp-3);
	flex: 1 1 auto;
}

.product-card__brand {
	font-size: var(--fs-xs);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--c-ink-3);
	font-weight: 700;
}

.product-card__title {
	margin: 0;
	font-size: var(--fs-sm);
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.product-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.product-card__meta {
	margin-top: auto;
	padding-top: var(--sp-2);
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--sp-2);
}

.product-card__price {
	font-size: var(--fs-md);
	font-weight: 800;
	letter-spacing: -0.02em;
}

.product-card.is-sold .product-card__media img {
	filter: grayscale(1);
	opacity: 0.55;
}

.product-card.is-sold .product-card__price {
	color: var(--c-ink-3);
}

/* --- Pigułki rozmiarów ---------------------------------------------------- */

.size-pills {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
}

.size-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 54px;
	min-height: 44px;
	padding: 0 var(--sp-3);
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	background: var(--c-bg);
	font-weight: 700;
	font-size: var(--fs-sm);
	transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.size-pill:hover {
	border-color: var(--c-ink);
	color: var(--c-ink);
}

.size-pill.is-active,
.size-pill[aria-pressed="true"] {
	background: var(--c-ink);
	border-color: var(--c-ink);
	color: #fff;
}

.size-pill__count {
	font-size: var(--fs-xs);
	font-weight: 500;
	opacity: 0.6;
	margin-left: 4px;
}

.size-pill[disabled] {
	opacity: 0.35;
	pointer-events: none;
}

/* --- Formularze ----------------------------------------------------------- */

.field {
	display: block;
	margin-bottom: var(--sp-4);
}

.field__label {
	display: block;
	font-size: var(--fs-sm);
	font-weight: 700;
	margin-bottom: var(--sp-2);
}

.field__hint {
	display: block;
	font-size: var(--fs-xs);
	color: var(--c-ink-3);
	margin-top: var(--sp-1);
}

.input,
.select,
.textarea {
	width: 100%;
	padding: 12px 14px;
	min-height: 48px;
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	background: var(--c-bg);
	font-size: 16px; /* 16px = brak auto-zoomu na iOS */
	transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.input:focus,
.select:focus,
.textarea:focus {
	outline: none;
	border-color: var(--c-ink);
	box-shadow: 0 0 0 3px rgba(17, 20, 24, 0.08);
}

.textarea {
	min-height: 120px;
	resize: vertical;
	line-height: 1.5;
}

.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
	border-color: var(--c-accent);
}

.field__error {
	display: block;
	font-size: var(--fs-xs);
	color: var(--c-accent);
	margin-top: var(--sp-1);
}

.search-form {
	display: flex;
	gap: var(--sp-2);
}

.search-form__field {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
}

.search-form__field .icon {
	position: absolute;
	left: 12px;
	color: var(--c-ink-3);
}

.search-form__input {
	width: 100%;
	padding: 12px 14px 12px 40px;
	min-height: 46px;
	border: 1px solid var(--c-line);
	border-radius: var(--r-pill);
	font-size: 16px;
}

/* --- Panel wysuwany (bottom sheet / drawer) -------------------------------- */

.sheet {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: none;
}

.sheet.is-open {
	display: block;
}

.sheet__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 20, 24, 0.45);
	animation: ercik-fade 0.2s var(--ease);
}

.sheet__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 88vh;
	display: flex;
	flex-direction: column;
	background: var(--c-bg);
	border-radius: var(--r-lg) var(--r-lg) 0 0;
	box-shadow: var(--shadow-lg);
	animation: ercik-slide-up 0.25s var(--ease);
	padding-bottom: env(safe-area-inset-bottom);
}

@keyframes ercik-fade {
	from { opacity: 0; }
}

@keyframes ercik-slide-up {
	from { transform: translateY(100%); }
}

.sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--sp-3);
	padding: var(--sp-4);
	border-bottom: 1px solid var(--c-line);
}

.sheet__title {
	margin: 0;
	font-size: var(--fs-md);
}

.sheet__close {
	width: 40px;
	height: 40px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--c-bg-alt);
}

.sheet__body {
	overflow-y: auto;
	padding: var(--sp-4);
	-webkit-overflow-scrolling: touch;
}

.sheet__foot {
	display: flex;
	gap: var(--sp-3);
	padding: var(--sp-3) var(--sp-4) var(--sp-4);
	border-top: 1px solid var(--c-line);
	background: var(--c-bg);
}

.sheet__foot .btn {
	flex: 1 1 auto;
}

@media (min-width: 900px) {
	.sheet__panel {
		top: 0;
		left: auto;
		width: 420px;
		max-height: none;
		border-radius: 0;
		animation: ercik-slide-left 0.25s var(--ease);
	}

	@keyframes ercik-slide-left {
		from { transform: translateX(100%); }
	}
}

/* --- Toast ---------------------------------------------------------------- */

.toast-stack {
	position: fixed;
	left: 50%;
	bottom: calc(var(--sp-5) + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	z-index: 400;
	display: flex;
	flex-direction: column;
	gap: var(--sp-2);
	width: min(420px, calc(100vw - 32px));
	pointer-events: none;
}

.toast {
	padding: var(--sp-3) var(--sp-4);
	border-radius: var(--r-md);
	background: var(--c-ink);
	color: #fff;
	font-size: var(--fs-sm);
	font-weight: 600;
	box-shadow: var(--shadow-lg);
	animation: ercik-toast-in 0.2s var(--ease);
}

.toast--error {
	background: var(--c-accent-dark);
}

.toast--success {
	background: var(--c-new);
}

@keyframes ercik-toast-in {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

/* --- Paginacja ------------------------------------------------------------ */

.pagination,
.woocommerce-pagination {
	margin-top: var(--sp-6);
	display: flex;
	justify-content: center;
}

.pagination .nav-links,
.woocommerce-pagination ul {
	display: flex;
	gap: var(--sp-2);
	flex-wrap: wrap;
	justify-content: center;
	border: 0 !important;
}

.pagination .page-numbers,
.woocommerce-pagination .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 42px;
	height: 42px;
	padding: 0 var(--sp-3);
	border: 1px solid var(--c-line);
	border-radius: var(--r-sm);
	font-weight: 600;
	font-size: var(--fs-sm);
}

.pagination .page-numbers.current,
.woocommerce-pagination .page-numbers.current {
	background: var(--c-ink);
	border-color: var(--c-ink);
	color: #fff;
}

.woocommerce-pagination li {
	border: 0 !important;
	list-style: none;
}

/* --- Drobne -------------------------------------------------------------- */

.skeleton {
	background: linear-gradient(90deg, var(--c-line-2) 25%, #fafafa 50%, var(--c-line-2) 75%);
	background-size: 400% 100%;
	animation: ercik-skeleton 1.2s ease-in-out infinite;
	border-radius: var(--r-md);
}

@keyframes ercik-skeleton {
	from { background-position: 100% 0; }
	to { background-position: 0 0; }
}

.notice {
	padding: var(--sp-4);
	border-radius: var(--r-md);
	background: var(--c-bg-alt);
	border-left: 3px solid var(--c-ink);
	font-size: var(--fs-sm);
}

.notice--accent {
	background: var(--c-accent-soft);
	border-left-color: var(--c-accent);
}
