.htd-ai-launcher,
.htd-ai-launcher * {
	box-sizing: border-box;
}

/* Guard against theme/content filters injecting spacing tags inside shortcode output. */
.htd-ai-launcher br {
	display: none;
}

.htd-ai-launcher p:empty {
	display: none;
	margin: 0;
}

/* Hide formatter-injected wrapper paragraphs without touching intentional classed text. */
.htd-ai-launcher p:not([class]) {
	display: none;
	margin: 0;
}

.htd-ai-launcher {
	/* Keep typography aligned with the active WP theme while maintaining a stable local scale. */
	--htd-ai-text-sm: 0.95rem;
	--htd-ai-text-base: 1rem;
	--htd-ai-text-lg: 1.125rem;
	--htd-ai-text-xl: clamp(1.55rem, 2.8vw, 2.05rem);
	--htd-ai-line-tight: 1.25;
	--htd-ai-line-normal: 1.45;

	font-family: inherit;
	font-size: var(--htd-ai-text-base);
	line-height: var(--htd-ai-line-normal);
	color: inherit;
	border: 1px solid #d8dee8;
	border-radius: 12px;
	padding: 18px;
	margin: 18px 0;
	background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
	box-shadow: 0 8px 20px rgba(16, 24, 40, 0.05);
}

.htd-ai-launcher__header {
	margin: 0 0 10px 0;
}

.htd-ai-launcher__title {
	margin: 0 0 6px 0;
	font-size: var(--htd-ai-text-xl);
	line-height: var(--htd-ai-line-tight);
	letter-spacing: -0.01em;
	color: #101828;
	font-weight: 700;
}

.htd-ai-launcher__description {
	margin: 0 0 14px 0;
	color: #475467;
	font-size: var(--htd-ai-text-lg);
	line-height: var(--htd-ai-line-normal);
}

.htd-ai-launcher__template-picker {
	display: grid;
	row-gap: 4px;
	margin: 0 0 10px 0;
}

.htd-ai-launcher__template-picker-label {
	display: block;
	margin: 0 0 4px 0;
	font-size: var(--htd-ai-text-lg);
	line-height: var(--htd-ai-line-normal);
	font-weight: 600;
	color: #1d2939;
}

.htd-ai-launcher__template-picker-select {
	width: 100%;
	max-width: 380px;
	padding: 9px 36px 9px 12px;
	border: 1px solid #c7d0dc;
	border-radius: 8px;
	background: #fff;
	/* Force a visible dropdown indicator across browsers/themes. */
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23344054' d='M1.41.59 6 5.17 10.59.59 12 2 6 8 0 2z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	background-size: 12px 8px;
	color: #1d2939;
	font: inherit;
	font-size: var(--htd-ai-text-base);
	line-height: var(--htd-ai-line-normal);
	margin: 0;
}

/* Prevent theme form styles from introducing large vertical gaps inside the widget. */
.htd-ai-launcher .htd-ai-launcher__template-picker > * {
	margin-top: 0;
}

.htd-ai-launcher__template-picker-select:focus {
	border-color: #1d4ed8;
	outline: 2px solid rgba(29, 78, 216, 0.15);
	outline-offset: 1px;
}

.htd-ai-launcher__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.htd-ai-launcher__attribution {
	margin: 8px 0 0 0;
	font-size: 0.78rem;
	line-height: 1.35;
	color: #667085;
	letter-spacing: normal;
	text-transform: none;
	opacity: 0.9;
	font-family: inherit;
	font-weight: 400;
}

.htd-ai-launcher__button {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border: 1px solid #c7d0dc;
	border-radius: 8px;
	background: #ffffff;
	cursor: pointer;
	font: inherit;
	font-size: var(--htd-ai-text-base);
	line-height: var(--htd-ai-line-tight);
	font-weight: 600;
	color: #1d2939;
	transition: all 120ms ease;
}

.htd-ai-launcher__button:hover,
.htd-ai-launcher__button:focus {
	background: #f2f6fc;
	border-color: #9fb0c9;
	transform: translateY(-1px);
}

