/**
 * YUSR Tag Generator - frontend styles.
 *
 * Everything is scoped under .yusr-tg so the plugin cannot affect the rest of
 * the site, and so the active theme cannot break the tool.
 */

.yusr-tg {
	--yusr-ink: #1a1b22;
	--yusr-soft: #62667a;
	--yusr-line: #e2e5ef;
	--yusr-surface: #ffffff;
	--yusr-wash: #f6f7fb;
	--yusr-accent: #c3172c;
	--yusr-accent-deep: #8f0f20;
	--yusr-good: #0f7a52;
	--yusr-bad: #b3261e;
	--yusr-radius: 14px;
	--yusr-radius-sm: 10px;
	--yusr-gap: 18px;

	max-width: 760px;
	margin: 0 auto;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.55;
	color: var(--yusr-ink);
	text-align: left;
}

.yusr-tg *,
.yusr-tg *::before,
.yusr-tg *::after {
	box-sizing: border-box;
}

.yusr-tg__card {
	background: var(--yusr-surface);
	border: 1px solid var(--yusr-line);
	border-radius: var(--yusr-radius);
	padding: 28px;
}

/* ---------------------------------------------------------------- header */

.yusr-tg__header {
	margin-bottom: 24px;
}

.yusr-tg__title {
	margin: 0 0 6px;
	font-size: 1.55rem;
	line-height: 1.25;
	font-weight: 700;
	letter-spacing: -0.015em;
	color: var(--yusr-ink);
}

.yusr-tg__subtitle {
	margin: 0;
	max-width: 52ch;
	color: var(--yusr-soft);
	font-size: 0.95rem;
}

.yusr-tg__notice {
	margin: 0 0 20px;
	padding: 12px 14px;
	border-radius: var(--yusr-radius-sm);
	background: #fff6e5;
	border: 1px solid #f0d9a8;
	color: #7a5200;
	font-size: 0.9rem;
}

.yusr-tg__notice a {
	color: #7a5200;
}

/* ---------------------------------------------------------------- fields */

.yusr-tg__field {
	margin-bottom: var(--yusr-gap);
}

.yusr-tg__label {
	display: block;
	margin-bottom: 7px;
	font-size: 0.92rem;
	font-weight: 600;
	color: var(--yusr-ink);
}

.yusr-tg__optional {
	margin-left: 6px;
	font-weight: 400;
	font-size: 0.82rem;
	color: var(--yusr-soft);
}

.yusr-tg__input {
	display: block;
	width: 100%;
	margin: 0;
	padding: 13px 14px;
	font-family: inherit;
	font-size: 1rem;
	line-height: 1.5;
	color: var(--yusr-ink);
	background: var(--yusr-wash);
	border: 1px solid var(--yusr-line);
	border-radius: var(--yusr-radius-sm);
	box-shadow: none;
	transition: border-color 0.15s ease, background-color 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.yusr-tg__input::placeholder {
	color: #9096a8;
	opacity: 1;
}

.yusr-tg__input:hover {
	border-color: #cfd4e2;
}

.yusr-tg__input:focus {
	outline: 2px solid var(--yusr-accent);
	outline-offset: 2px;
	background: var(--yusr-surface);
	border-color: var(--yusr-accent);
}

.yusr-tg__textarea {
	min-height: 130px;
	resize: vertical;
}

.yusr-tg__input--invalid {
	border-color: var(--yusr-bad);
}

/* ---------------------------------------------------------------- button */

.yusr-tg__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 52px;
	margin-top: 4px;
	padding: 14px 22px;
	font-family: inherit;
	font-size: 1.02rem;
	font-weight: 650;
	color: #fff;
	background: var(--yusr-accent);
	border: 0;
	border-radius: var(--yusr-radius-sm);
	cursor: pointer;
	text-decoration: none;
	transition: background-color 0.15s ease, transform 0.08s ease;
	-webkit-appearance: none;
	appearance: none;
}

.yusr-tg__submit:hover:not(:disabled) {
	background: var(--yusr-accent-deep);
}

.yusr-tg__submit:active:not(:disabled) {
	transform: translateY(1px);
}

.yusr-tg__submit:focus-visible {
	outline: 2px solid var(--yusr-ink);
	outline-offset: 3px;
}

