/*
 * JC Product Configurator v2.0 styles
 * BEM, scoped to #jc-configurator (hero + progress bar use top-level classes)
 * Inherits Kadence --global-palette* vars for colour consistency
 */

/* ====================================================================
   Container
==================================================================== */
#jc-configurator {
	max-width: 100%;
	margin: 0;
	font-family: inherit;
}

/* ====================================================================
   Hero section
==================================================================== */
.jc-hero {
	position: relative;
	min-height: 60vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background-size: cover;
	background-position: center;
	background-color: #f5f5f5;
	padding: 4rem 2rem;
	text-align: center;
	overflow: hidden;
}

.jc-hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,.35);
	pointer-events: none;
}

.jc-hero__content {
	position: relative;
	z-index: 1;
	max-width: 680px;
	color: #fff;
}

.jc-hero__image {
	max-width: 180px;
	height: auto;
	margin-bottom: 1.5rem;
	display: block;
	margin-inline: auto;
}

.jc-hero__title {
	font-size: clamp(1.8rem, 4vw, 3rem);
	font-weight: 700;
	line-height: 1.2;
	margin: 0 0 1rem;
	color: #fff;
}

.jc-hero__body {
	font-size: 1.05rem;
	line-height: 1.7;
	margin: 0 auto 2rem;
	opacity: .9;
}

.jc-hero__body p { margin: 0 0 .75em; }

.jc-hero__cta {
	font-size: 1.05rem !important;
	padding: 0.85rem 2.5rem !important;
	letter-spacing: .03em;
}

/* ====================================================================
   Sticky progress bar
==================================================================== */
#jc-progress {
	position: sticky;
	top: 0; /* overridden by JS with actual header height */
	z-index: 200;
	background: var(--global-palette8, #121212);
	border-bottom: 2px solid #2a2a2a;
	display: flex;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
	transition: box-shadow .2s;
}

#jc-progress::-webkit-scrollbar { display: none; }

#jc-progress[aria-hidden="false"] {
	box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

#jc-progress[aria-hidden="true"] {
	display: none;
}

.jc-progress__step {
	flex: 1;
	min-width: 80px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.25rem;
	padding: 0.6rem 0.5rem;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.72rem;
	color: #666;
	text-align: center;
	transition: .15s linear;
	border-bottom: 3px solid transparent;
}

