/* Tabela veličina na proizvodu: dugme otvara popup sa tabelom koja odgovara proizvodu (inc/size-chart.php). */
.sw-product button.sw-product__size-button {
	padding: 10px 20px;
	border: 1px solid var(--e-global-color-primary);
	border-radius: 0;
	background-color: var(--e-global-color-accent);
	color: #fff;
	font-family: var(--e-global-typography-text-font-family), sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 16.8px;
	letter-spacing: 1.8px;
	text-transform: uppercase;
	cursor: pointer;
}

.sw-product button.sw-product__size-button:hover,
.sw-product button.sw-product__size-button:focus {
	border-color: var(--e-global-color-primary);
	background-color: var(--e-global-color-secondary);
	color: #fff;
}

@media (max-width: 767px) {
	.sw-product button.sw-product__size-button {
		font-size: 12px;
		line-height: 14.4px;
		letter-spacing: -0.1px;
	}
}

.sw-sizechart[hidden] {
	display: none;
}

.sw-sizechart {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.sw-sizechart__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.sw-sizechart__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(900px, 100%);
	max-height: calc(100vh - 32px);
	border-radius: 12px;
	background: #fff;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transform: translateY(16px) scale(0.98);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.sw-sizechart.is-open .sw-sizechart__overlay {
	opacity: 1;
}

.sw-sizechart.is-open .sw-sizechart__dialog {
	opacity: 1;
	transform: none;
}

body.sw-sizechart-open {
	overflow: hidden;
}

.sw-sizechart .sw-sizechart__close {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 1;
	display: flex;
	padding: 6px;
	border: 0;
	background: none;
	line-height: 0;
	cursor: pointer;
}

.sw-sizechart .sw-sizechart__close:hover,
.sw-sizechart .sw-sizechart__close:focus {
	border: 0;
	background: none;
}

.sw-sizechart__close svg {
	width: 16px;
	height: 16px;
	fill: var(--e-global-color-text);
}

.sw-sizechart__body {
	flex: 1 1 auto;
	min-height: 0;
	padding: 24px;
	overflow: auto;
}

/* U popupu umjesto naziva tabele piše samo "Tabela veličina". */
.sw-sizechart .wpcsc-size-chart-title {
	display: none;
}

.sw-sizechart__title {
	margin: 0 40px 16px 0;
	font-family: var(--e-global-typography-primary-font-family), sans-serif;
	font-size: 22px;
	font-weight: 600;
	line-height: 1.3;
	text-transform: uppercase;
	color: var(--e-global-color-text);
}

/* Slika uz tabelu (ACF "Slika" na tabeli): lijevo od tabele, na mobitelu iznad nje. */
.sw-sizechart__dialog:has(.sw-sizechart__layout.has-image) {
	width: min(1100px, 100%);
}

.sw-sizechart__layout.has-image {
	display: grid;
	grid-template-columns: minmax(0, 36%) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

.sw-sizechart__image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 8px;
}

.sw-sizechart__table {
	min-width: 0;
}

.sw-sizechart .wpcsc-size-chart-content {
	overflow-x: auto;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
}

.sw-sizechart table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 14px;
	line-height: 1.3;
}

.sw-sizechart th,
.sw-sizechart td {
	padding: 10px 12px;
	border-bottom: 1px solid #eee;
	text-align: center;
	white-space: nowrap;
}

.sw-sizechart thead th {
	background: var(--e-global-color-primary);
	color: #fff;
	font-weight: 600;
	/* Veličine idu nadole, a mjere ustranu: duži nazivi mjera se lome u dva reda. */
	min-width: 72px;
	line-height: 1.25;
	white-space: normal;
	vertical-align: bottom;
}

.sw-sizechart tbody tr:nth-child(even) td {
	background: #f9f9f9;
}

.sw-sizechart tbody tr:last-child td {
	border-bottom: 0;
}

/* Prva kolona (veličine) ostaje vidljiva pri horizontalnom skrolu. */
.sw-sizechart th:first-child,
.sw-sizechart td:first-child {
	position: sticky;
	left: 0;
	text-align: left;
	font-weight: 600;
}

.sw-sizechart td:first-child {
	background: #fff;
}

.sw-sizechart tbody tr:nth-child(even) td:first-child {
	background: #f9f9f9;
}

/* Indikator: ima još sadržaja ispod (strelica koja pulsira + blijeđenje dna). */
.sw-sizechart .sw-sizechart__more {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	gap: 2px;
	height: 84px;
	padding: 0 0 10px;
	border: 0;
	border-radius: 0 0 12px 12px;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 70%);
	color: var(--e-global-color-primary);
	font-family: var(--e-global-typography-text-font-family), sans-serif;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.6px;
	line-height: 1;
	text-transform: uppercase;
	opacity: 0;
	pointer-events: none;
	cursor: pointer;
	transition: opacity 0.25s ease;
}

.sw-sizechart .sw-sizechart__more:hover,
.sw-sizechart .sw-sizechart__more:focus {
	border: 0;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 70%);
	color: var(--e-global-color-secondary);
}

.sw-sizechart .sw-sizechart__more svg {
	width: 22px;
	height: 22px;
	animation: sw-size-bounce 1.4s ease-in-out infinite;
}

.sw-sizechart.has-more-down .sw-sizechart__more {
	opacity: 1;
	pointer-events: auto;
}

@keyframes sw-size-bounce {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(5px); }
}

/* Indikator: tabela je šira od popupa (sjena desno). */
.sw-sizechart .wpcsc-size-chart {
	position: relative;
}

.sw-sizechart .wpcsc-size-chart::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: 40px;
	border-radius: 0 8px 8px 0;
	background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.12));
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.sw-sizechart .wpcsc-size-chart.has-more-right::after {
	opacity: 1;
}


@media (max-width: 767px) {
	.sw-sizechart {
		align-items: flex-end;
		padding: 0;
	}

	.sw-sizechart__dialog {
		max-height: 90vh;
		border-radius: 12px 12px 0 0;
		transform: translateY(100%);
	}

	.sw-sizechart__body {
		padding: 20px 16px;
	}

	.sw-sizechart__title {
		font-size: 18px;
	}

	.sw-sizechart__layout.has-image {
		grid-template-columns: minmax(0, 1fr);
		gap: 16px;
	}

	.sw-sizechart__image img {
		width: auto;
		max-width: 100%;
		max-height: 260px;
		margin: 0 auto;
	}

	.sw-sizechart th,
	.sw-sizechart td {
		padding: 8px 6px;
		font-size: 13px;
	}

	/* 6 kolona (veličina + A–E) treba da stane u širinu telefona. */
	.sw-sizechart thead th {
		min-width: 0;
		font-size: 11px;
		hyphens: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sw-sizechart__overlay,
	.sw-sizechart__dialog {
		transition: none;
	}

	.sw-sizechart .sw-sizechart__more svg {
		animation: none;
	}
}
