/**
 * AM Size Chart Pro - Frontend styles
 * Premium jewellery-brand aesthetic: emerald green + gold on white.
 */

:root {
	--am-scp-emerald: #346739;
	--am-scp-emerald-dark: #234a27;
	--am-scp-gold: #c8a24a;
	--am-scp-gold-light: #e6d29a;
	--am-scp-white: #ffffff;
	--am-scp-ink: #2b2b2b;
	--am-scp-muted: #6b6b6b;
	--am-scp-border: #e7e2d6;
	--am-scp-radius: 14px;
	--am-scp-shadow: 0 20px 60px rgba(35, 74, 39, 0.22), 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* ---------- Trigger button ---------- */
.am-scp-trigger-wrap {
	margin: 14px 0 18px;
}

.am-scp-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--am-scp-white);
	color: var(--am-scp-emerald-dark);
	border: 1px solid var(--am-scp-emerald);
	border-radius: 999px;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.am-scp-trigger:hover,
.am-scp-trigger:focus-visible {
	background: var(--am-scp-emerald);
	color: var(--am-scp-white);
	box-shadow: 0 6px 18px rgba(52, 103, 57, 0.28);
	transform: translateY(-1px);
}

.am-scp-trigger:focus-visible {
	outline: 2px solid var(--am-scp-gold);
	outline-offset: 2px;
}

.am-scp-trigger-icon {
	font-size: 16px;
	line-height: 1;
}

/* ---------- Modal overlay ---------- */
.am-scp-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 30, 20, 0.55);
	backdrop-filter: blur(2px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	z-index: 100000;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

.am-scp-modal-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

/* ---------- Modal box ---------- */
.am-scp-modal {
	background: var(--am-scp-white);
	border-radius: var(--am-scp-radius);
	box-shadow: var(--am-scp-shadow);
	border-top: 4px solid var(--am-scp-gold);
	width: 100%;
	max-width: 720px;
	max-height: 85vh;
	overflow-y: auto;
	position: relative;
	padding: 32px 32px 28px;
	transform: translateY(18px) scale(0.98);
	opacity: 0;
	transition: transform 0.28s ease, opacity 0.28s ease;
}

.am-scp-modal-overlay.is-open .am-scp-modal {
	transform: translateY(0) scale(1);
	opacity: 1;
}

.am-scp-modal-header {
	margin-bottom: 18px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--am-scp-border);
}

.am-scp-modal-title {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	color: var(--am-scp-emerald-dark);
	letter-spacing: 0.01em;
}

.am-scp-modal-close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 1px solid var(--am-scp-border);
	background: var(--am-scp-white);
	color: var(--am-scp-ink);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.am-scp-modal-close:hover,
.am-scp-modal-close:focus-visible {
	background: var(--am-scp-emerald);
	border-color: var(--am-scp-emerald);
	color: var(--am-scp-white);
	transform: rotate(90deg);
}

.am-scp-modal-close:focus-visible {
	outline: 2px solid var(--am-scp-gold);
	outline-offset: 2px;
}

/* ---------- Table ---------- */
.am-scp-table-wrap {
	overflow-x: auto;
	border: 1px solid var(--am-scp-border);
	border-radius: 10px;
	margin-bottom: 24px;
}

.am-scp-table {
	width: 100%;
	border-collapse: collapse;
	min-width: 480px;
	font-size: 14px;
}

.am-scp-table thead th {
	background: var(--am-scp-emerald);
	color: var(--am-scp-white);
	font-weight: 600;
	text-align: left;
	padding: 12px 14px;
	white-space: nowrap;
}

.am-scp-table tbody td {
	padding: 10px 14px;
	border-top: 1px solid var(--am-scp-border);
	color: var(--am-scp-ink);
}

.am-scp-table tbody tr:nth-child(even) {
	background: #faf8f1;
}

.am-scp-table tbody tr:hover {
	background: var(--am-scp-gold-light);
}

/* ---------- Instructions ---------- */
.am-scp-instructions-title {
	font-size: 17px;
	font-weight: 700;
	color: var(--am-scp-emerald-dark);
	margin: 0 0 12px;
	position: relative;
	padding-left: 14px;
}

.am-scp-instructions-title::before {
	content: "";
	position: absolute;
	left: 0;
	top: 4px;
	bottom: 4px;
	width: 4px;
	border-radius: 3px;
	background: var(--am-scp-gold);
}

.am-scp-instructions-body {
	display: flex;
	gap: 20px;
	flex-wrap: wrap;
	align-items: flex-start;
}

.am-scp-instructions-image {
	flex: 0 0 200px;
	max-width: 200px;
}

.am-scp-instructions-img {
	width: 100%;
	height: auto;
	border-radius: 10px;
	border: 1px solid var(--am-scp-border);
	display: block;
}

.am-scp-instructions-text {
	flex: 1 1 240px;
	color: var(--am-scp-muted);
	font-size: 14px;
	line-height: 1.7;
}

.am-scp-instructions-text p {
	margin: 0 0 10px;
}

.am-scp-instructions-text ol,
.am-scp-instructions-text ul {
	margin: 0 0 10px 20px;
	padding: 0;
}

.am-scp-instructions-text li {
	margin-bottom: 6px;
}

/* ---------- Shortcode inline mode ---------- */
.am-scp-shortcode-wrap {
	max-width: 760px;
	margin: 0 auto;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
	.am-scp-modal {
		padding: 24px 18px 20px;
		max-height: 92vh;
		border-radius: 12px;
	}

	.am-scp-modal-title {
		font-size: 18px;
	}

	.am-scp-instructions-body {
		flex-direction: column;
	}

	.am-scp-instructions-image {
		flex-basis: auto;
		max-width: 160px;
	}

	.am-scp-table {
		font-size: 13px;
	}
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.am-scp-modal-overlay,
	.am-scp-modal,
	.am-scp-modal-close {
		transition: none !important;
	}
}

/* ---------- Dark mode compatibility ---------- */
@media (prefers-color-scheme: dark) {
	.am-scp-modal {
		background: #1d201d;
		--am-scp-border: #33392f;
	}

	.am-scp-modal-title {
		color: var(--am-scp-gold-light);
	}

	.am-scp-table tbody td {
		color: #ece7d8;
	}

	.am-scp-table tbody tr:nth-child(even) {
		background: #23261f;
	}

	.am-scp-table tbody tr:hover {
		background: #2c2f24;
	}

	.am-scp-instructions-text {
		color: #c9c6b8;
	}

	.am-scp-modal-close {
		background: #1d201d;
		color: #ece7d8;
		border-color: #33392f;
	}

	.am-scp-trigger {
		background: transparent;
		color: var(--am-scp-gold-light);
	}
}

/* ---------- RTL support ---------- */
body.rtl .am-scp-instructions-title {
	padding-left: 0;
	padding-right: 14px;
}

body.rtl .am-scp-instructions-title::before {
	left: auto;
	right: 0;
}

body.rtl .am-scp-modal-close {
	right: auto;
	left: 14px;
}

body.rtl .am-scp-table thead th,
body.rtl .am-scp-table tbody td {
	text-align: right;
}
