/**
 * Loading Spinner Component Styles
 *
 * Loading spinner for submit buttons and overlays.
 *
 * @package MphbGuestServices
 * @since 2.0.0
 */

/* ========================================
 * Button Loading State
 * ======================================== */

.gs-btn--loading {
	position: relative;
	pointer-events: none;
	color: transparent !important;
}

.gs-btn--loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 16px;
	height: 16px;
	margin: -8px 0 0 -8px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: gs-spinner-rotate 0.6s linear infinite;
	color: var(--gs-color-text-inverse);
}

/* ========================================
 * Standalone Spinner
 * ======================================== */

.gs-spinner {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
}

.gs-spinner__circle {
	width: 32px;
	height: 32px;
	border: 4px solid #e5e7eb;
	border-right-color: var(--gs-color-primary, #3b82f6);
	border-radius: 50%;
	animation: gs-spinner-rotate 0.6s linear infinite;
}

.gs-spinner--sm .gs-spinner__circle {
	width: 16px;
	height: 16px;
	border-width: 2px;
}

.gs-spinner--lg .gs-spinner__circle {
	width: 32px;
	height: 32px;
	border-width: 4px;
}

/* ========================================
 * Form Overlay with Spinner
 * ======================================== */

.gs-form-overlay {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.85);
	backdrop-filter: blur(4px);
	z-index: 9999;
}

.gs-form-overlay--active {
	display: flex;
}

.gs-form-overlay__spinner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.gs-form-overlay__message {
	font-size: 14px;
	color: #555;
}

/* ========================================
 * Animations
 * ======================================== */

@keyframes gs-spinner-rotate {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* ========================================
 * Form Position Context
 * ======================================== */

.gs-form-with-overlay {
	position: relative;
}

/* ========================================
 * Tab Radio Disabled State (During Processing)
 * ======================================== */

.mphb-gs-breakfast-type-radio:disabled,
.mphb-gs-meal-plan-type-radio:disabled {
	cursor: not-allowed;
}

.mphb-gs-breakfast-type-radio:disabled ~ .mphb-gs-breakfast-type-label,
.mphb-gs-breakfast-type-radio:disabled + .mphb-gs-breakfast-type-label,
.mphb-gs-meal-plan-type-radio:disabled ~ .mphb-gs-meal-plan-type-label,
.mphb-gs-meal-plan-type-radio:disabled + .mphb-gs-meal-plan-type-label {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
}

/* ========================================
 * Dark Mode Support
 * ======================================== */

@media (prefers-color-scheme: dark) {
	.mphb-gs-shell[data-theme="auto"] .gs-form-overlay {
		background: rgba(26, 29, 35, 0.85);
	}

	.mphb-gs-shell[data-theme="auto"] .gs-form-overlay__message {
		color: #e5e7eb;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-form-overlay__percent {
		color: #e5e7eb;
	}

	.mphb-gs-shell[data-theme="auto"] .gs-spinner__circle {
		border-color: #2d3139;
		border-right-color: var(--gs-color-primary, #3b82f6);
	}
}

.mphb-gs-shell[data-theme="dark"] .gs-form-overlay {
	background: rgba(26, 29, 35, 0.85);
}

.mphb-gs-shell[data-theme="dark"] .gs-form-overlay__message {
	color: #e5e7eb;
}

.mphb-gs-shell[data-theme="dark"] .gs-form-overlay__percent {
	color: #e5e7eb;
}

.mphb-gs-shell[data-theme="dark"] .gs-spinner__circle {
	border-color: #2d3139;
	border-right-color: var(--gs-color-primary, #3b82f6);
}