.jc-progress__step:hover {
	color: var(--global-palette2, #97c2b8);
	background: rgba(255,255,255,.04);
}

.jc-progress__number {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background-color: #3b3b3b;
	color: #b3b3b3;
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	font-size: 0.78rem;
	transition: background-color .2s, color .2s;
	flex-shrink: 0;
}

.jc-progress__step--active {
	color: #fff;
	border-bottom-color: var(--global-palette2, #97c2b8);
}

.jc-progress__step--active .jc-progress__number {
	background: var(--global-palette9, #121212);
	color: #fff;
}

.jc-progress__step--completed {
	color: var(--global-palette2, #555);
}

.jc-progress__step--completed .jc-progress__number {
	background: var(--global-palette2, #555);
	color: #fff;
}

.jc-progress__step--locked {
	opacity: .4;
	cursor: default;
	pointer-events: none;
}

/* ====================================================================
   Steps container + individual steps
==================================================================== */
#jc-steps {
	background: var(--global-palette8, #121212);
	max-width: none;
	padding: 0;
}

#jc-steps[aria-hidden="true"] {
	display: none;
}

.jc-step {
	position: relative;
	width: min(1000px, 100%);
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
	padding: 3rem 1.25rem;
	border-bottom: 1px solid #2a2a2a;
	scroll-margin-top: 180px; /* compensate sticky bar + header + admin bar */
}

.jc-step:not(.jc-step--locked):not(:last-child)::after {
	content: '';
	position: absolute;
	bottom: -10px;
	left: 50%;
	transform: translateX(-50%) rotate(45deg);
	width: 18px;
	height: 18px;
	border-right: 2px solid #444;
	border-bottom: 2px solid #444;
	background: var(--global-palette8, #121212);
	z-index: 1;
}

.jc-step:last-child {
	border-bottom: none;
	padding-bottom: 4rem;
}

.jc-step--locked {
	display: none;
	pointer-events: none;
	user-select: none;
}

/* ====================================================================
   Step header
==================================================================== */
.jc-step-header {
	margin-bottom: 1.5rem;
}

.jc-step-header__title {
	margin: 0 0 0.25rem;
	font-size: 1.3rem;
	font-weight: 700;
	color: #fff;
}

.jc-step-header__desc {
	margin: 0;
	color: #888;
	font-size: 0.92rem;
}

/* ====================================================================
   Card grid (shared: category, tessuto, bottone)
==================================================================== */
.jc-card-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1rem;
	margin-bottom: 1.5rem;
}

/* Compact grids for tessuto and bottone — smaller tiles, denser layout */
#jc-card-grid-tessuto,
#jc-card-grid-bottone {
	grid-template-columns: repeat(auto-fill, minmax(125px, 1fr));
	gap: 0.75rem;
}

.jc-card {
	position: relative;
	border: 2px solid #333;
	border-radius: 8px;
	cursor: pointer;
	background: #1e1e1e;
	overflow: hidden;
	outline: none;
	transition: border-color .15s, box-shadow .15s;
}

.jc-card:hover,
.jc-card:focus-visible {
	border-color: var(--global-palette2, #555);
	box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.jc-card--selected {
	border-color: var(--global-palette2, #97c2b8);
	box-shadow: 0 0 0 3px rgba(151,194,184,.12);
}

.jc-card__image-wrap {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #2a2a2a;
}

.jc-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .2s;
}

.jc-card:hover .jc-card__image {
	transform: scale(1.04);
}

.jc-card__body {
	padding: 0.5rem;
}

.jc-card__title {
	display: block;
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.3;
	color: #fff;
}

.jc-card__meta {
	display: block;
	font-size: 0.75rem;
	color: #777;
	margin-top: 0.2rem;
}

.jc-card__check {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--global-palette2, #97c2b8);
	color: #fff;
	font-size: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity .15s;
	box-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.jc-card--selected .jc-card__check {
	opacity: 1;
}

.jc-card__badge {
	position: absolute;
	top: 0;
	left: 0;
	background: #2d6a5a;
	color: #fff;
	font-size: 0.65rem;
	font-weight: 700;
	padding: 2px 7px;
	text-transform: uppercase;
	letter-spacing: .05em;
	border-bottom-right-radius: 6px;
}

.jc-card__zoom-btn {
	position: absolute;
	bottom: 6px;
	right: 6px;
	width: 28px !important;
	height: 28px !important;
	min-width: 28px !important;
	min-height: 28px !important;
	max-width: 28px !important;
	max-height: 28px !important;
	padding: 0 !important;
	border-radius: 50% !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	background: rgba(0, 0, 0, .55) !important;
	color: #fff;
	cursor: pointer;
	display: flex !important;
	align-items: center;
	justify-content: center;
	opacity: 0;
	transition: opacity .15s, background-color .15s;
	z-index: 2;
}

.jc-card:hover .jc-card__zoom-btn,
.jc-card--selected .jc-card__zoom-btn,
.jc-card:focus-visible .jc-card__zoom-btn {
	color: #fff;
	opacity: 1;
}

.jc-card__zoom-btn:hover,
.jc-card__zoom-btn:focus-visible {
	background: rgba(0, 0, 0, .8) !important;
	color: #fff;
	opacity: 1;
}

.jc-card__zoom-btn svg {
	width: 14px;
	height: 14px;
	pointer-events: none;
	display: block;
	color: #fff;
}

/* ====================================================================
   Category gallery (Step 1)
==================================================================== */
.jc-step__gallery {
	margin-top: 2rem;
}

/* Carousel wrapper */
.jc-gallery-carousel {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

/* Scrollable track */
.jc-gallery__track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	gap: 1rem;
	flex: 1;
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.jc-gallery__track::-webkit-scrollbar { display: none; }

/* Nav arrows */
.jc-gallery__nav {
	flex-shrink: 0;
	appearance: none;
	-webkit-appearance: none;
	background: rgba(255,255,255,.15) !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	color: #fff !important;
	cursor: pointer;
	border-radius: 50% !important;
	width: 38px !important;
	height: 38px !important;
	min-width: 38px;
	min-height: 38px;
	max-width: 38px;
	max-height: 38px;
	padding: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	font-size: 1.4rem;
	line-height: 1;
	transition: background-color .15s;
	z-index: 1;
}
.jc-gallery__nav:hover,
.jc-gallery__nav:focus,
.jc-gallery__nav:focus-visible {
	background: rgba(255,255,255,.3) !important;
	outline: none !important;
	box-shadow: none !important;
	border: none !important;
}

.jc-gallery__item {
	flex: 0 0 calc((100% - 2rem) / 3); /* 3 per view; 2rem = 2 × 1rem gaps */
	scroll-snap-align: start;
	display: block;
	border: none;
	background: none;
	padding: 0;
	cursor: pointer;
	border-radius: 8px;
	overflow: hidden;
	aspect-ratio: 1 / 1;
	transition: box-shadow .15s;
}

.jc-gallery__item:hover {
	box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

.jc-gallery__item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .2s;
}

.jc-gallery__item:hover img {
	transform: scale(1.05);
}

/* Gallery lightbox */
.jc-gallery__lightbox {
	border: none;
	border-radius: 12px;
	padding: 0;
	background: #000;
	max-width: 90vw;
	max-height: 92vh;
	width: auto;
}

.jc-gallery__lightbox[open] {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	position: fixed;
	inset: 0;
	margin: auto;
}

.jc-gallery__lightbox::backdrop {
	background: rgba(0,0,0,.82);
}

.jc-gallery__lb-img {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 3rem 4rem;
}

.jc-gallery__lb-img img {
	max-width: 80vw;
	max-height: 75vh;
	object-fit: contain;
	display: block;
	border-radius: 4px;
}

.jc-gallery__lb-close,
.jc-gallery__lb-prev,
.jc-gallery__lb-next {
	position: absolute;
	background-color: rgba(255,255,255,.15) !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	color: #fff !important;
	cursor: pointer;
	border-radius: 50% !important;
	width: 42px !important;
	height: 42px !important;
	min-width: 42px !important;
	min-height: 42px !important;
	max-width: 42px !important;
	max-height: 42px !important;
	padding: 0 !important;
	display: flex !important;
	align-items: center;
	justify-content: center;
	font-size: 1.4rem;
	line-height: 1;
	transition: background-color .15s;
}

.jc-gallery__lb-close:hover,
.jc-gallery__lb-prev:hover,
.jc-gallery__lb-next:hover {
	background: rgba(255,255,255,.3) !important;
	outline: none !important;
	box-shadow: none !important;
}

.jc-gallery__lb-close { top: 1rem; right: 1rem; font-size: 1.6rem; }
.jc-gallery__lb-prev  { left: 1rem;  top: 50%; transform: translateY(-50%); }
.jc-gallery__lb-next  { right: 1rem; top: 50%; transform: translateY(-50%); }

.jc-gallery__lb-counter {
	position: absolute;
	bottom: 1rem;
	color: rgba(255,255,255,.7);
	font-size: 0.85rem;
}

@keyframes jc-lb-enter-right {
	from { opacity: 0; transform: translateX( 40px ); }
	to   { opacity: 1; transform: translateX( 0 ); }
}
@keyframes jc-lb-enter-left {
	from { opacity: 0; transform: translateX( -40px ); }
	to   { opacity: 1; transform: translateX( 0 ); }
}
@keyframes jc-lb-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
.jc-gallery__lb-img img {
	animation: jc-lb-fade .25s ease;
}
.jc-gallery__lb-img--next img {
	animation: jc-lb-enter-right .25s ease;
}
.jc-gallery__lb-img--prev img {
	animation: jc-lb-enter-left .25s ease;
}

/* ====================================================================
   Taglia buttons (Step 4)
==================================================================== */
.jc-taglia {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 1.5rem;
}

.jc-taglia__btn {
	padding: 0.65rem 1.5rem;
	border: 2px solid #444;
	border-radius: 6px;
	background-color: #1e1e1e;
	color: #fff;
	font-size: 0.95rem;
	font-weight: 600;
	cursor: pointer;
	transition: border-color .15s, background-color .15s, color .15s;
}

.jc-taglia__btn:hover,
.jc-taglia__btn:focus-visible {
	border-color: var(--global-palette2, #555);
	outline: none;
}

.jc-taglia__btn--active {
	border-color: var(--global-palette2, #97c2b8);
	background: var(--global-palette2, #97c2b8);
	color: #fff;
}

.jc-taglia__btn--disabled {
	opacity: .45;
	cursor: not-allowed;
	pointer-events: none;
}

.jc-taglia__sku {
	display: block;
	font-size: .7rem;
	font-weight: 400;
	color: #777;
	margin-top: .15rem;
}

.jc-taglia__btn--active .jc-taglia__sku {
	color: rgba(255,255,255,.7);
}

/* Step 4 conditional area */
.jc-step4-conditional {
	margin-top: 1rem;
}

/* ====================================================================
   Measurements form (inline in Step 4)
==================================================================== */
.jc-misure__note {
	margin-bottom: 1rem;
	font-size: 0.88rem;
	color: #aaa;
	padding: 0.6rem 1rem;
	background: #1e1e1e;
	border-left: 3px solid var(--global-palette2, #97c2b8);
	border-radius: 0 4px 4px 0;
}

.jc-misure {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
	gap: 1rem;
}

.jc-misure__field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.jc-misure__label {
	font-size: 0.85rem;
	font-weight: 600;
	color: #ccc;
}

.jc-misure__input-wrap {
	display: flex;
	align-items: center;
	border: 1px solid #444;
	border-radius: 6px;
	overflow: hidden;
	transition: border-color .15s;
}

.jc-misure__input-wrap:focus-within {
	border-color: var(--global-palette2, #555);
}

.jc-misure__input {
	flex: 1;
	border: none;
	padding: 0.5rem 0.6rem;
	font-size: 0.95rem;
	outline: none;
	background: transparent;
	color: #fff;
	min-width: 0;
}

.jc-misure__unit {
	padding: 0 0.6rem;
	font-size: 0.8rem;
	color: #888;
	background: #2a2a2a;
	border-left: 1px solid #444;
	white-space: nowrap;
	align-self: stretch;
	display: flex;
	align-items: center;
}

/* ====================================================================
   Size chart trigger + dialog
==================================================================== */
.jc-size-chart-container {
	margin-top: 1rem;
}

.jc-size-chart-trigger {
	background: none;
	border: 1px solid #444;
	border-radius: 5px;
	padding: 0.4rem 0.8rem;
	font-size: 0.88rem;
	color: #ccc;
	cursor: pointer;
	transition: border-color .15s;
}

.jc-size-chart-trigger:hover {
	border-color: var(--global-palette2, #555);
}

.jc-size-chart-dialog {
	border: none;
	border-radius: 10px;
	padding: 0;
	max-width: 90vw;
	width: 640px;
	box-shadow: 0 8px 40px rgba(0,0,0,.25);
}

.jc-size-chart-dialog::backdrop {
	background: rgba(0,0,0,.5);
}

.jc-size-chart-dialog__inner {
	padding: 2rem;
	position: relative;
}

.jc-size-chart-dialog__close {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: none;
	border: none;
	font-size: 1.6rem;
	cursor: pointer;
	line-height: 1;
	color: #555;
}

.jc-size-chart-dialog__title {
	margin: 0 0 1rem;
	font-size: 1.1rem;
	font-weight: 700;
}

.jc-size-chart-dialog__content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.jc-size-chart-dialog__content td,
.jc-size-chart-dialog__content th {
	border: 1px solid #ddd;
	padding: 0.4rem 0.6rem;
	text-align: left;
}

.jc-size-chart-dialog__content th {
	background: #f5f5f5;
	font-weight: 600;
}

/* ====================================================================
   Summary (Step 5)
==================================================================== */
.jc-summary__section {
	margin-bottom: 1.5rem;
}

.jc-summary__section-title {
	margin: 0 0 0.75rem;
	font-size: 1rem;
	font-weight: 700;
	color: #fff;
}

.jc-summary__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.95rem;
}

.jc-summary__label {
	width: 40%;
	color: #888;
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid #2a2a2a;
	vertical-align: top;
}

.jc-summary__value {
	padding: 0.45rem 0.6rem;
	border-bottom: 1px solid #2a2a2a;
	color: #fff;
}

.jc-summary__actions {
	margin-top: 2rem;
	padding-top: 1.5rem;
	border-top: 2px solid #333;
}

.jc-summary__submit {
	font-size: 1.05rem !important;
	padding: 0.9rem 3rem !important;
	letter-spacing: .03em;
}

.jc-summary__submit:disabled {
	opacity: .5;
	cursor: not-allowed;
}

/* ====================================================================
   Error message
==================================================================== */
#jc-configurator .jc-configurator__error {
	margin: 1rem 1.25rem;
	padding: 0.6rem 1rem;
	background: #fff3f3;
	border: 1px solid #f5c6c6;
	border-radius: 6px;
	color: #c33;
	font-size: 0.9rem;
}

/* ====================================================================
   Loading placeholder
==================================================================== */
.jc-configurator__loading {
	padding: 2.5rem;
	text-align: center;
	color: #555;
	font-size: 0.9rem;
}

/* ====================================================================
   Focus styles (keyboard navigation)
==================================================================== */
#jc-configurator *:focus-visible,
#jc-progress *:focus-visible {
	outline: 2px solid var(--global-palette2, #97c2b8) !important;
	outline-offset: 2px !important;
	box-shadow: none !important;
}

.jc-card:focus-visible {
	outline: 2px solid var(--global-palette2, #97c2b8) !important;
	outline-offset: 2px !important;
	border-color: var(--global-palette2, #97c2b8) !important;
}

/* ====================================================================
   Admin order badge (outside #jc-configurator scope)
==================================================================== */
.jc-badge {
	display: inline-block;
	background: #111;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	padding: 2px 6px;
	border-radius: 3px;
	letter-spacing: .05em;
	text-transform: uppercase;
	vertical-align: middle;
}

/* ====================================================================
   Responsive
==================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
	.jc-gallery__item {
		flex: 0 0 calc((100% - 1rem) / 2); /* 2 per view; 1rem = 1 gap */
	}
}

@media (max-width: 768px) {
	.jc-hero {
		min-height: 50vh;
		padding: 3rem 1.5rem;
	}

	.jc-progress__label {
		display: none;
	}

	.jc-progress__step {
		min-width: 48px;
		padding: 0.5rem 0.25rem;
	}

	.jc-gallery__nav {
		width: 30px !important;
		height: 30px !important;
		min-width: 30px;
		min-height: 30px;
		max-width: 30px;
		max-height: 30px;
		font-size: 1.1rem;
	}

	.jc-gallery__item {
		flex: 0 0 80%; /* 1 slide + peek of next ~20% */
	}
}

@media (max-width: 600px) {
	.jc-card-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	#jc-card-grid-tessuto,
	#jc-card-grid-bottone {
		grid-template-columns: repeat(3, 1fr);
	}

	.jc-misure {
		grid-template-columns: 1fr;
	}

	.jc-size-chart-dialog {
		width: 95vw;
	}

	.jc-gallery__lb-img {
		padding: 3rem 1.5rem;
	}

	.jc-gallery__lb-img img {
		max-width: 90vw;
	}
}
