/* Address-template chip-list editor. Namespaced `w2dc-addrtpl-*` so
 * the Redux Framework page CSS doesn't bleed onto our chips. Visual
 * language matches the admin-map-edit sortable lists (handle on
 * left, body center, ×-remove on right) but layout is HORIZONTAL
 * here - addresses read left-to-right, so chips wrap inline like
 * a sentence. */

.w2dc-addrtpl {
	padding: 8px 0;
}

.w2dc-addrtpl-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 8px;
	min-height: 56px;
	background: #fff;
	border: 1px dashed #d1d5db;
	border-radius: 6px;
}

.w2dc-addrtpl-empty {
	color: #9ca3af;
	font-size: 12px;
	font-style: italic;
}

.w2dc-addrtpl-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 6px 4px 4px;
	border-radius: 4px;
	border: 1px solid transparent;
	background: #eff6ff;
	font-size: 13px;
	line-height: 1;
	cursor: grab;
	-webkit-user-select: none;
	   -moz-user-select: none;
	        user-select: none;
	transition: background 0.12s, border-color 0.12s;
}
.w2dc-addrtpl-chip:hover {
	border-color: #93c5fd;
}
.w2dc-addrtpl-chip:active {
	cursor: grabbing;
}
.w2dc-addrtpl-chip.is-dragged {
	opacity: 0.35;
}

/* Per-type colors */
.w2dc-addrtpl-chip--token {
	background: #eff6ff;
	color: #1e40af;
}
.w2dc-addrtpl-chip--text {
	background: #f3f4f6;
	color: #1f2937;
}
.w2dc-addrtpl-chip--sep {
	background: #fef3c7;
	color: #92400e;
}

.w2dc-addrtpl-handle {
	color: #9ca3af;
	font-size: 12px;
	letter-spacing: -2px;
	line-height: 1;
	flex-shrink: 0;
	cursor: grab;
}

.w2dc-addrtpl-label {
	font-weight: 500;
	white-space: nowrap;
}

.w2dc-addrtpl-text {
	border: 0;
	background: transparent;
	padding: 2px 4px;
	font-size: 13px;
	color: #1f2937;
	min-width: 80px;
	width: auto;
	font-family: inherit;
	outline: none;
}
.w2dc-addrtpl-text:focus {
	background: #fff;
	box-shadow: 0 0 0 1px #93c5fd inset;
	border-radius: 3px;
}

.w2dc-addrtpl-sep {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 14px;
	font-weight: 600;
}

.w2dc-addrtpl-remove {
	border: 0;
	background: transparent;
	color: #9ca3af;
	padding: 0 4px;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	border-radius: 3px;
}
.w2dc-addrtpl-remove:hover {
	color: #dc2626;
	background: rgba(220, 38, 38, 0.08);
}

/* Insertion-line placeholder. Drawn between chips during a drag. */
.w2dc-addrtpl-placeholder {
	width: 2px;
	align-self: stretch;
	background: #2563eb;
	border-radius: 1px;
}

/* Invisible row-break flex item. Inserted right after every `break`
 * separator chip in the rendered JSX to force everything following
 * onto the next row of the flex container - so the chip list
 * visually mirrors the line breaks of the rendered address. Zero
 * height collapses the row entirely while 100% flex-basis hogs the
 * remaining horizontal space and pushes wrap. */
.w2dc-addrtpl-row-break {
	flex-basis: 100%;
	width: 0;
	height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	list-style: none;
}

/* Toolbar - sits below the chip list */
.w2dc-addrtpl-toolbar {
	display: flex;
	gap: 8px;
	margin-top: 10px;
	flex-wrap: wrap;
}

.w2dc-addrtpl-menu-wrap {
	position: relative;
}

.w2dc-addrtpl-btn {
	padding: 5px 10px;
	font-size: 12px;
	font-weight: 500;
	color: #374151;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	cursor: pointer;
	transition: background 0.12s, border-color 0.12s;
}
.w2dc-addrtpl-btn:hover {
	background: #f9fafb;
	border-color: #9ca3af;
}

.w2dc-addrtpl-menu {
	position: absolute;
	top: 100%;
	left: 0;
	margin-top: 4px;
	min-width: 180px;
	background: #fff;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	padding: 4px;
	z-index: 100;
	max-height: 360px;
	overflow-y: auto;
}
.w2dc-addrtpl-menu--narrow {
	min-width: 140px;
}

.w2dc-addrtpl-menu-group + .w2dc-addrtpl-menu-group {
	margin-top: 4px;
	padding-top: 4px;
	border-top: 1px solid #f3f4f6;
}

.w2dc-addrtpl-menu-title {
	font-size: 10px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #9ca3af;
	padding: 4px 8px;
}

.w2dc-addrtpl-menu-item {
	display: block;
	width: 100%;
	text-align: left;
	padding: 6px 10px;
	font-size: 12px;
	color: #1f2937;
	background: transparent;
	border: 0;
	border-radius: 3px;
	cursor: pointer;
}
.w2dc-addrtpl-menu-item:hover {
	background: #eff6ff;
	color: #1e40af;
}

/* Live preview panel - sits under the toolbar, shows the rendered
 * address using the sample landmark context. Visual hierarchy: label
 * + sample-name subtitle, then a soft-grey body block that preserves
 * line breaks so multi-row templates show realistic wrapping.
 */
.w2dc-addrtpl-preview {
	margin-top: 12px;
	padding: 10px 12px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
}
.w2dc-addrtpl-preview-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.4px;
	color: #6b7280;
	margin-bottom: 6px;
}
.w2dc-addrtpl-preview-sample {
	text-transform: none;
	letter-spacing: 0;
	font-weight: 400;
	color: #9ca3af;
	font-size: 11px;
}
.w2dc-addrtpl-preview-body {
	font-size: 13px;
	line-height: 1.5;
	color: #1f2937;
	white-space: pre-wrap;        /* preserves '\n' from line-break separator */
	word-wrap: break-word;
	font-family: system-ui, -apple-system, sans-serif;
}
.w2dc-addrtpl-preview-empty {
	color: #9ca3af;
	font-style: italic;
}

