/**
 * Fibre Systems Core — Quick View modal + shared spec table.
 * The spec table is styled here (loaded with the card style) so [fibre_product_specs] and the
 * modal share one look.
 */

/* --- Spec table (also used on the single product page via shortcode) --- */
.fsc-spec-table {
	width: 100% !important;
	border-collapse: collapse !important;
	font-size: 0.9rem !important;
	margin: 8px 0 !important;
}

.fsc-spec-table th,
.fsc-spec-table td {
	text-align: left !important;
	padding: 10px 12px !important;
	border-bottom: 1px solid rgba( 128, 128, 128, 0.25 ) !important;
	vertical-align: top !important;
	font-size: 0.9rem !important;
	line-height: 1.4 !important;
}

.fsc-spec-table th {
	width: 40% !important;
	font-weight: 600 !important;
	opacity: 0.85;
}

/* --- Modal --- */
body.fsc-qv-lock {
	overflow: hidden;
}

.fsc-qv-overlay {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 5vh 16px;
	background: rgba( 0, 0, 0, 0.6 );
	backdrop-filter: blur( 3px );
	overflow-y: auto;
	/* Hidden but transition-able (fade); non-interactive until open. */
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 200ms ease, visibility 200ms ease;
}

.fsc-qv-overlay.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.fsc-qv-modal {
	position: relative !important;
	width: min( 900px, 100% ) !important;
	max-width: min( 900px, 100% ) !important;
	background: #0f172a !important;
	color: #fff !important;
	border: 1px solid rgba( 255, 255, 255, 0.12 ) !important;
	border-radius: 16px !important;
	box-shadow: 0 30px 60px -12px rgba( 0, 0, 0, 0.6 ) !important;
	padding: 28px !important;
	margin: 0 !important;
	/* Modals scale from centre (they are not anchored to a trigger). Never from scale(0). */
	transform-origin: center !important;
	transform: scale( 0.96 ) !important;
	opacity: 0 !important;
	transition: transform 220ms cubic-bezier( 0.23, 1, 0.32, 1 ), opacity 220ms ease !important;
}

.fsc-qv-overlay.is-open .fsc-qv-modal {
	transform: scale( 1 ) !important;
	opacity: 1 !important;
}

@media ( prefers-reduced-motion: reduce ) {
	.fsc-qv-modal {
		transform: none;
		transition: opacity 150ms ease;
	}
}

.fsc-qv-close {
	position: absolute !important;
	top: 10px !important;
	right: 12px !important;
	width: 40px !important;
	height: 40px !important;
	min-width: 0 !important;
	border: 0 !important;
	border-radius: 50% !important;
	background: rgba( 255, 255, 255, 0.1 ) !important;
	color: #fff !important;
	font-size: 1.5rem !important;
	line-height: 1 !important;
	padding: 0 !important;
	margin: 0 !important;
	cursor: pointer !important;
	box-shadow: none !important;
	transition: background 160ms ease !important;
}

.fsc-qv-close:hover {
	background: rgba( 255, 255, 255, 0.22 ) !important;
	color: #fff !important;
}

.fsc-qv {
	display: grid !important;
	grid-template-columns: 1fr 1fr !important;
	gap: 24px !important;
}

.fsc-qv__media {
	background: #fff;
	border-radius: 12px;
	padding: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fsc-qv__media img {
	max-width: 100%;
	height: auto;
	object-fit: contain;
}

.fsc-qv__sku {
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	opacity: 0.65;
}

.fsc-qv__title {
	margin: 4px 0 10px !important;
	font-size: 1.4rem !important;
	line-height: 1.25 !important;
	color: #fff !important;
	font-weight: 700 !important;
}

.fsc-qv__excerpt {
	font-size: 0.9rem;
	opacity: 0.85;
	margin-bottom: 10px;
}

.fsc-qv__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 16px;
}

.fsc-qv-loading {
	padding: 40px;
	text-align: center;
	color: #fff;
}

@media ( max-width: 768px ) {
	/* Image on top, text below. NB: the base rule uses !important, so the override must too. */
	.fsc-qv {
		grid-template-columns: 1fr !important;
		gap: 16px !important;
	}

	.fsc-qv-modal {
		padding: 20px !important;
	}

	.fsc-qv__media {
		padding: 12px !important;
	}

	/* Cap the image so the title/specs/buttons are visible without a long scroll. */
	.fsc-qv__media img {
		max-height: 34vh !important;
		width: auto !important;
	}

	.fsc-qv__title {
		font-size: 1.2rem !important;
	}
}
