/**
 * Pterodactyl Hosting — front-end styles.
 *
 * The design deliberately inherits from the active theme instead of imposing a
 * palette: colours fall back through WordPress theme.json presets, then
 * Elementor global colours, then a neutral default. A site that defines either
 * of the first two gets a dashboard that matches its theme with no extra work,
 * and the Elementor style controls override the same variables.
 */

.pth {
	--pth-accent: var(--wp--preset--color--primary, var(--e-global-color-primary, #4f46e5));
	--pth-accent-contrast: var(--wp--preset--color--base, #ffffff);
	--pth-surface: var(--wp--preset--color--base, #ffffff);
	--pth-text: var(--wp--preset--color--contrast, currentColor);
	--pth-muted: color-mix(in srgb, var(--pth-text) 62%, transparent);
	--pth-line: color-mix(in srgb, var(--pth-text) 14%, transparent);
	--pth-radius: 14px;
	--pth-gap: 1.25rem;
	--pth-delay: 0ms;

	/* Typography is inherited outright so headings match the theme. */
	font-family: inherit;
	font-size: inherit;
	color: var(--pth-text);
	box-sizing: border-box;
}

.pth *,
.pth *::before,
.pth *::after {
	box-sizing: inherit;
}

/* Older browsers without color-mix() still need readable secondary text. */
@supports not (color: color-mix(in srgb, red 50%, transparent)) {
	.pth {
		--pth-muted: currentColor;
		--pth-line: rgba(127, 127, 127, 0.28);
	}
}

/* ---------------------------------------------------------------- layout */

.pth-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
	gap: var(--pth-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.pth-card,
.pth-plan,
.pth-notice,
.pth-empty,
.pth-deploy {
	background: var(--pth-surface);
	border: 1px solid var(--pth-line);
	border-radius: var(--pth-radius);
	padding: 1.25rem;
}

.pth-card {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.pth-card:hover,
.pth-card:focus-within {
	transform: translateY(-3px);
	border-color: color-mix(in srgb, var(--pth-accent) 45%, var(--pth-line));
	box-shadow: 0 12px 30px -18px color-mix(in srgb, var(--pth-text) 55%, transparent);
}

.pth-card__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
}

.pth-card__title {
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.pth-card__plan {
	margin: 0;
	color: var(--pth-muted);
	font-size: 0.9rem;
}

.pth-card__expiry {
	margin: 0;
	font-size: 0.82rem;
	color: var(--pth-muted);
}

/* ------------------------------------------------------------ state pill */

.pth-state {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	flex: none;
	padding: 0.25rem 0.6rem;
	border-radius: 999px;
	border: 1px solid var(--pth-line);
	font-size: 0.75rem;
	letter-spacing: 0.02em;
	text-transform: capitalize;
	white-space: nowrap;
}

.pth-state__dot {
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: var(--pth-muted);
	flex: none;
}

.pth-state--running .pth-state__dot {
	background: #16a34a;
	animation: pth-pulse 2.2s ease-in-out infinite;
}

.pth-state--starting .pth-state__dot,
.pth-state--stopping .pth-state__dot,
.pth-state--provisioning .pth-state__dot {
	background: #d97706;
	animation: pth-pulse 1.1s ease-in-out infinite;
}

.pth-state--offline .pth-state__dot,
.pth-state--unreachable .pth-state__dot {
	background: #dc2626;
}

/* ----------------------------------------------------------------- specs */

.pth-specs {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 0.5rem;
	margin: 0;
	padding-top: 0.75rem;
	border-top: 1px solid var(--pth-line);
}

.pth-specs__item {
	margin: 0;
	min-width: 0;
}

.pth-specs dt {
	margin: 0;
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--pth-muted);
}

.pth-specs dd {
	margin: 0.1rem 0 0;
	font-size: 0.95rem;
	font-variant-numeric: tabular-nums;
}

.pth-badge {
	display: inline-block;
	margin-left: 0.35rem;
	padding: 0.1rem 0.45rem;
	border-radius: 999px;
	font-size: 0.7rem;
	background: color-mix(in srgb, var(--pth-accent) 16%, transparent);
	color: var(--pth-accent);
}

/* --------------------------------------------------------------- buttons */

.pth-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.55rem 1rem;
	border: 1px solid var(--pth-line);
	border-radius: calc(var(--pth-radius) - 6px);
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 0.9rem;
	line-height: 1.2;
	cursor: pointer;
	text-decoration: none;
	transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms ease;
}

.pth-btn:hover:not([disabled]) {
	border-color: var(--pth-accent);
	background: color-mix(in srgb, var(--pth-accent) 10%, transparent);
}

.pth-btn:active:not([disabled]) {
	transform: translateY(1px);
}

/* Keyboard focus must stay obvious even when the theme resets outlines. */
.pth-btn:focus-visible {
	outline: 2px solid var(--pth-accent);
	outline-offset: 2px;
}

.pth-btn[disabled],
.pth-btn[aria-busy="true"] {
	opacity: 0.62;
	cursor: not-allowed;
}

.pth-btn--primary {
	background: var(--pth-accent);
	border-color: var(--pth-accent);
	color: var(--pth-accent-contrast);
}

.pth-btn--primary:hover:not([disabled]) {
	background: color-mix(in srgb, var(--pth-accent) 86%, black);
	color: var(--pth-accent-contrast);
}

.pth-btn--wide {
	width: 100%;
}

.pth-btn--danger:hover:not([disabled]) {
	border-color: #dc2626;
	background: color-mix(in srgb, #dc2626 12%, transparent);
}

.pth-card__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: auto;
}

/* --------------------------------------------------------------- spinner */

.pth-spinner {
	display: none;
	width: 0.95em;
	height: 0.95em;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: pth-spin 700ms linear infinite;
}

.pth-btn[aria-busy="true"] .pth-spinner {
	display: inline-block;
}

/* ------------------------------------------------------------ form + plans */

.pth-form {
	display: grid;
	gap: 1rem;
}

.pth-field {
	display: grid;
	gap: 0.4rem;
	border: 0;
	margin: 0;
	padding: 0;
}

.pth-label {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--pth-muted);
}

.pth-input {
	width: 100%;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--pth-line);
	border-radius: calc(var(--pth-radius) - 6px);
	background: transparent;
	color: inherit;
	font: inherit;
}

.pth-input:focus-visible {
	outline: 2px solid var(--pth-accent);
	outline-offset: 1px;
}

.pth-field--plans {
	display: grid;
	gap: 0.5rem;
}

.pth-choice {
	display: flex;
	align-items: flex-start;
	gap: 0.65rem;
	padding: 0.75rem;
	border: 1px solid var(--pth-line);
	border-radius: calc(var(--pth-radius) - 4px);
	cursor: pointer;
	transition: border-color 160ms ease, background-color 160ms ease;
}

.pth-choice:hover {
	border-color: color-mix(in srgb, var(--pth-accent) 50%, var(--pth-line));
}

.pth-choice:has(input:checked) {
	border-color: var(--pth-accent);
	background: color-mix(in srgb, var(--pth-accent) 8%, transparent);
}

.pth-choice__body {
	display: grid;
	gap: 0.15rem;
}

.pth-choice__name {
	font-weight: 600;
}

.pth-choice__meta,
.pth-choice__specs {
	font-size: 0.82rem;
	color: var(--pth-muted);
}

.pth-plan {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	position: relative;
}

.pth-plan--featured {
	border-color: var(--pth-accent);
	box-shadow: 0 0 0 1px var(--pth-accent) inset;
}

.pth-plan__flag {
	position: absolute;
	top: -0.7rem;
	left: 1rem;
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
	font-size: 0.7rem;
	background: var(--pth-accent);
	color: var(--pth-accent-contrast);
}

.pth-plan__name,
.pth-plans__title,
.pth-deploy__title,
.pth-empty__title {
	margin: 0;
	font-family: inherit;
}

.pth-plan__price {
	margin: 0;
	display: flex;
	align-items: baseline;
	gap: 0.35rem;
}

.pth-plan__amount {
	font-size: 1.9rem;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

.pth-plan__period,
.pth-plan__description {
	font-size: 0.85rem;
	color: var(--pth-muted);
	margin: 0;
}

.pth-plan__features {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.3rem;
	font-size: 0.88rem;
}

.pth-plan__features li {
	position: relative;
	padding-left: 1.1rem;
}

.pth-plan__features li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.45em;
	width: 0.45rem;
	height: 0.45rem;
	border-radius: 50%;
	background: var(--pth-accent);
}

.pth-plan__features + .pth-btn {
	margin-top: auto;
}

/* -------------------------------------------------------- empty + status */

.pth-empty {
	text-align: center;
	display: grid;
	justify-items: center;
	gap: 0.5rem;
	padding: 2.5rem 1.25rem;
}

.pth-empty__glyph {
	width: 2.75rem;
	height: 2.75rem;
	border-radius: calc(var(--pth-radius) - 4px);
	border: 2px dashed var(--pth-line);
	animation: pth-float 4s ease-in-out infinite;
}

.pth-empty__text,
.pth-notice__text {
	margin: 0;
	color: var(--pth-muted);
}

.pth-notice {
	display: grid;
	justify-items: start;
	gap: 0.75rem;
}

.pth-live,
.pth-form__feedback {
	margin: 0.75rem 0 0;
	font-size: 0.88rem;
	min-height: 1.2em;
}

.pth-live:empty,
.pth-form__feedback:empty {
	margin: 0;
	min-height: 0;
}

.pth-form__feedback[data-tone="error"],
.pth-live[data-tone="error"] {
	color: #b91c1c;
}

.pth-form__feedback[data-tone="success"],
.pth-live[data-tone="success"] {
	color: #15803d;
}

/* ------------------------------------------------------------ animations */

/*
 * Reveal animation. Elements start hidden only when the browser supports the
 * animation, so if anything goes wrong the content is still visible rather
 * than stuck at opacity 0.
 */
@media (prefers-reduced-motion: no-preference) {
	.pth-reveal {
		animation: pth-reveal 520ms cubic-bezier(0.22, 0.8, 0.28, 1) both;
		animation-delay: var(--pth-delay, 0ms);
	}

	.pth-widget--static .pth-reveal {
		animation: none;
	}
}

@keyframes pth-reveal {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

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

@keyframes pth-pulse {
	0%,
	100% {
		opacity: 1;
		box-shadow: 0 0 0 0 currentColor;
	}

	50% {
		opacity: 0.55;
		box-shadow: 0 0 0 3px transparent;
	}
}

@keyframes pth-float {
	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-5px);
	}
}

/* A newly added card gets a brief highlight so it is easy to spot. */
.pth-card--fresh {
	animation: pth-reveal 520ms cubic-bezier(0.22, 0.8, 0.28, 1) both,
		pth-flash 1.6s ease-out 520ms 1;
}

@keyframes pth-flash {
	from {
		box-shadow: 0 0 0 2px var(--pth-accent);
	}

	to {
		box-shadow: 0 0 0 2px transparent;
	}
}

/* Honour the OS setting: no motion, no transitions, no pulses. */
@media (prefers-reduced-motion: reduce) {
	.pth *,
	.pth *::before,
	.pth *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}

	.pth-card:hover,
	.pth-card:focus-within {
		transform: none;
	}
}

/* ---------------------------------------------------------------- narrow */

@media (max-width: 480px) {
	.pth-specs {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.pth-card__actions .pth-btn {
		flex: 1 1 auto;
	}
}





