/**
 * Anelli Size Guide — frontend
 */

/* Trigger affianco all’etichetta misura */
body.single-product .variations_form tr.type_attribute td.label:has(.anelli-sg-trigger),
.quickview-container .variations_form tr.type_attribute td.label:has(.anelli-sg-trigger) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	width: 100%;
}

.anelli-sg-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #1a1a1a;
	font-size: 12px;
	line-height: 1.3;
	letter-spacing: 0.01em;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	white-space: nowrap;
	flex: 0 0 auto;
}

.anelli-sg-trigger:hover,
.anelli-sg-trigger:focus-visible {
	opacity: 0.75;
	outline: none;
}

.anelli-sg-trigger__icon {
	display: inline-flex;
	flex-shrink: 0;
	color: inherit;
	line-height: 0;
}

.anelli-sg-trigger__label {
	font-weight: 400;
}

body.single-product .variations_form td.label .anelli-sg-trigger,
body.single-product .variations_form td.value .anelli-sg-trigger,
.quickview-container .variations_form td.label .anelli-sg-trigger,
.quickview-container .variations_form td.value .anelli-sg-trigger {
	display: inline-flex;
}

/* Modal */
.anelli-sg-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.anelli-sg-modal.is-open {
	display: flex;
}

.anelli-sg-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.anelli-sg-modal__panel {
	position: relative;
	z-index: 2;
	width: min(720px, 100%);
	max-height: min(92vh, 900px);
	overflow: auto;
	background: #fff;
	padding: 28px 28px 24px;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.anelli-sg-modal__close {
	position: absolute;
	top: 14px;
	right: 16px;
	width: 36px;
	height: 36px;
	border: 0;
	background: transparent;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #1a1a1a;
	opacity: 0.7;
	transition: opacity 0.2s ease;
}

.anelli-sg-modal__close:hover {
	opacity: 1;
}

.anelli-sg-modal__header {
	padding-right: 44px;
	text-align: left;
}

.anelli-sg-modal__title {
	margin: 0 0 6px;
	font-size: 26px;
	line-height: 1.15;
	font-weight: 400;
	letter-spacing: -0.01em;
}

.anelli-sg-modal__intro,
.anelli-sg-modal__footer {
	color: #666;
	font-size: 13px;
	line-height: 1.55;
}

.anelli-sg-modal__intro {
	margin: 0;
	max-width: 560px;
}

.anelli-sg-modal__footer {
	margin: 0;
	padding-top: 4px;
	border-top: 1px solid #eee;
	text-align: left;
}

.anelli-sg-modal__body {
	width: 100%;
	min-width: 0;
}

/* Tabs */
.anelli-sg-tabs {
	display: flex;
	gap: 0;
	border-bottom: 1px solid #e5e5e5;
}

.anelli-sg-tabs__btn {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: transparent;
	padding: 10px 16px;
	margin: 0;
	font-size: 14px;
	line-height: 1.2;
	color: #777;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
}

.anelli-sg-tabs__btn.is-active {
	color: #1a1a1a;
	border-bottom-color: #1a1a1a;
}

.anelli-sg-panel[hidden] {
	display: none !important;
}

.anelli-sg-panel {
	padding-top: 8px;
}

/* Wizard */
.anelli-sg-wizard__label {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 500;
	color: #1a1a1a;
}

.anelli-sg-wizard__hint {
	margin: 0 0 16px;
	font-size: 13px;
	line-height: 1.55;
	color: #666;
}

.anelli-sg-methods {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px;
}

.anelli-sg-method {
	appearance: none;
	-webkit-appearance: none;
	text-align: left;
	border: 1px solid #ccc;
	background: #fff;
	padding: 16px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-height: 110px;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.anelli-sg-method:hover,
.anelli-sg-method:focus-visible {
	border-color: #1a1a1a;
	outline: none;
}

.anelli-sg-method__title {
	font-size: 15px;
	font-weight: 500;
	color: #1a1a1a;
}

.anelli-sg-method__desc {
	font-size: 13px;
	line-height: 1.45;
	color: #666;
}

.anelli-sg-back {
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	background: transparent;
	padding: 0;
	margin: 0 0 14px;
	font-size: 13px;
	color: #666;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.anelli-sg-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 16px;
}

.anelli-sg-field__label {
	font-size: 13px;
	color: #444;
}

.anelli-sg-field__input {
	width: 100%;
	max-width: 220px;
	height: 48px;
	padding: 0 14px;
	border: 1px solid #ccc;
	background: #fff;
	font-size: 16px;
	color: #1a1a1a;
	box-sizing: border-box;
}

.anelli-sg-field__input:focus {
	border-color: #1a1a1a;
	outline: none;
}

.anelli-sg-btn {
	appearance: none;
	-webkit-appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 20px;
	border: 1px solid #1a1a1a;
	font-size: 14px;
	line-height: 1.2;
	cursor: pointer;
	box-sizing: border-box;
}

.anelli-sg-btn--primary {
	background: #1a1a1a;
	color: #fff;
}

.anelli-sg-btn--primary:hover {
	opacity: 0.88;
}

.anelli-sg-result {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 8px 0 0;
}

.anelli-sg-result__eyebrow {
	margin: 0;
	font-size: 13px;
	color: #666;
}

.anelli-sg-result__size {
	margin: 0;
	font-size: 28px;
	line-height: 1.2;
	font-weight: 400;
	color: #1a1a1a;
}

.anelli-sg-result__meta {
	margin: 0 0 8px;
	font-size: 13px;
	color: #666;
}

.anelli-sg-result__msg {
	margin: 0 0 8px;
	font-size: 13px;
	color: #8a5a00;
}

.anelli-sg-result #anelli-sg-apply {
	align-self: flex-start;
	margin-top: 6px;
}

/* Table */
.anelli-sg-table-wrap {
	max-height: min(52vh, 420px);
	overflow: auto;
	border: 1px solid #e5e5e5;
}

.anelli-sg-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
}

.anelli-sg-table th,
.anelli-sg-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid #eee;
	white-space: nowrap;
}

.anelli-sg-table thead th {
	position: sticky;
	top: 0;
	background: #fafafa;
	font-weight: 500;
	color: #1a1a1a;
	z-index: 1;
}

.anelli-sg-table tbody tr.is-highlight td {
	background: #f3f3f3;
	font-weight: 600;
	color: #1a1a1a;
}

@media (max-width: 640px) {
	.anelli-sg-modal__panel {
		padding: 22px 18px 18px;
	}

	.anelli-sg-modal__title {
		font-size: 22px;
	}

	.anelli-sg-methods {
		grid-template-columns: 1fr;
	}

	.anelli-sg-field__input {
		max-width: none;
	}

	.anelli-sg-btn {
		width: 100%;
	}

	.anelli-sg-result #anelli-sg-apply {
		align-self: stretch;
		width: 100%;
	}
}
