/**
 * Tabela de Medidas & Selos — front-end
 */

:root {
	--tmsp-icon-size: 34px;
	--tmsp-btn-border: currentColor;
	--tmsp-btn-hover-bg: #111;
	--tmsp-btn-hover-color: #fff;
}

/* -------------------------------------------------------------------------
 * Botão da tabela de medidas
 * ---------------------------------------------------------------------- */

.tmsp-size-guide {
	margin: 0 0 1em;
}

.tmsp-size-guide__button {
	display: block;
	width: 100%;
	padding: 14px 16px;
	margin: 0;
	background: transparent;
	border: 1px solid var(--tmsp-btn-border);
	border-radius: 0;
	color: inherit;
	font: inherit;
	font-size: 0.95em;
	font-weight: 500;
	letter-spacing: 0.04em;
	line-height: 1.2;
	text-align: center;
	text-transform: uppercase;
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.tmsp-size-guide__button:hover,
.tmsp-size-guide__button:focus-visible {
	background: var(--tmsp-btn-hover-bg);
	color: var(--tmsp-btn-hover-color);
	border-color: var(--tmsp-btn-hover-bg);
}

/* -------------------------------------------------------------------------
 * Selos
 * ---------------------------------------------------------------------- */

.tmsp-badges {
	display: grid;
	gap: 12px 10px;
	margin: 18px 0;
	padding: 0;
	list-style: none;
}

.tmsp-badges--cols-1 { grid-template-columns: 1fr; }
.tmsp-badges--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tmsp-badges--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tmsp-badge {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tmsp-badge__icon {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--tmsp-icon-size);
	height: var(--tmsp-icon-size);
	color: inherit;
}

.tmsp-badge__icon svg,
.tmsp-badge__icon img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
}

.tmsp-badge__text {
	font-size: 0.82em;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

@media (max-width: 480px) {
	.tmsp-badges--cols-3 {
		gap: 10px 6px;
	}

	.tmsp-badge {
		flex-direction: column;
		gap: 6px;
		text-align: center;
	}

	.tmsp-badge__text {
		font-size: 0.72em;
	}
}

/* -------------------------------------------------------------------------
 * Modal
 * ---------------------------------------------------------------------- */

.tmsp-modal[hidden] {
	display: none;
}

.tmsp-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.tmsp-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	animation: tmsp-fade 0.2s ease;
}

.tmsp-modal__dialog {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 760px;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	background: #fff;
	color: #111;
	border-radius: 4px;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
	animation: tmsp-pop 0.22s ease;
	overflow: hidden;
}

.tmsp-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px;
	border-bottom: 1px solid #e6e6e6;
}

.tmsp-modal__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	color: inherit;
}

.tmsp-modal__close {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: inherit;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.tmsp-modal__close:hover,
.tmsp-modal__close:focus-visible {
	background: #f0f0f0;
}

.tmsp-modal__close svg {
	width: 20px;
	height: 20px;
}

.tmsp-modal__body {
	padding: 20px;
	overflow: auto;
	-webkit-overflow-scrolling: touch;
}

.tmsp-modal__description {
	margin-bottom: 16px;
	font-size: 0.9rem;
	line-height: 1.55;
	color: #444;
}

.tmsp-modal__description p:last-child {
	margin-bottom: 0;
}

.tmsp-modal__image img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0 auto;
}

/* Tabela */

.tmsp-table-wrap {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

table.tmsp-table {
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 0.88rem;
	background: transparent;
}

table.tmsp-table th,
table.tmsp-table td {
	padding: 10px 12px;
	border: 1px solid #ddd;
	text-align: center;
	white-space: nowrap;
	color: inherit;
	background: transparent;
}

table.tmsp-table thead th {
	background: #f5f5f5;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

table.tmsp-table tbody th {
	background: #fafafa;
	font-weight: 600;
	text-align: left;
}

table.tmsp-table tbody tr:nth-child(even) td {
	background: #fcfcfc;
}

/* Estado do body com modal aberto */

body.tmsp-modal-open {
	overflow: hidden;
}

@keyframes tmsp-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes tmsp-pop {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.tmsp-modal__overlay,
	.tmsp-modal__dialog {
		animation: none;
	}
}

@media (max-width: 600px) {
	.tmsp-modal {
		padding: 0;
	}

	.tmsp-modal__dialog {
		max-width: none;
		max-height: 100vh;
		max-height: 100dvh;
		height: 100%;
		border-radius: 0;
	}
}
