/**
 * TM Multi Ticket Selector - Frontend Styles
 * Matches Flatsome / WooCommerce variation row layout.
 */

.tm-mts-selector {
	margin: 0 0 1.25em;
	padding: 0;
	border: none;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
}

/* Label + control rows (matches native variation attributes) */
.tm-mts-form-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
	gap: 0.65rem 1rem;
	align-items: center;
	margin-bottom: 0.85rem;
}

.tm-mts-field-label {
	margin: 0;
	font-weight: 600;
	font-size: 0.95em;
	line-height: 1.35;
	color: #222;
}

.tm-mts-field-control {
	min-width: 0;
	width: 100%;
}

.tm-mts-pickup-select {
	display: block;
	width: 100%;
	max-width: 100%;
	min-height: 42px;
	padding: 0.55em 2.25em 0.55em 0.85em;
	font-size: 0.92em;
	line-height: 1.35;
	color: #333;
	border: 1px solid #e2e2e2;
	border-radius: 10px;
	background-color: #f6f6f6;
	appearance: auto;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tm-mts-pickup-select:focus {
	border-color: #c8c8c8;
	outline: none;
	background-color: #fff;
}

.tm-mts-tickets {
	margin-bottom: 0.85rem;
}

.tm-mts-ticket-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas: 'info qty';
	align-items: center;
	gap: 0.65rem 0.75rem;
	padding: 0.7rem 0;
	border-bottom: 1px solid #ececec;
}

.tm-mts-ticket-row:first-child {
	padding-top: 0.15rem;
}

.tm-mts-ticket-row:last-child {
	border-bottom: none;
	padding-bottom: 0.15rem;
}

.tm-mts-ticket-info {
	grid-area: info;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	gap: 0.1rem;
}

.tm-mts-ticket-label {
	display: block;
	font-weight: 600;
	font-size: 0.95em;
	line-height: 1.3;
	color: #222;
}

.tm-mts-ticket-unit-price {
	display: block;
	min-height: 1.25em;
	font-size: 0.88em;
	font-weight: 600;
	line-height: 1.3;
	color: #555;
}

.tm-mts-ticket-unit-price:empty {
	min-height: 1.25em;
}

.tm-mts-ticket-unit-price.is-placeholder {
	font-weight: 500;
	font-size: 0.82em;
	color: #999;
}

.tm-mts-ticket-unit-price.is-unavailable {
	font-weight: 500;
	color: #b32d2e;
}

.tm-mts-qty-selector {
	grid-area: qty;
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	justify-self: end;
	width: auto;
	min-width: 7.25rem;
	border: 1px solid #e2e2e2;
	border-radius: 10px;
	overflow: hidden;
	background: #f6f6f6;
}

.tm-mts-qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 2.25rem;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	font-size: 1.05em;
	font-weight: 500;
	line-height: 1;
	border: none;
	background: transparent;
	color: #444;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.tm-mts-qty-btn:hover:not(:disabled) {
	background: #ececec;
}

.tm-mts-qty-btn:active:not(:disabled) {
	background: #e0e0e0;
}

.tm-mts-qty-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.tm-mts-qty {
	flex: 1 1 auto;
	width: 2rem;
	min-width: 2rem;
	height: 2.25rem;
	padding: 0;
	text-align: center;
	font-size: 0.92em;
	font-weight: 600;
	color: #222;
	border: none;
	border-left: 1px solid #e5e5e5;
	border-right: 1px solid #e5e5e5;
	border-radius: 0;
	background: #fff;
	-moz-appearance: textfield;
}

.tm-mts-qty::-webkit-outer-spin-button,
.tm-mts-qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.tm-mts-qty:disabled {
	background: #f0f0f0;
	color: #999;
}

.tm-mts-summary {
	margin-bottom: 0.85rem;
	padding: 0.85rem 0 0;
	border-top: 1px solid #ececec;
	background: transparent;
}

.tm-mts-summary-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.25em 0;
	font-size: 0.95em;
}

