/**
 * Kiwwwi Discounts — osnovni videz.
 *
 * Namenoma skromno. Vsak modul dobi svoj razred `.kwd-block--<id>`, zato
 * prilagajaš tam in te datoteke ne spreminjaš.
 */

.kwd-block {
	margin: 24px 0;
}

.kwd-block__title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 12px;
}

.kwd-block__items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
}

.kwd-card {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: 4px;
	background: #fff;
}

.kwd-card.is-in-cart {
	border-color: currentColor;
}

.kwd-card__media img {
	display: block;
	width: 100%;
	height: auto;
}

.kwd-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.kwd-card__name {
	font-size: 0.875rem;
	line-height: 1.35;
}

.kwd-card__price {
	display: flex;
	align-items: baseline;
	gap: 6px;
	flex-wrap: wrap;
}

.kwd-card__price del {
	opacity: 0.55;
	font-size: 0.8125rem;
}

.kwd-card__price ins {
	text-decoration: none;
	font-weight: 600;
}

.kwd-add,
.kwd-card__link {
	display: inline-block;
	text-align: center;
	padding: 8px 12px;
	border: 0;
	border-radius: 3px;
	cursor: pointer;
	font-size: 0.8125rem;
	line-height: 1.2;
}

.kwd-add[disabled] {
	cursor: default;
	opacity: 0.6;
}

.kwd-add.is-loading {
	position: relative;
	color: transparent;
}

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

.kwd-add[data-kwd-error]::before {
	content: attr(data-kwd-error);
	display: block;
	font-size: 0.75rem;
	margin-bottom: 4px;
}

.kwd-card__added {
	font-size: 0.8125rem;
	opacity: 0.7;
}

.kwd-add:focus-visible,
.kwd-card__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

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

@media (prefers-reduced-motion: reduce) {
	.kwd-add.is-loading::after {
		animation-duration: 2s;
	}
}

/* Variabilni izdelek — izbirnik različic na kartici. */
.kwd-card__attrs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.kwd-card__attr {
	width: 100%;
	max-width: 100%;
	padding: 6px 8px;
	font-size: 0.8125rem;
	line-height: 1.2;
	border: 1px solid rgba(0, 0, 0, 0.18);
	border-radius: 3px;
	background: #fff;
	margin: 0;
}

/* Chevron so the variation picker reads as a dropdown. `select` in the
   selector outranks the per-module `.kwd-block--x .kwd-card__attr` padding
   resets, so text never runs under the arrow. */
.kwd-card select.kwd-card__attr {
	-webkit-appearance: none;
	appearance: none;
	padding-right: 30px;
	background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%232f5d50' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>") no-repeat right 8px center / 16px 16px;
	cursor: pointer;
}

.kwd-card select.kwd-card__attr:hover {
	border-color: #2f5d50;
}

.kwd-card.is-variable .kwd-card__price ins {
	transition: opacity 0.12s ease;
}

/* Touch targets — on phones every add button must clear 44px regardless of
   the per-module sizing above it. Measured at 375px the module styles land
   at 28–30px, which is below the tappable floor. */
@media (max-width: 549px) {
	.kwd-add,
	.kwd-card__link {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	.kwd-card__attr {
		min-height: 40px;
	}
}