.htd-ai-launcher__icon {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

/* Footer widgets should be visually lighter and more compact than article widgets. */
.htd-ai-launcher--footer {
	max-width: 680px;
	padding: 10px 12px;
	margin-top: 10px;
	margin-bottom: 10px;
}

.htd-ai-launcher--footer .htd-ai-launcher__header {
	margin-bottom: 4px;
}

.htd-ai-launcher--footer .htd-ai-launcher__header .htd-ai-launcher__title {
	font-size: clamp(1.12rem, 1.2vw, 1.38rem);
	line-height: 1.2;
	margin: 0 0 2px 0;
}

.htd-ai-launcher--footer .htd-ai-launcher__description {
	font-size: 0.94rem;
	line-height: 1.4;
	margin: 0 0 6px 0;
}

.htd-ai-launcher--footer .htd-ai-launcher__template-picker-label {
	font-size: 0.96rem;
	margin: 0 0 2px 0;
}

.htd-ai-launcher--footer .htd-ai-launcher__template-picker-select {
	max-width: 300px;
	padding-top: 6px;
	padding-bottom: 6px;
	font-size: 0.92rem;
}

.htd-ai-launcher--footer .htd-ai-launcher__template-picker {
	row-gap: 2px;
	margin: 0 0 5px 0;
}

.htd-ai-launcher--footer .htd-ai-launcher__buttons {
	gap: 6px;
}

.htd-ai-launcher--footer .htd-ai-launcher__button {
	padding: 7px 11px;
	font-size: 0.88rem;
}

.htd-ai-launcher--footer .htd-ai-launcher__icon {
	width: 18px;
	height: 18px;
}

.htd-ai-launcher--footer .htd-ai-launcher__attribution {
	margin-top: 6px;
	font-size: 0.74rem;
}

/* Keep article widget readable but a bit tighter than the original oversized pass. */
.htd-ai-launcher--article {
	padding: 14px 16px;
}

.htd-ai-launcher--article .htd-ai-launcher__header {
	margin-bottom: 10px;
}

.htd-ai-launcher--article .htd-ai-launcher__title {
	font-size: clamp(1.45rem, 2.2vw, 1.85rem);
	margin-bottom: 4px;
}

.htd-ai-launcher--article .htd-ai-launcher__description {
	font-size: 1.05rem;
	margin-bottom: 10px;
}

.htd-ai-launcher--article .htd-ai-launcher__template-picker-label {
	font-size: 1.03rem;
}

.htd-ai-launcher--article .htd-ai-launcher__template-picker {
	margin-bottom: 10px;
}

.htd-ai-launcher--article .htd-ai-launcher__attribution {
	margin-top: 8px;
}

.htd-ai-launcher__modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.htd-ai-launcher__modal.is-open {
	display: flex;
}

.htd-ai-launcher__modal[hidden] {
	display: none !important;
}

.htd-ai-launcher__modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
}

.htd-ai-launcher__modal-dialog {
	position: relative;
	width: 100%;
	max-width: 680px;
	max-height: 90vh;
	overflow: auto;
	background: #fff;
	border-radius: 12px;
	padding: 22px;
	box-shadow: 0 14px 30px rgba(16, 24, 40, 0.18);
	color: #101828;
}

.htd-ai-launcher__modal-header {
	margin: 0 0 8px 0;
}

.htd-ai-launcher__modal-title {
	margin: 0;
	font-size: clamp(1.2rem, 2vw, 1.45rem);
	line-height: var(--htd-ai-line-tight);
	color: #101828;
}

.htd-ai-launcher__modal-subheader {
	margin: 0;
	color: #475467;
	font-size: var(--htd-ai-text-sm);
	line-height: var(--htd-ai-line-normal);
}

.htd-ai-launcher__modal-subheader strong {
	display: inline-block;
	margin-right: 6px;
	color: #101828;
}

.htd-ai-launcher__provider-meta {
	margin: 0 0 14px 0;
	padding: 10px 12px;
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	background: #f8fafc;
	display: grid;
	gap: 6px;
}

.htd-ai-launcher__warning {
	margin: 0 0 12px 0;
	padding: 10px 12px;
	border: 1px solid #d0d5dd;
	background: #fffbeb;
	color: #344054;
	border-radius: 8px;
	font-size: var(--htd-ai-text-sm);
	line-height: var(--htd-ai-line-normal);
}

