/* ===========================================================
   WC Free Gifts — Frontend styles
   Designed to play nice with Woodmart and most WC themes.
   =========================================================== */

.wcfg-wrapper {
	margin: 32px 0;
}

.wcfg-rule {
	--wcfg-cols: 4;
	--wcfg-gap: 16px;
	--wcfg-radius: 14px;
	--wcfg-accent: #16a34a;
	--wcfg-accent-dark: #0e7a36;
	--wcfg-bg: #ffffff;
	--wcfg-border: rgba(0,0,0,.08);
	--wcfg-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);

	background: linear-gradient(180deg, rgba(22,163,74,.04), rgba(22,163,74,0)) , var(--wcfg-bg);
	border: 1px solid var(--wcfg-border);
	border-radius: var(--wcfg-radius);
	padding: 20px;
	box-shadow: var(--wcfg-shadow);
	margin: 0 0 24px;
}

.wcfg-rule__header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px 16px;
	margin-bottom: 16px;
}
.wcfg-rule__title {
	margin: 0;
	font-size: 1.25rem;
	line-height: 1.2;
	color: inherit;
	flex: 1 1 auto;
}
.wcfg-rule__title::before {
	content: "\1F381";
	margin-right: 8px;
	filter: saturate(.7);
}
.wcfg-rule__subtitle {
	flex: 1 1 100%;
	margin: 0;
	font-size: .92rem;
	color: rgba(0,0,0,.6);
}
.wcfg-rule__progress {
	font-size: .85rem;
	color: var(--wcfg-accent-dark);
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(22,163,74,.12);
}

/* ---------- Grid ---------- */
.wcfg-grid {
	display: grid;
	grid-template-columns: repeat(var(--wcfg-cols), minmax(0, 1fr));
	gap: var(--wcfg-gap);
}

/* ---------- Card ---------- */
.wcfg-card {
	background: #fff;
	border: 1px solid var(--wcfg-border);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
	position: relative;
}
.wcfg-card:hover:not(.is-oos):not(.is-locked) {
	transform: translateY(-2px);
	box-shadow: 0 8px 24px rgba(0,0,0,.08);
}
.wcfg-card.is-chosen {
	border-color: var(--wcfg-accent);
	box-shadow: 0 0 0 2px rgba(22,163,74,.15);
}
.wcfg-card.is-oos { opacity: .55; }
.wcfg-card.is-locked { opacity: .65; }

.wcfg-card__media {
	position: relative;
	aspect-ratio: 1 / 1;
	background: #f7f7f7;
	overflow: hidden;
}
.wcfg-card__media img,
.wcfg-card__img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
	display: block;
}
/* Scoped strictly to the gift card media so it can never float as a stray
   bubble inside the cart table or anywhere else. */