.tm-mts-summary-label {
	font-weight: 600;
	color: #333;
}

.tm-mts-total-seats {
	font-weight: 600;
	color: #222;
}

.tm-mts-summary-price {
	margin-top: 0.1rem;
	padding-top: 0.45rem;
	border-top: 1px solid #f0f0f0;
}

.tm-mts-summary-price .tm-mts-total-price {
	font-weight: 700;
	font-size: 1.05em;
	color: #111;
}

.tm-mts-messages {
	margin-bottom: 0.75rem;
}

.tm-mts-messages:empty {
	display: none;
	margin-bottom: 0;
}

.tm-mts-message {
	padding: 0.7em 0.9em;
	margin-bottom: 0.5em;
	border-radius: 8px;
	font-size: 0.9em;
	line-height: 1.45;
}

.tm-mts-message.is-error {
	background: #fcf0f1;
	border: 1px solid #e8b4b8;
	color: #8a1f21;
}

.tm-mts-pay-now {
	width: 100%;
	margin-top: 0;
	padding: 0.85em 1.5em;
	font-size: 0.95em;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-align: center;
	text-transform: uppercase;
	border-radius: 10px;
	cursor: pointer;
	transition: opacity 0.15s ease, transform 0.1s ease;
}

.tm-mts-pay-now:not(:disabled):active {
	transform: scale(0.99);
}

.tm-mts-pay-now:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.tm-mts-pay-now.is-loading {
	position: relative;
	color: transparent !important;
	pointer-events: none;
}

.tm-mts-pay-now.is-loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 1.25em;
	height: 1.25em;
	margin: -0.625em 0 0 -0.625em;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: tm-mts-spin 0.6s linear infinite;
}

@keyframes tm-mts-spin {
	to {
		transform: rotate(360deg);
	}
}

.tm-mts-selector.is-pickup-required .tm-mts-pickup-select {
	border-color: #d63638;
}

.tm-mts-ticket-row.is-disabled,
.tm-mts-ticket-row.is-awaiting-pickup {
	opacity: 1;
}

.tm-mts-ticket-row.is-disabled {
	opacity: 0.55;
}

.tm-mts-ticket-row.is-awaiting-pickup .tm-mts-qty-selector {
	opacity: 0.7;
}

.tm-mts-selector.is-processing {
	opacity: 0.85;
	pointer-events: none;
}

.tm-mts-selector.is-processing .tm-mts-pay-now {
	pointer-events: none;
}

.tm-mts-pickup-select:disabled {
	background: #f0f0f0;
	color: #666;
	cursor: not-allowed;
}

/* Flatsome compatibility */
.product-summary .tm-mts-selector,
.single-product .tm-mts-selector {
	clear: both;
}

.product-summary .tm-mts-pay-now,
.single-product .tm-mts-pay-now {
	margin-top: 0;
}

.product-summary .tm-mts-pay-now.button,
.single-product .tm-mts-pay-now.button {
	margin-bottom: 0;
}

/* Align with Flatsome variation table spacing */
.variations_form .tm-mts-selector,
form.cart .tm-mts-selector {
	width: 100%;
}

@media (max-width: 549px) {
	.tm-mts-form-row {
		grid-template-columns: 1fr;
		gap: 0.45rem;
	}

	.tm-mts-ticket-row {
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 0.5rem 0.65rem;
		padding: 0.65rem 0;
	}

	.tm-mts-qty-selector {
		min-width: 6.75rem;
	}

	.tm-mts-qty-btn {
		flex: 0 0 2rem;
		width: 2rem;
		height: 2rem;
	}

	.tm-mts-qty {
		height: 2rem;
		min-width: 1.75rem;
		width: 1.75rem;
		font-size: 0.88em;
	}
}

@media (max-width: 360px) {
	.tm-mts-ticket-label {
		font-size: 0.9em;
	}

	.tm-mts-ticket-unit-price.is-placeholder {
		font-size: 0.75em;
	}
}
