/* Adams WhatsApp Template Builder
   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. */

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

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

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

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

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

/* Desktop: builder on the left, a sticky stacked preview/checks/output
   column on the right. */
@media (min-width: 1050px) {
	.awtb {
		display: grid;
		grid-template-columns: 1.2fr 0.8fr;
		gap: 32px;
		align-items: start;
	}

	.awtb__preview-wrap {
		position: sticky;
		top: 20px;
		display: flex;
		flex-direction: column;
		gap: 24px;
	}
}

.awtb__preview-wrap {
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* Card / panel shell, shared by the builder and the right-column panels */

.awtb__card,
.awtb__preview-frame,
.awtb__checks-frame,
.awtb__output-frame {
	background: var(--awtb-white);
	border: 1px solid var(--awtb-grey-light);
	border-radius: 8px;
	box-shadow: 0 2px 20px rgba(10, 10, 10, 0.06);
}

.awtb__card {
	padding: 32px;
}

.awtb__preview-frame,
.awtb__checks-frame,
.awtb__output-frame {
	padding: 24px;
}

@media (max-width: 480px) {
	.awtb__card {
		padding: 22px 18px;
	}
	.awtb__preview-frame,
	.awtb__checks-frame,
	.awtb__output-frame {
		padding: 18px;
	}
}

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

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

.awtb__preview-frame .awtb__section-title,
.awtb__checks-frame .awtb__section-title {
	margin-bottom: 14px;
}

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

.awtb__label-row .awtb__section-title {
	margin-bottom: 0;
}

/* Form controls */

.awtb__field-group {
	margin-bottom: 18px;
}

.awtb__section > .awtb__field-group:last-child {
	margin-bottom: 0;
}

.awtb__two-col {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0 18px;
}

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

.awtb__label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	color: var(--awtb-black);
	margin-bottom: 8px;
}

.awtb__optional {
	font-weight: 400;
	color: var(--awtb-text);
	opacity: 0.65;
}

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

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

.awtb__hint {
	margin: 8px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--awtb-text);
	opacity: 0.7;
}

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

.awtb__select,
.awtb__input,
.awtb__textarea {
	width: 100%;
	font-family: var(--awtb-font-body);
	font-size: 15.5px;
	color: var(--awtb-black);
	background: var(--awtb-white);
	border: 1px solid var(--awtb-border);
	border-radius: var(--awtb-radius);
	padding: 11px 14px;
	min-height: 46px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	appearance: none;
	-webkit-appearance: none;
}

.awtb__select {
	background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23424242' stroke-width='1.6' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 30px;
}

.awtb__textarea {
	resize: vertical;
	min-height: 150px;
	line-height: 1.6;
}

.awtb__select:focus,
.awtb__input:focus,
.awtb__textarea:focus {
	outline: none;
	border-color: var(--awtb-border-focus);
	box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

.awtb__input.is-invalid,
.awtb__select.is-invalid {
	border-color: var(--awtb-red);
}

.awtb__link-output {
	font-family: var(--awtb-font-mono);
	font-size: 12.5px;
	color: var(--awtb-text);
	background: var(--awtb-grey-lighter);
	border: 1px solid var(--awtb-grey-light);
	resize: vertical;
	min-height: 180px;
	line-height: 1.55;
	word-break: break-all;
	white-space: pre;
	overflow-x: auto;
}

/* Toggle group (category) */

.awtb__toggle-group {
	display: flex;
	flex-wrap: wrap;
	border: 1px solid var(--awtb-border);
	border-radius: var(--awtb-radius);
	overflow: hidden;
}

.awtb__toggle-btn {
	appearance: none;
	-webkit-appearance: none;
	border: none;
	border-right: 1px solid var(--awtb-border);
	background: var(--awtb-white);
	color: var(--awtb-text);
	font-family: var(--awtb-font-body);
	font-size: 13.5px;
	font-weight: 600;
	padding: 10px 12px;
	cursor: pointer;
	flex: 1 1 auto;
	min-width: 90px;
	transition: background .15s ease, color .15s ease;
}

.awtb__toggle-btn:last-child {
	border-right: none;
}

.awtb__toggle-btn:hover {
	background: var(--awtb-grey-lighter);
}

.awtb__toggle-btn.is-active {
	background: var(--awtb-red);
	color: var(--awtb-white);
}

/* Mini formatting toolbar (body) */

.awtb__toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 10px;
}