.wcfg-card__media .wcfg-gift-badge {
	position: absolute;
	top: 10px;
	left: 10px;
	background: var(--wcfg-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .04em;
	padding: 4px 9px;
	border-radius: 999px;
	text-transform: uppercase;
	box-shadow: 0 2px 6px rgba(22,163,74,.3);
	z-index: 2;
}
.wcfg-oos-badge {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(0,0,0,.7);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	padding: 4px 9px;
	border-radius: 999px;
	text-transform: uppercase;
}
.wcfg-card.is-chosen .wcfg-card__media::after {
	content: "\2713";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 56px;
	color: #fff;
	background: rgba(22,163,74,.45);
	font-weight: 700;
}

.wcfg-card__body {
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1 1 auto;
}
.wcfg-card__title {
	font-size: .95rem;
	line-height: 1.3;
	margin: 0;
	font-weight: 600;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.wcfg-card__desc {
	font-size: .82rem;
	color: rgba(0,0,0,.6);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.wcfg-card__price {
	font-size: .9rem;
	display: flex;
	align-items: baseline;
	gap: 6px;
}
.wcfg-card__price del { color: rgba(0,0,0,.4); text-decoration: line-through; }
.wcfg-card__price ins {
	color: var(--wcfg-accent);
	font-weight: 700;
	text-decoration: none;
}

/* ---------- Buttons ---------- */
.wcfg-btn {
	margin-top: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border: 0;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: .9rem;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s ease, transform .12s ease, opacity .15s ease;
	width: 100%;
}
.wcfg-btn--choose {
	background: var(--wcfg-accent);
	color: #fff;
}
.wcfg-btn--choose:hover { background: var(--wcfg-accent-dark); }
.wcfg-btn--choose:disabled { background: #cbd5e1; color: #fff; cursor: not-allowed; }
.wcfg-btn--remove {
	background: rgba(0,0,0,.06);
	color: rgba(0,0,0,.75);
}
.wcfg-btn--remove:hover { background: rgba(0,0,0,.12); }
.wcfg-btn--disabled,
.wcfg-btn[disabled] { cursor: not-allowed; opacity: .55; }

.wcfg-btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.wcfg-btn.is-loading::after {
	content: "";
	position: absolute;
	width: 18px; height: 18px;
	border: 2px solid rgba(255,255,255,.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: wcfg-spin .8s linear infinite;
	left: 50%; top: 50%; margin: -9px 0 0 -9px;
}
.wcfg-btn--remove.is-loading::after { border-color: rgba(0,0,0,.25); border-top-color: rgba(0,0,0,.7); }
@keyframes wcfg-spin { to { transform: rotate(360deg); } }

/* ---------- Carousel ---------- */
.wcfg-swiper {
	position: relative;
	padding: 4px 4px 8px;
	overflow: visible;
	/* Make some room around so arrows can sit at the edge without clipping. */
}
.wcfg-swiper .swiper-wrapper { align-items: stretch; }
.wcfg-swiper .swiper-slide {
	height: auto;
	display: flex;
	box-sizing: border-box;
}
.wcfg-swiper .swiper-slide > .wcfg-card { width: 100%; }

/* Arrows: positioned at the rule edges, not on top of slides. */
/* Arrows — hardened against theme overrides (Woodmart et al.) via !important
   on the structural/visual props that themes most often touch. */
.wcfg-rule .wcfg-swiper-prev,
.wcfg-rule .wcfg-swiper-next {
	position: absolute !important;
	top: 50% !important;
	transform: translateY(-50%) !important;
	width: 48px !important;
	height: 48px !important;
	min-width: 48px !important;
	padding: 0 !important;
	margin: 0 !important;
	border-radius: 50% !important;
	border: 0 !important;
	background: var(--wcfg-accent, #16a34a) !important;
	color: #fff !important;
	box-shadow: 0 6px 18px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.12) !important;
	cursor: pointer !important;
	z-index: 20 !important;
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	opacity: 1 !important;
	outline: none !important;
	transition: transform .15s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease !important;
	-webkit-appearance: none !important;
	appearance: none !important;
}
.wcfg-rule .wcfg-swiper-prev::before,
.wcfg-rule .wcfg-swiper-next::before,
.wcfg-rule .wcfg-swiper-prev::after,
.wcfg-rule .wcfg-swiper-next::after {
	display: none !important; /* kill any theme/Swiper pseudo-element glyphs */
}
.wcfg-rule .wcfg-swiper-prev svg,
.wcfg-rule .wcfg-swiper-next svg {
	width: 24px !important;
	height: 24px !important;
	display: block !important;
	stroke: #fff !important;
	fill: none !important;
	pointer-events: none;
}
.wcfg-rule .wcfg-swiper-prev { left: -18px !important; }
.wcfg-rule .wcfg-swiper-next { right: -18px !important; }
.wcfg-rule .wcfg-swiper-prev:hover,
.wcfg-rule .wcfg-swiper-next:hover {
	background: var(--wcfg-accent-dark, #0e7a36) !important;
	transform: translateY(-50%) scale(1.08) !important;
	box-shadow: 0 8px 22px rgba(0,0,0,.28) !important;
}
.wcfg-rule .wcfg-swiper-prev.swiper-button-disabled,
.wcfg-rule .wcfg-swiper-next.swiper-button-disabled {
	opacity: .35 !important;
	cursor: not-allowed !important;
	pointer-events: none !important;
	box-shadow: none !important;
}

/* Pagination — better spacing, bigger hit area, accent color, modern feel. */
.wcfg-swiper-pagination {
	position: relative;
	margin-top: 18px;
	text-align: center;
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	min-height: 14px;
}
.wcfg-swiper-pagination .swiper-pagination-bullet {
	width: 8px;
	height: 8px;
	background: rgba(0,0,0,.18);
	opacity: 1;
	margin: 0 !important;
	border-radius: 999px;
	transition: width .25s ease, background .25s ease, transform .15s ease;
	cursor: pointer;
}
.wcfg-swiper-pagination .swiper-pagination-bullet:hover {
	background: rgba(0,0,0,.35);
}
.wcfg-swiper-pagination .swiper-pagination-bullet-active {
	background: var(--wcfg-accent, #16a34a);
	width: 28px;
}

/* Dynamic bullets (Swiper auto-adds the dynamic main class) */
.wcfg-swiper-pagination.swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
	transform: scale(1);
}
.wcfg-swiper-pagination.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main { transform: scale(1); }
.wcfg-swiper-pagination.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev,
.wcfg-swiper-pagination.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next { transform: scale(.85); opacity: .7; }
.wcfg-swiper-pagination.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev,
.wcfg-swiper-pagination.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next { transform: scale(.6); opacity: .4; }

/* Fraction & progressbar pagination */
.wcfg-swiper-pagination.swiper-pagination-fraction {
	font-size: .85rem;
	font-weight: 600;
	color: rgba(0,0,0,.6);
}
.wcfg-swiper-pagination.swiper-pagination-progressbar {
	height: 4px;
	background: rgba(0,0,0,.08);
	border-radius: 999px;
	overflow: hidden;
	width: 60%;
	margin-left: auto;
	margin-right: auto;
	gap: 0;
}
.wcfg-swiper-pagination.swiper-pagination-progressbar .swiper-pagination-progressbar-fill {
	background: var(--wcfg-accent, #16a34a);
	border-radius: 999px;
}

/* Make sure pagination element is hidden if not used (Swiper would render an empty one) */
.wcfg-swiper:not(.has-pagination) .wcfg-swiper-pagination { display: none; }
.wcfg-swiper:not(.has-arrows) .wcfg-swiper-prev,
.wcfg-swiper:not(.has-arrows) .wcfg-swiper-next { display: none; }

/* ---------- Modal ---------- */
.wcfg-modal {
	position: fixed; inset: 0;
	display: none;
	z-index: 99999;
}
.wcfg-modal.is-open { display: flex; align-items: center; justify-content: center; }
.wcfg-modal__backdrop {
	position: absolute; inset: 0;
	background: rgba(15, 23, 42, .55);
	backdrop-filter: blur(2px);
}
.wcfg-modal__panel {
	position: relative;
	background: #fff;
	max-width: 520px;
	width: calc(100% - 32px);
	max-height: calc(100vh - 32px);
	overflow: auto;
	border-radius: 16px;
	padding: 24px;
	box-shadow: 0 20px 60px rgba(0,0,0,.25);
	animation: wcfg-pop .18s ease both;
}
@keyframes wcfg-pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wcfg-modal__close {
	position: absolute;
	top: 8px; right: 10px;
	background: transparent;
	border: 0;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: rgba(0,0,0,.55);
}
.wcfg-modal__close:hover { color: #000; }
.wcfg-modal__body { font-size: .95rem; }
.wcfg-modal__loading { text-align: center; padding: 32px 0; color: rgba(0,0,0,.55); }

.wcfg-mv__head {
	display: flex;
	gap: 14px;
	align-items: center;
	margin-bottom: 16px;
}
.wcfg-mv__img {
	width: 90px; height: 90px;
	border-radius: 10px;
	object-fit: cover;
	background: #f4f4f4;
	flex: 0 0 auto;
}
.wcfg-mv__title { margin: 0; font-size: 1.05rem; }

.wcfg-mv__attrs { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.wcfg-mv__attr label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; color: rgba(0,0,0,.6); }
.wcfg-mv__attr select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--wcfg-border);
	border-radius: 8px;
	font-size: .95rem;
	background: #fff;
}

.wcfg-mv__cta {
	width: 100%;
	background: var(--wcfg-accent);
	color: #fff;
	border: 0;
	border-radius: 10px;
	padding: 12px 16px;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
}
.wcfg-mv__cta:disabled { background: #cbd5e1; cursor: not-allowed; }

.wcfg-mv__hint { font-size: .82rem; color: #b91c1c; margin: 8px 0 0; min-height: 1em; }

/* ---------- Cart row tweaks ---------- */
.wcfg-cart-free {
	display: inline-block;
	background: var(--wcfg-accent, #16a34a);
	color: #fff;
	font-weight: 700;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: .8rem;
	letter-spacing: .03em;
}
.wcfg-gift-qty {
	display: inline-block;
	padding: 4px 10px;
	background: rgba(0,0,0,.06);
	border-radius: 6px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
	.wcfg-rule--grid { --wcfg-cols: min(var(--wcfg-cols), 3); }
}
@media (max-width: 768px) {
	.wcfg-rule { padding: 16px; }
	.wcfg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.wcfg-rule__title { font-size: 1.1rem; }
	.wcfg-card__title { font-size: .88rem; }

	/* On tablet/mobile bring arrows inside the carousel so they don't overflow. */
	.wcfg-rule .wcfg-swiper-prev { left: 4px !important; }
	.wcfg-rule .wcfg-swiper-next { right: 4px !important; }
	.wcfg-rule .wcfg-swiper-prev,
	.wcfg-rule .wcfg-swiper-next {
		width: 42px !important;
		height: 42px !important;
		min-width: 42px !important;
	}
}
@media (max-width: 480px) {
	.wcfg-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
	.wcfg-card__body { padding: 10px; }
	.wcfg-btn { font-size: .82rem; padding: 9px 10px; }

	.wcfg-rule .wcfg-swiper-prev,
	.wcfg-rule .wcfg-swiper-next { width: 38px !important; height: 38px !important; min-width: 38px !important; }
	.wcfg-rule .wcfg-swiper-prev svg,
	.wcfg-rule .wcfg-swiper-next svg { width: 20px !important; height: 20px !important; }
}
