/* Adams WhatsApp Text Formatter
   Built on top of the site's own design tokens (Blocksy "theme-palette"
   custom properties) so it stays in sync with the brand colors set in
   Customizer > Colors, rather than hard-coding a separate palette. */

.awtf {
	--awtf-red: var(--theme-palette-color-1, #DA1F30);
	--awtf-grey-light: var(--theme-palette-color-2, #F2F2F2);
	--awtf-black: var(--theme-palette-color-3, #0A0A0A);
	--awtf-white: var(--theme-palette-color-4, #ffffff);
	--awtf-text: var(--theme-palette-color-5, #424242);
	--awtf-grey-lighter: var(--theme-palette-color-6, #F6F6F6);

	--awtf-border: var(--theme-form-field-border-initial-color, #c4c4c4);
	--awtf-border-focus: var(--theme-form-field-border-focus-color, #383838);
	--awtf-radius: var(--theme-button-border-radius, 3px);

	--awtf-font-heading: 'Stack Sans Headline', Arial, sans-serif;
	--awtf-font-body: 'Inter', Arial, sans-serif;
	--awtf-font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

	max-width: 1350px;
	margin: 40px auto;
	padding: 0 16px;
	box-sizing: border-box;
	font-family: var(--awtf-font-body);
	color: var(--awtf-text);
}

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

/* Desktop: editor on the left, a sticky live preview on the right. */
@media (min-width: 1000px) {
	.awtf {
		display: grid;
		grid-template-columns: 1.15fr 0.85fr;
		gap: 32px;
		align-items: start;
	}

	.awtf__preview-wrap {
		position: sticky;
		top: 20px;
	}
}

/* Card / section shell, shared by the builder and the preview frame */

.awtf__card,
.awtf__preview-frame {
	background: var(--awtf-white);
	border: 1px solid var(--awtf-grey-light);
	border-radius: 8px;
	box-shadow: 0 2px 20px rgba(10, 10, 10, 0.06);
}

.awtf__card {
	padding: 32px;
}

.awtf__preview-frame {
	padding: 24px;
	min-height: 160px;
}

@media (max-width: 480px) {
	.awtf__card {
		padding: 22px 18px;
	}
	.awtf__preview-frame {
		padding: 18px;
	}
}

.awtf__section + .awtf__section {
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid var(--awtf-grey-light);
}

.awtf__section-title {
	font-family: var(--awtf-font-heading);
	font-weight: 500;
	font-size: 20px;
	line-height: 1.3;
	color: var(--awtf-black);
	margin: 0;
}

.awtf__subtitle {
	font-family: var(--awtf-font-heading);
	font-weight: 500;
	font-size: 15.5px;
	line-height: 1.3;
	color: var(--awtf-black);
	margin: 0 0 14px;
}

.awtf__label-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 14px;
}

.awtf__char-count {
	font-size: 12px;
	color: var(--awtf-text);
	opacity: 0.65;
	white-space: nowrap;
}

.awtf__char-count.is-near-limit {
	color: var(--awtf-red);
	opacity: 1;
}

.awtf__hint {
	margin: 10px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--awtf-text);
	opacity: 0.7;
}

.awtf__hint code {
	background: var(--awtf-grey-lighter);
	border-radius: 3px;
	padding: 1px 5px;
	font-size: 12px;
	font-family: var(--awtf-font-mono);
}

/* Toolbar */

.awtf__toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 12px;
}

.awtf__tool-btn {
	appearance: none;
	-webkit-appearance: none;
	border: 1px solid var(--awtf-border);
	background: var(--awtf-white);
	color: var(--awtf-text);
	font-family: var(--awtf-font-body);
	font-size: 13.5px;
	font-weight: 600;
	border-radius: var(--awtf-radius);
	padding: 8px 12px;
	cursor: pointer;
	min-height: 38px;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.awtf__tool-btn:hover {
	background: var(--awtf-grey-lighter);
	border-color: var(--awtf-border-focus);
}

.awtf__tool-btn:active {
	background: var(--awtf-red);
	border-color: var(--awtf-red);
	color: var(--awtf-white);
}

.awtf__tool-divider {
	width: 1px;
	background: var(--awtf-grey-light);
	margin: 4px 4px;
}

/* Textarea */

.awtf__textarea {
	width: 100%;
	font-family: var(--awtf-font-body);
	font-size: 15px;
	color: var(--awtf-black);
	background: var(--awtf-white);
	border: 1px solid var(--awtf-border);
	border-radius: var(--awtf-radius);
	padding: 12px 14px;
	resize: vertical;
	min-height: 220px;
	line-height: 1.6;
}

.awtf__textarea:focus {
	outline: none;
	border-color: var(--awtf-border-focus);
	box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

/* Formatting codes legend */

.awtf__legend {
	display: grid;
	grid-template-columns: 1fr;
	gap: 8px;
}

@media (min-width: 560px) {
	.awtf__legend {
		grid-template-columns: 1fr 1fr;
	}
}

.awtf__legend-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 10px;
	background: var(--awtf-grey-lighter);
	border: 1px solid var(--awtf-grey-light);
	border-radius: var(--awtf-radius);
	font-size: 13px;
}

.awtf__legend-row code {
	font-family: var(--awtf-font-mono);
	font-size: 12.5px;
	color: var(--awtf-red);
	background: var(--awtf-white);
	border: 1px solid var(--awtf-grey-light);
	border-radius: 3px;
	padding: 2px 6px;
	flex: 0 0 auto;
}

.awtf__legend-row span {
	color: var(--awtf-text);
	opacity: 0.85;
}

/* Preview bubble -- a plain, Adams-styled panel (not a WhatsApp-green
   chat bubble) that renders the formatting marks as real styling. */

.awtf__preview-bubble {
	font-family: var(--awtf-font-body);
	font-size: 14.5px;
	line-height: 1.6;
	color: var(--awtf-black);
	background: var(--awtf-grey-lighter);
	border: 1px solid var(--awtf-grey-light);
	border-radius: var(--awtf-radius);
	padding: 16px 18px;
	min-height: 120px;
	word-break: break-word;
}

.awtf__preview-bubble:empty::before,
.awtf__preview-empty {
	content: 'Start typing to see a preview.';
	color: var(--awtf-text);
	opacity: 0.55;
	font-style: italic;
}

.awtf__preview-bubble p {
	margin: 0 0 10px;
}

.awtf__preview-bubble p:last-child {
	margin-bottom: 0;
}

.awtf__preview-bubble strong {
	font-weight: 700;
	color: var(--awtf-black);
}

.awtf__preview-bubble em {
	font-style: italic;
}

.awtf__preview-bubble del {
	text-decoration: line-through;
	opacity: 0.75;
}

.awtf__preview-bubble code {
	font-family: var(--awtf-font-mono);
	font-size: 13px;
	background: var(--awtf-white);
	border: 1px solid var(--awtf-grey-light);
	border-radius: 3px;
	padding: 1px 6px;
}

.awtf__preview-bubble code.awtf__mono-block {
	display: block;
	padding: 10px 12px;
	margin: 0 0 10px;
	white-space: pre-wrap;
}

.awtf__preview-bubble ul,
.awtf__preview-bubble ol {
	margin: 0 0 10px;
	padding-left: 22px;
}

.awtf__preview-bubble li {
	margin-bottom: 4px;
}

.awtf__preview-bubble blockquote {
	margin: 0 0 10px;
	padding: 2px 0 2px 14px;
	border-left: 3px solid var(--awtf-red);
	color: var(--awtf-text);
	opacity: 0.9;
}

/* Buttons */

.awtf__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 18px;
}

.awtf__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-family: var(--awtf-font-heading);
	font-weight: 500;
	font-size: 15px;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	border-radius: var(--awtf-radius);
	min-height: 44px;
	padding: 10px 18px;
	border: 2px solid transparent;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
	white-space: nowrap;
	flex: 1 1 auto;
}

.awtf__btn:active {
	transform: translateY(1px);
}

.awtf__btn--primary {
	background-color: var(--awtf-red);
	border-color: var(--awtf-red);
	color: var(--awtf-white);
}

.awtf__btn--primary:hover {
	background-color: var(--awtf-black);
	border-color: var(--awtf-black);
	color: var(--awtf-white);
}

.awtf__btn--outline {
	background-color: transparent;
	border-color: var(--awtf-red);
	color: var(--awtf-red);
}

.awtf__btn--outline:hover {
	background-color: var(--awtf-red);
	color: var(--awtf-white);
}

.awtf__btn--copied {
	background-color: var(--awtf-black) !important;
	border-color: var(--awtf-black) !important;
	color: var(--awtf-white) !important;
}

/* Error */

.awtf__error {
	margin: 16px 0 0;
	padding: 12px 14px;
	border-radius: var(--awtf-radius);
	background: rgba(218, 31, 48, 0.08);
	border: 1px solid rgba(218, 31, 48, 0.25);
	color: var(--awtf-red);
	font-size: 14px;
	line-height: 1.5;
}

@media (max-width: 420px) {
	.awtf__actions {
		flex-direction: column;
	}
}