.awtb__tool-btn {
	appearance: none;
	-webkit-appearance: none;
	border: 1px solid var(--awtb-border);
	background: var(--awtb-white);
	color: var(--awtb-text);
	font-family: var(--awtb-font-body);
	font-size: 13px;
	font-weight: 600;
	border-radius: var(--awtb-radius);
	padding: 7px 11px;
	cursor: pointer;
	min-height: 36px;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

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

.awtb__tool-divider {
	width: 1px;
	background: var(--awtb-grey-light);
	margin: 4px 2px;
}

/* Buttons list (template buttons) */

.awtb__buttons-list {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-bottom: 14px;
}

.awtb__button-row {
	background: var(--awtb-grey-lighter);
	border: 1px solid var(--awtb-grey-light);
	border-radius: var(--awtb-radius);
	padding: 14px;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: flex-start;
}

.awtb__button-row .awtb__select {
	flex: 1 1 150px;
}

.awtb__button-row .awtb__input {
	flex: 1 1 150px;
}

.awtb__button-remove-btn {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--awtb-white);
	border: 1px solid var(--awtb-border);
	border-radius: var(--awtb-radius);
	color: var(--awtb-text);
	cursor: pointer;
	font-size: 15px;
	line-height: 1;
	padding: 0;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.awtb__button-remove-btn:hover {
	background: var(--awtb-red);
	border-color: var(--awtb-red);
	color: var(--awtb-white);
}

/* Variables (sample values) list */

.awtb__variables-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.awtb__variable-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

.awtb__variable-tag {
	flex: 0 0 auto;
	font-family: var(--awtb-font-mono);
	font-size: 13px;
	font-weight: 600;
	color: var(--awtb-red);
	background: var(--awtb-grey-lighter);
	border: 1px solid var(--awtb-grey-light);
	border-radius: var(--awtb-radius);
	padding: 10px 12px;
	min-width: 48px;
	text-align: center;
}

.awtb__variable-row .awtb__input {
	flex: 1 1 auto;
}

/* Buttons */

.awtb__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-family: var(--awtb-font-heading);
	font-weight: 500;
	font-size: 15px;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	border-radius: var(--awtb-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;
}

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

.awtb__btn--small {
	min-height: 36px;
	padding: 6px 14px;
	font-size: 13.5px;
}

.awtb__btn--full {
	width: 100%;
}

.awtb__btn--primary {
	background-color: var(--awtb-red);
	border-color: var(--awtb-red);
	color: var(--awtb-white);
}

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

.awtb__btn--outline {
	background-color: transparent;
	border-color: var(--awtb-red);
	color: var(--awtb-red);
}

.awtb__btn--outline:hover {
	background-color: var(--awtb-red);
	color: var(--awtb-white);
}

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

.awtb__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
}

.awtb__actions .awtb__btn {
	flex: 1 1 auto;
}

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

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

.awtb__preview-empty {
	color: var(--awtb-text);
	opacity: 0.55;
	font-style: italic;
	margin: 0;
}

.awtb__preview-header {
	font-weight: 700;
	color: var(--awtb-black);
	margin: 0 0 8px;
}

.awtb__preview-body {
	margin: 0 0 8px;
}

.awtb__preview-body strong {
	font-weight: 700;
}

.awtb__preview-body em {
	font-style: italic;
}

.awtb__preview-body del {
	text-decoration: line-through;
	opacity: 0.75;
}

.awtb__preview-footer {
	font-size: 12.5px;
	color: var(--awtb-text);
	opacity: 0.65;
	margin: 0 0 10px;
}

.awtb__preview-var {
	background: rgba(218, 31, 48, 0.1);
	color: var(--awtb-red);
	border-radius: 3px;
	padding: 0 3px;
}

.awtb__preview-buttons {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px dashed var(--awtb-grey-light);
}

.awtb__preview-button {
	display: block;
	text-align: center;
	padding: 9px 12px;
	border: 1px solid var(--awtb-border);
	border-radius: var(--awtb-radius);
	background: var(--awtb-white);
	color: var(--awtb-black);
	font-size: 13.5px;
	font-weight: 600;
}

/* Checks list */

.awtb__checks-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.awtb__check-row {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--awtb-text);
}

.awtb__check-icon {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 12px;
	font-weight: 700;
	margin-top: 1px;
}

.awtb__check-row.is-pass .awtb__check-icon {
	background: rgba(34, 139, 86, 0.12);
	color: #1f8a4c;
}

.awtb__check-row.is-fail .awtb__check-icon {
	background: rgba(218, 31, 48, 0.1);
	color: var(--awtb-red);
}

.awtb__check-row.is-pass {
	opacity: 0.7;
}

/* Output tabs */

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

.awtb__tab-btn {
	appearance: none;
	-webkit-appearance: none;
	border: 1px solid var(--awtb-border);
	background: var(--awtb-white);
	color: var(--awtb-text);
	font-family: var(--awtb-font-heading);
	font-size: 13.5px;
	font-weight: 600;
	border-radius: var(--awtb-radius);
	padding: 8px 16px;
	cursor: pointer;
	transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.awtb__tab-btn:hover {
	background: var(--awtb-grey-lighter);
}

.awtb__tab-btn.is-active {
	background: var(--awtb-black);
	border-color: var(--awtb-black);
	color: var(--awtb-white);
}

/* Error */

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

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