.htd-ai-launcher__modal-error {
	margin: 0 0 12px 0;
	padding: 12px;
	border: 1px solid #fda29b;
	background: #fffbfa;
	color: #912018;
	border-radius: 8px;
	font-size: var(--htd-ai-text-sm);
	line-height: var(--htd-ai-line-normal);
}

.htd-ai-launcher__modal-error strong {
	display: block;
	margin-bottom: 4px;
}

.htd-ai-launcher__prompt-section {
	margin: 0 0 8px 0;
}

.htd-ai-launcher__prompt-label {
	display: block;
	margin: 0 0 8px 0;
	font-weight: 600;
	color: #101828;
	font-size: var(--htd-ai-text-base);
	line-height: var(--htd-ai-line-normal);
}

.htd-ai-launcher__prompt {
	width: 100%;
	max-height: 210px;
	min-height: 130px;
	padding: 10px 12px;
	font-size: var(--htd-ai-text-base);
	line-height: var(--htd-ai-line-normal);
	border: 1px solid #d0d5dd;
	border-radius: 8px;
	background: #fcfcfd;
	resize: vertical;
	font-family: inherit;
	color: #101828 !important;
	-webkit-text-fill-color: #101828 !important;
	caret-color: #101828;
	color-scheme: light;
}

.htd-ai-launcher__trust-cue {
	margin: 0 0 8px 0;
	font-size: var(--htd-ai-text-sm);
	line-height: var(--htd-ai-line-normal);
	color: #475467;
}

.htd-ai-launcher__copy-feedback {
	min-height: 1.2em;
	margin: 6px 0 0 0;
	font-size: var(--htd-ai-text-sm);
	color: #027a48;
}

.htd-ai-launcher__modal-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 12px;
	align-items: center;
}

.htd-ai-launcher__action-button {
	appearance: none;
	border: 1px solid transparent;
	border-radius: 8px;
	padding: 10px 14px;
	min-height: 42px;
	font: inherit;
	font-size: var(--htd-ai-text-base);
	font-weight: 600;
	line-height: var(--htd-ai-line-tight);
	cursor: pointer;
	transition: all 120ms ease;
}

.htd-ai-launcher__action-button--primary {
	background: #1d4ed8;
	color: #fff;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

.htd-ai-launcher__action-button--primary:hover,
.htd-ai-launcher__action-button--primary:focus {
	background: #1e40af;
}

.htd-ai-launcher__action-button--secondary {
	background: #fff;
	color: #344054;
	border-color: #d0d5dd;
}

.htd-ai-launcher__action-button--secondary:hover,
.htd-ai-launcher__action-button--secondary:focus {
	background: #f9fafb;
	border-color: #98a2b3;
}

.htd-ai-launcher__action-button--secondary.htd-ai-launcher__action-button--emphasized {
	background: #1d4ed8;
	color: #fff;
	border-color: #1d4ed8;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12);
}

.htd-ai-launcher__button-tertiary {
	appearance: none;
	border: 1px solid #d0d5dd;
	background: #fff;
	color: #475467;
	padding: 10px 14px;
	min-height: 42px;
	cursor: pointer;
	border-radius: 8px;
	text-decoration: none;
	font-family: inherit;
	font-size: var(--htd-ai-text-base);
	font-weight: 500;
	line-height: var(--htd-ai-line-tight);
	transition: background 120ms ease, color 120ms ease;
}

.htd-ai-launcher__button-tertiary:hover,
.htd-ai-launcher__button-tertiary:focus {
	background: #f9fafb;
	border-color: #98a2b3;
	color: #344054;
}

@media (max-width: 600px) {
	.htd-ai-launcher {
		padding: 12px;
	}

	.htd-ai-launcher__title {
		font-size: clamp(1.35rem, 6vw, 1.7rem);
	}

	.htd-ai-launcher__button {
		width: 100%;
		justify-content: center;
	}

	.htd-ai-launcher__template-picker-select {
		max-width: 100%;
	}

	.htd-ai-launcher__modal-dialog {
		padding: 16px;
		max-height: 92vh;
	}

	.htd-ai-launcher__modal-actions .htd-ai-launcher__action-button {
		width: 100%;
	}

	.htd-ai-launcher__button-tertiary {
		width: 100%;
		text-align: center;
	}
}