.yusr-tg__submit:disabled {
	cursor: not-allowed;
	opacity: 0.72;
}

.yusr-tg__spinner {
	display: none;
	width: 17px;
	height: 17px;
	border: 2px solid rgba(255, 255, 255, 0.45);
	border-top-color: #fff;
	border-radius: 50%;
	animation: yusr-tg-spin 0.7s linear infinite;
}

.yusr-tg.is-loading .yusr-tg__spinner {
	display: block;
}

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

/* ----------------------------------------------------------------- alert */

.yusr-tg__alert {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	margin-top: 16px;
	padding: 12px 14px;
	border-radius: var(--yusr-radius-sm);
	background: #fdecea;
	border: 1px solid #f3c2bd;
	color: var(--yusr-bad);
	font-size: 0.92rem;
}

.yusr-tg__alert::before {
	content: "!";
	flex: 0 0 20px;
	height: 20px;
	margin-top: 1px;
	border-radius: 50%;
	background: var(--yusr-bad);
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
}

.yusr-tg__alert[hidden] {
	display: none;
}

/* ---------------------------------------------------------------- result */

.yusr-tg__result {
	margin-top: 26px;
	padding: 22px;
	border-radius: var(--yusr-radius);
	background: var(--yusr-ink);
	color: #f3f4f8;
}

.yusr-tg__result[hidden] {
	display: none;
}

.yusr-tg__result.is-new {
	animation: yusr-tg-reveal 0.28s ease-out;
}

@keyframes yusr-tg-reveal {
	from {
		opacity: 0;
		transform: translateY(8px);
	}

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

.yusr-tg__result-head {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 14px;
}

.yusr-tg__result-title {
	margin: 0;
	font-size: 1.02rem;
	font-weight: 600;
	color: #fff;
}

.yusr-tg__badge {
	padding: 3px 11px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.12);
	color: #e7e9f2;
	font-size: 0.8rem;
	white-space: nowrap;
}

.yusr-tg__tags {
	margin: 0 0 18px;
	padding: 16px;
	border-radius: var(--yusr-radius-sm);
	background: rgba(255, 255, 255, 0.07);
	color: #f5f6fa;
	font-size: 0.98rem;
	line-height: 1.7;
	word-break: break-word;
	overflow-wrap: anywhere;
	-webkit-user-select: all;
	user-select: all;
}

.yusr-tg__result-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.yusr-tg__copy {
	min-height: 44px;
	padding: 11px 20px;
	font-family: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--yusr-ink);
	background: #fff;
	border: 0;
	border-radius: var(--yusr-radius-sm);
	cursor: pointer;
	transition: background-color 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.yusr-tg__copy:hover {
	background: #e8eaf2;
}

.yusr-tg__copy:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

.yusr-tg__copy.is-copied {
	background: var(--yusr-good);
	color: #fff;
}

.yusr-tg__counter {
	color: #b9bdcd;
	font-size: 0.88rem;
	font-variant-numeric: tabular-nums;
}

.yusr-tg__copy-status {
	margin: 12px 0 0;
	font-size: 0.85rem;
	color: #b9bdcd;
	min-height: 1px;
}

.yusr-tg__copy-status:empty {
	margin: 0;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 600px) {
	.yusr-tg {
		font-size: 15px;
	}

	.yusr-tg__card {
		padding: 20px 16px;
		border-radius: 12px;
	}

	.yusr-tg__title {
		font-size: 1.35rem;
	}

	.yusr-tg__result {
		padding: 18px 15px;
	}

	.yusr-tg__result-foot {
		flex-direction: column;
		align-items: stretch;
	}

	.yusr-tg__copy {
		width: 100%;
	}

	.yusr-tg__counter {
		text-align: center;
	}

	/* 16px keeps iOS from zooming in when a field is focused. */
	.yusr-tg__input {
		font-size: 16px;
	}
}

@media (max-width: 360px) {
	.yusr-tg__card {
		padding: 16px 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.yusr-tg__result.is-new,
	.yusr-tg__spinner {
		animation: none;
	}

	.yusr-tg__submit,
	.yusr-tg__input,
	.yusr-tg__copy {
		transition: none;
	}
}
