/*!
 * CSS Portal — Border image generator extras
 * Loaded after code-tool.css and generator-tool.css. Everything is scoped to .gt.
 */

.gt [hidden] { display: none !important; }

/* URL row */
.gt .bi-url { display: flex; gap: 8px; padding: 12px 14px 0; }
.gt .bi-url input {
	flex: 1;
	min-width: 0;
	width: auto;
	height: 34px;
	margin: 0;
	padding: 0 10px;
	font: inherit;
	font-size: 13px;
	color: var(--ct-text);
	background: var(--ct-bg);
	border: 1px solid var(--ct-border);
	border-radius: 8px;
	outline: none;
}
.gt .bi-url input:focus { border-color: var(--ct-accent); box-shadow: 0 0 0 3px var(--ct-accent-soft); }
.gt .bi-url .ct-btn { height: 34px; }

/* stage + frame */
.gt .bi-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 280px;
	margin: 12px 14px 0;
	padding: 36px 60px;
	border: 1px dashed var(--ct-border-strong);
	border-radius: 10px;
	background-color: var(--ct-surface);
	background-image: linear-gradient(45deg, var(--ct-surface-2) 25%, transparent 25%, transparent 75%, var(--ct-surface-2) 75%),
		linear-gradient(45deg, var(--ct-surface-2) 25%, transparent 25%, transparent 75%, var(--ct-surface-2) 75%);
	background-size: 16px 16px;
	background-position: 0 0, 8px 8px;
	transition: border-color .15s, background-color .15s;
}
.gt .bi-stage.is-drop { border-color: var(--ct-accent); background-color: var(--ct-accent-soft); }
.gt .bi-frame {
	position: relative;
	flex: none;
	background-size: 100% 100%;
	box-shadow: 0 0 0 1px var(--ct-border-strong), 0 6px 20px rgba(15, 23, 42, .12);
	touch-action: none;
}
.gt .bi-frame img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	padding: 0;
	border: 0;
	object-fit: fill;
	user-select: none;
	-webkit-user-drag: none;
	pointer-events: none;
}
.gt .bi-stage.is-gradient img { display: none; }

.gt .bi-center {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	color: #fff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
	background: repeating-linear-gradient(45deg, rgba(15, 23, 42, .38) 0 6px, rgba(15, 23, 42, .22) 6px 12px);
	pointer-events: none;
}
.gt .bi-center.is-filled { background: rgba(37, 99, 235, .12); color: transparent; text-shadow: none; }

/* guides */
.gt .bi-guide { position: absolute; z-index: 2; outline: none; }
.gt .bi-guide::before { content: ""; position: absolute; }
.gt .bi-guide--h { left: -18px; right: -18px; height: 18px; margin-top: -9px; cursor: ns-resize; }
.gt .bi-guide--v { top: -18px; bottom: -18px; width: 18px; margin-left: -9px; cursor: ew-resize; }
.gt .bi-guide[data-guide="bottom"] { margin: 0 0 -9px; }
.gt .bi-guide[data-guide="right"] { margin: 0 -9px 0 0; }
.gt .bi-guide--h::before { left: 0; right: 0; top: 8px; border-top: 2px dashed #ef4444; }
.gt .bi-guide--v::before { top: 0; bottom: 0; left: 8px; border-left: 2px dashed #ef4444; }
.gt .bi-guide::after {
	content: "";
	position: absolute;
	width: 12px;
	height: 12px;
	background: #ef4444;
	border: 2px solid #fff;
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}
.gt .bi-guide--h::after { left: -4px; top: 1px; }
.gt .bi-guide[data-guide="bottom"]::after { left: auto; right: -4px; }
.gt .bi-guide--v::after { top: -4px; left: 1px; }
.gt .bi-guide[data-guide="right"]::after { top: auto; bottom: -4px; }
.gt .bi-guide:hover::before, .gt .bi-guide.is-dragging::before { border-color: #b91c1c; border-style: solid; }
.gt .bi-guide:focus-visible::after { box-shadow: 0 0 0 4px var(--ct-accent-soft), 0 0 0 2px var(--ct-accent); }

.gt .bi-guide__badge {
	position: absolute;
	display: block;
	padding: 1px 6px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
	color: #fff;
	background: #ef4444;
	border-radius: 4px;
	pointer-events: none;
}
.gt .bi-guide--h .bi-guide__badge { right: -46px; top: 0; }
.gt .bi-guide[data-guide="bottom"] .bi-guide__badge { right: auto; left: -46px; }
.gt .bi-guide--v .bi-guide__badge { bottom: -26px; left: 50%; transform: translateX(-50%); }
.gt .bi-guide[data-guide="right"] .bi-guide__badge { bottom: auto; top: -26px; }

.gt .bi-foot {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 4px 12px;
	padding: 10px 14px 12px;
	font-size: 12.5px;
	color: var(--ct-muted);
}
.gt .bi-foot span { display: inline; padding: 0; }
.gt .bi-msg { color: var(--ct-ok); }
.gt .bi-msg.is-error { color: var(--ct-err); }
.gt .bi-hint { margin: 0; padding: 0 14px 12px; font-size: 12.5px; color: var(--ct-muted); }

/* Small screens: preview, then the slicer, then settings and code */
@media (max-width: 1099.98px) {
	.gt .gt-main > :nth-child(2) { order: -1; }
}
@media (max-width: 575.98px) {
	.gt .bi-stage { padding: 34px 56px; margin: 10px 10px 0; }
}
@media (prefers-reduced-motion: reduce) {
	.gt .bi-stage { transition: none; }
}
