/**
 * Woo Size Chart – front-end styles.
 * Colors/typography come from CSS custom properties set inline from settings.
 */

.wsc-scope {
	--wsc-header-bg: #111827;
	--wsc-header-color: #ffffff;
	--wsc-row-alt-bg: #f9fafb;
	--wsc-border: #e5e7eb;
	--wsc-text: #1f2937;
	--wsc-accent: #2563eb;
	--wsc-font-size: 14px;
	font-size: var(--wsc-font-size);
	color: var(--wsc-text);
	box-sizing: border-box;
}
.wsc-scope *,
.wsc-scope *::before,
.wsc-scope *::after {
	box-sizing: border-box;
}

/* Trigger button */
.wsc-trigger {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 10px 0;
	padding: 8px 14px;
	background: transparent;
	color: var(--wsc-accent);
	border: 1px solid var(--wsc-accent);
	border-radius: 6px;
	font-size: inherit;
	font-weight: 600;
	cursor: pointer;
	line-height: 1.2;
	transition: background 0.15s ease, color 0.15s ease;
}
.wsc-trigger:hover,
.wsc-trigger:focus-visible {
	background: var(--wsc-accent);
	color: #fff;
	outline: none;
}
.wsc-trigger-icon {
	font-size: 1.1em;
}

/* Overlay */
.wsc-overlay {
	position: fixed;
	inset: 0;
	background: rgba(17, 24, 39, 0.55);
	opacity: 0;
	transition: opacity 0.25s ease;
	z-index: 99998;
}
.wsc-scope.is-open .wsc-overlay {
	opacity: 1;
}

body.wsc-open {
	overflow: hidden;
}

/* Panel base */
.wsc-panel {
	position: fixed;
	background: #fff;
	color: var(--wsc-text);
	z-index: 99999;
	box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

/* Modal */
.wsc-panel-modal {
	top: 50%;
	left: 50%;
	width: min(680px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	transform: translate(-50%, -46%);
	opacity: 0;
	border-radius: 12px;
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}
.wsc-scope.is-open .wsc-panel-modal {
	opacity: 1;
	transform: translate(-50%, -50%);
	pointer-events: auto;
}

/* Off-canvas */
.wsc-panel-offcanvas {
	top: 0;
	right: 0;
	height: 100vh;
	width: min(460px, calc(100vw - 32px));
	transform: translateX(100%);
	transition: transform 0.3s ease;
}
.wsc-scope.is-open .wsc-panel-offcanvas {
	transform: translateX(0);
}

/* Close button */
.wsc-close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 34px;
	height: 34px;
	border: none;
	background: transparent;
	font-size: 26px;
	line-height: 1;
	color: var(--wsc-header-color);
	cursor: pointer;
	z-index: 2;
	border-radius: 6px;
}
.wsc-close:hover,
.wsc-close:focus-visible {
	background: rgba(255, 255, 255, 0.18);
	outline: none;
}

/* Body / header */
.wsc-body {
	display: flex;
	flex-direction: column;
	overflow: auto;
	max-height: inherit;
}
.wsc-panel .wsc-body {
	max-height: 100%;
}
.wsc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	padding: 16px 52px 16px 20px;
	background: var(--wsc-header-bg);
	color: var(--wsc-header-color);
}
.wsc-inline .wsc-header {
	border-radius: 8px 8px 0 0;
}
.wsc-title {
	margin: 0;
	font-size: 1.15em;
	color: var(--wsc-header-color);
}

/* Unit toggle */
.wsc-unit-toggle {
	display: inline-flex;
	border: 1px solid rgba(255, 255, 255, 0.5);
	border-radius: 999px;
	overflow: hidden;
}
.wsc-unit-btn {
	border: none;
	background: transparent;
	color: var(--wsc-header-color);
	padding: 5px 14px;
	font-size: 0.85em;
	font-weight: 600;
	cursor: pointer;
	line-height: 1.2;
}
.wsc-unit-btn.is-active {
	background: #fff;
	color: var(--wsc-header-bg);
}

.wsc-description {
	padding: 14px 20px 0;
	line-height: 1.5;
}
.wsc-description p {
	margin: 0 0 8px;
}

/* Table */
.wsc-table-wrap {
	padding: 16px 20px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
}
.wsc-table {
	width: 100%;
	border-collapse: collapse;
	font-size: inherit;
	min-width: max-content;
}
.wsc-table th,
.wsc-table td {
	border: 1px solid var(--wsc-border);
	padding: 9px 12px;
	text-align: center;
	white-space: nowrap;
}
.wsc-table thead th {
	background: var(--wsc-header-bg);
	color: var(--wsc-header-color);
	font-weight: 600;
	position: sticky;
	top: 0;
}
.wsc-th-unit {
	font-weight: 400;
	opacity: 0.85;
	font-size: 0.85em;
}
.wsc-table tbody tr:nth-child(even) td {
	background: var(--wsc-row-alt-bg);
}
.wsc-table tbody td:first-child {
	font-weight: 600;
	position: sticky;
	left: 0;
	background: #fff;
	z-index: 1;
}
.wsc-table tbody tr:nth-child(even) td:first-child {
	background: var(--wsc-row-alt-bg);
}

.wsc-hint {
	margin: 0;
	padding: 0 20px 16px;
	font-size: 0.82em;
	opacity: 0.7;
}

/* Inline mode */
.wsc-inline {
	border: 1px solid var(--wsc-border);
	border-radius: 8px;
	overflow: hidden;
	margin: 14px 0;
}

/* Mobile */
@media (max-width: 600px) {
	.wsc-panel-modal {
		width: calc(100vw - 20px);
		max-height: calc(100vh - 24px);
	}
	.wsc-panel-offcanvas {
		width: calc(100vw - 40px);
	}
	.wsc-table th,
	.wsc-table td {
		padding: 8px 10px;
	}
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
	.wsc-overlay,
	.wsc-panel-modal,
	.wsc-panel-offcanvas,
	.wsc-trigger {
		transition: none;
	}
}
