/**
 * VS Product Designer — front-end designer styles.
 * Fullscreen modal (z-index 999999), white panels, #1d3557 accent,
 * bottom toolbar + 44px touch targets on mobile.
 */

/* ------------------------------------------------------------------ */
/* Launcher + applied strip (product page)                             */
/* ------------------------------------------------------------------ */

.vspd-launcher {
	margin: 0 0 12px;
}

.vspd-open-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 20px;
	background: #1d3557;
	color: #ffffff;
	border: none;
	border-radius: 8px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.vspd-open-btn:hover,
.vspd-open-btn:focus {
	background: #16324f;
	color: #ffffff;
}

.vspd-open-icon {
	font-size: 18px;
	line-height: 1;
}

.vspd-applied {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
	padding: 10px 12px;
	background: #eef8f1;
	border: 1px solid #bfe3cd;
	border-radius: 8px;
	font-size: 14px;
	color: #1f2937;
}

.vspd-applied[hidden] {
	display: none;
}

.vspd-variation-warning {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 10px 0 0;
	padding: 10px 12px;
	background: #fff8e1;
	border: 1px solid #f0d48a;
	border-radius: 8px;
	font-size: 14px;
	line-height: 1.4;
	color: #6b4e00;
}

.vspd-variation-warning[hidden] {
	display: none;
}

.vspd-text-input {
	width: 100%;
	min-height: 60px;
	padding: 10px 12px;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 16px; /* 16px stops iOS zooming the page on focus */
	line-height: 1.35;
	font-family: inherit;
	color: #0f172a;
	background: #ffffff;
	resize: vertical;
	box-sizing: border-box;
}

.vspd-text-input:focus {
	outline: 2px solid #1d3557;
	outline-offset: 1px;
}

.vspd-text-input:disabled {
	background: #f1f5f9;
	color: #94a3b8;
}

.vspd-applied-thumb {
	width: 48px;
	height: 48px;
	object-fit: contain;
	background: #ffffff;
	border: 1px solid #d7e2dc;
	border-radius: 6px;
}

.vspd-applied-check {
	color: #2a9d8f;
	font-weight: 700;
	font-size: 16px;
}

.vspd-applied-text {
	font-weight: 600;
}

.vspd-applied-hint {
	color: #5b6b63;
	font-size: 13px;
}

.vspd-applied-actions {
	display: inline-flex;
	gap: 4px;
	margin-left: auto;
}

.vspd-link-btn {
	background: none;
	border: none;
	padding: 10px 8px;
	min-height: 44px;
	color: #1d3557;
	font-size: 13px;
	font-weight: 600;
	text-decoration: underline;
	cursor: pointer;
}

.vspd-link-btn-danger {
	color: #e63946;
}

/* ------------------------------------------------------------------ */
/* Modal shell                                                         */
/* ------------------------------------------------------------------ */

.vspd-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	background: rgba(15, 23, 42, 0.55);
}

.vspd-modal[hidden],
.vspd-modal [hidden] {
	display: none !important;
}

body.vspd-modal-open {
	overflow: hidden;
}

.vspd-modal-inner {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	background: #f8fafc;
	color: #0f172a;
	font-size: 14px;
	line-height: 1.4;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */

.vspd-header {
	display: flex;
	align-items: center;
	gap: 14px;
	flex: 0 0 auto;
	min-height: 60px;
	padding: 6px 16px;
	background: #ffffff;
	border-bottom: 1px solid #e2e8f0;
}

.vspd-title {
	font-size: 17px;
	font-weight: 700;
	color: #1d3557;
	white-space: nowrap;
}

.vspd-view-tabs {
	display: flex;
	gap: 6px;
	overflow-x: auto;
}

.vspd-view-tab {
	min-height: 44px;
	padding: 0 18px;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 999px;
	font-size: 14px;
	color: #334155;
	cursor: pointer;
	white-space: nowrap;
}

.vspd-view-tab.active {
	background: #1d3557;
	border-color: #1d3557;
	color: #ffffff;
	font-weight: 600;
}

.vspd-header-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
}

.vspd-price {
	font-size: 13px;
	color: #475569;
	white-space: nowrap;
}

.vspd-price strong {
	font-size: 16px;
	color: #1d3557;
	margin-left: 4px;
}

.vspd-icon-btn {
	width: 44px;
	height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 18px;
	color: #334155;
	cursor: pointer;
}

.vspd-icon-btn:hover:not(:disabled) {
	border-color: #1d3557;
	color: #1d3557;
}

.vspd-icon-btn:disabled {
	opacity: 0.4;
	cursor: default;
}

.vspd-apply-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 20px;
	background: #1d3557;
	border: none;
	border-radius: 8px;
	color: #ffffff;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.vspd-apply-btn:hover:not(:disabled) {
	background: #16324f;
}

.vspd-apply-btn:disabled {
	opacity: 0.65;
	cursor: default;
}

.vspd-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: vspd-spin 0.7s linear infinite;
}

.vspd-spinner-dark {
	border-color: rgba(29, 53, 87, 0.25);
	border-top-color: #1d3557;
}

@keyframes vspd-spin {
	to {
		transform: rotate(360deg);
	}
}

/* ------------------------------------------------------------------ */
/* Body layout: toolbar / stage / panels                               */
/* ------------------------------------------------------------------ */

.vspd-body {
	display: flex;
	flex: 1 1 auto;
	min-height: 0;
}

.vspd-toolbar {
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 0 0 auto;
	width: 88px;
	padding: 8px 6px;
	background: #ffffff;
	border-right: 1px solid #e2e8f0;
	overflow-y: auto;
}

.vspd-tool-btn {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 64px;
	padding: 8px 4px;
	background: none;
	border: none;
	border-radius: 8px;
	color: #334155;
	font-size: 11px;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

.vspd-tool-btn:hover {
	background: #f1f5f9;
}

.vspd-tool-btn.active {
	background: #e8eef7;
	color: #1d3557;
	font-weight: 600;
}

.vspd-tool-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	font-size: 20px;
	font-weight: 700;
}

.vspd-stage {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	overflow: auto;
	padding: 12px;
	background: #eef2f7;
}

.vspd-canvas-sizer {
	position: relative;
	flex: 0 0 auto;
}

.vspd-canvas-scale {
	width: 800px;
	height: 800px;
	transform-origin: top left;
}

.vspd-canvas-stack {
	position: relative;
	width: 800px;
	height: 800px;
}

.vspd-canvas-holder {
	position: absolute;
	inset: 0;
	background: #ffffff;
	box-shadow: 0 2px 14px rgba(2, 6, 23, 0.1);
	border-radius: 4px;
}

.vspd-dpi-badge {
	position: absolute;
	z-index: 10;
	width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #e63946;
	color: #ffffff;
	border: 2px solid #ffffff;
	border-radius: 50%;
	font-size: 13px;
	font-weight: 700;
	box-shadow: 0 1px 4px rgba(2, 6, 23, 0.3);
	pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Side panels                                                         */
/* ------------------------------------------------------------------ */

.vspd-panels {
	position: relative;
	flex: 0 0 auto;
	width: 320px;
	padding: 16px;
	background: #ffffff;
	border-left: 1px solid #e2e8f0;
	overflow-y: auto;
}

.vspd-panel-close {
	display: none;
	position: absolute;
	top: 8px;
	right: 8px;
	width: 44px;
	height: 44px;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	border-radius: 8px;
	font-size: 16px;
	color: #64748b;
	cursor: pointer;
}

.vspd-panel-title {
	margin: 0 0 12px;
	font-size: 15px;
	font-weight: 700;
	color: #1d3557;
}

.vspd-btn {
	min-height: 44px;
	padding: 10px 14px;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 14px;
	color: #334155;
	cursor: pointer;
}

.vspd-btn:hover:not(:disabled) {
	border-color: #1d3557;
	color: #1d3557;
}

.vspd-btn:disabled {
	opacity: 0.45;
	cursor: default;
}

.vspd-btn-primary {
	display: block;
	width: 100%;
	margin: 0 0 16px;
	background: #1d3557;
	border-color: #1d3557;
	color: #ffffff;
	font-weight: 600;
}

.vspd-btn-primary:hover:not(:disabled) {
	background: #16324f;
	color: #ffffff;
}

.vspd-field {
	display: block;
	margin: 0 0 16px;
}

.vspd-field-label {
	display: block;
	margin: 0 0 6px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #64748b;
}

.vspd-select {
	width: 100%;
	min-height: 44px;
	padding: 0 10px;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 14px;
	color: #0f172a;
}

.vspd-range {
	width: calc(100% - 48px);
	vertical-align: middle;
	accent-color: #1d3557;
	min-height: 44px;
	cursor: pointer;
}

.vspd-range-out {
	display: inline-block;
	width: 40px;
	text-align: right;
	font-size: 13px;
	font-weight: 600;
	color: #334155;
	vertical-align: middle;
}

.vspd-outline-width-row {
	margin-top: 10px;
}

.vspd-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.vspd-swatch {
	width: 36px;
	height: 36px;
	padding: 0;
	border: 2px solid #e2e8f0;
	border-radius: 50%;
	cursor: pointer;
}

.vspd-swatch.selected {
	border-color: #1d3557;
	box-shadow: 0 0 0 2px rgba(29, 53, 87, 0.3);
}

.vspd-style-row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.vspd-toggle-btn {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: 1px solid #cbd5e1;
	border-radius: 8px;
	font-size: 15px;
	color: #334155;
	cursor: pointer;
}

.vspd-toggle-btn.active {
	background: #1d3557;
	border-color: #1d3557;
	color: #ffffff;
}

.vspd-bold-btn {
	font-weight: 800;
}

.vspd-italic-btn {
	font-style: italic;
	font-family: Georgia, serif;
}

.vspd-align-group {
	display: inline-flex;
	gap: 4px;
	margin-left: auto;
}

.vspd-align-icon {
	--vspd-bar: #334155;
	display: block;
	width: 18px;
	height: 12px;
	background-image:
		linear-gradient(var(--vspd-bar), var(--vspd-bar)),
		linear-gradient(var(--vspd-bar), var(--vspd-bar)),
		linear-gradient(var(--vspd-bar), var(--vspd-bar));
	background-size: 100% 2px, 60% 2px, 85% 2px;
	background-repeat: no-repeat;
}

.vspd-toggle-btn.active .vspd-align-icon {
	--vspd-bar: #ffffff;
}

.vspd-align-icon-left {
	background-position: left 0, left 5px, left 10px;
}

.vspd-align-icon-center {
	background-position: center 0, center 5px, center 10px;
}

.vspd-align-icon-right {
	background-position: right 0, right 5px, right 10px;
}

/* Upload panel */

.vspd-upload-drop {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 26px 12px;
	border: 2px dashed #cbd5e1;
	border-radius: 10px;
	color: #475569;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease;
}

.vspd-upload-drop:hover {
	border-color: #1d3557;
	color: #1d3557;
}

.vspd-upload-icon {
	font-size: 24px;
	line-height: 1;
}

.vspd-upload-note {
	font-size: 12px;
	font-weight: 400;
	color: #94a3b8;
}

.vspd-file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

.vspd-upload-status {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 12px 0 0;
	font-size: 13px;
	color: #1d3557;
}

.vspd-error {
	margin: 12px 0 0;
	font-size: 13px;
	color: #e63946;
}

.vspd-dpi-warning {
	display: block;
	margin: 0 0 14px;
	padding: 10px 12px;
	background: #fdecee;
	border: 1px solid #f5c2c7;
	border-radius: 8px;
	font-size: 13px;
	color: #b02a37;
}

.vspd-dpi-warning-text {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0;
	line-height: 1.4;
}

/* Cliparts panel */

.vspd-clipart-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
	gap: 8px;
}

.vspd-clipart-item {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 72px;
	padding: 6px;
	background: #ffffff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	cursor: pointer;
}

.vspd-clipart-item:hover {
	border-color: #1d3557;
}

.vspd-clipart-item img {
	max-width: 100%;
	max-height: 64px;
	object-fit: contain;
}

/* Effects panel */

.vspd-effects-hint {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 14px;
	padding: 10px 12px;
	background: #eef2f7;
	border: 1px solid #d7e0ec;
	border-radius: 8px;
	font-size: 13px;
	line-height: 1.4;
	color: #47566b;
}

.vspd-effects-group {
	margin: 0 0 18px;
	padding: 0 0 16px;
	border-bottom: 1px solid #e2e8f0;
}

.vspd-effects-group:last-of-type {
	border-bottom: none;
	padding-bottom: 0;
}

.vspd-effects-main {
	display: block;
	width: 100%;
	margin: 0 0 8px;
}

.vspd-effects-row {
	display: flex;
	gap: 8px;
	margin: 0 0 16px;
}

.vspd-effects-half {
	flex: 1 1 0;
	min-width: 0;
	padding: 10px 8px;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.vspd-effects-half.active {
	background: #1d3557;
	border-color: #1d3557;
	color: #ffffff;
}

.vspd-check {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	margin: 0 0 8px;
	font-size: 14px;
	color: #334155;
	cursor: pointer;
}

.vspd-check input[type="checkbox"] {
	width: 20px;
	height: 20px;
	margin: 0;
	flex: 0 0 auto;
	accent-color: #1d3557;
	cursor: pointer;
}

.vspd-check input[type="checkbox"]:disabled {
	cursor: default;
}

.vspd-check input[type="checkbox"]:disabled + span {
	opacity: 0.45;
}

.vspd-range:disabled,
.vspd-select:disabled {
	opacity: 0.45;
	cursor: default;
}

.vspd-check-lead {
	margin-bottom: 14px;
	font-weight: 600;
	color: #1d3557;
}

/* Sampling the background colour: the whole stage becomes an eyedropper. */
.vspd-stage.vspd-picking,
.vspd-stage.vspd-picking .vspd-canvas-holder {
	cursor: crosshair;
}

/* The effects tools have nothing to act on until an image is selected. */
.vspd-tool-btn-off {
	opacity: 0.5;
}

/* Layers panel */

.vspd-object-actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
	margin: 0 0 16px;
}

.vspd-act-btn {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	font-size: 13px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.vspd-layer-list {
	list-style: none;
	margin: 0;
	padding: 0;
	border-top: 1px solid #e2e8f0;
}

.vspd-layer-item button {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: 0 10px;
	background: none;
	border: none;
	border-bottom: 1px solid #f1f5f9;
	border-radius: 0;
	font-size: 13px;
	color: #334155;
	text-align: left;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	cursor: pointer;
}

.vspd-layer-item button:hover {
	background: #f8fafc;
}

.vspd-layer-item.active button {
	background: #e8eef7;
	color: #1d3557;
	font-weight: 600;
}

/* Focus visibility */

.vspd-modal button:focus-visible,
.vspd-open-btn:focus-visible,
.vspd-link-btn:focus-visible {
	outline: 2px solid #1d3557;
	outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Mobile: bottom toolbar, panel sheet, scaled stage                   */
/* ------------------------------------------------------------------ */

@media (max-width: 900px) {

	.vspd-modal-inner {
		width: 100vw;
		height: 100vh;
	}

	.vspd-header {
		flex-wrap: wrap;
		gap: 8px;
		padding: 8px 10px;
		min-height: 0;
	}

	.vspd-title {
		display: none;
	}

	.vspd-view-tabs {
		order: 1;
		flex: 1 1 auto;
		min-width: 0;
	}

	.vspd-header-actions {
		order: 2;
		gap: 6px;
	}

	.vspd-price-label {
		display: none;
	}

	.vspd-apply-btn {
		padding: 0 14px;
	}

	.vspd-body {
		flex-direction: column;
	}

	.vspd-stage {
		order: 1;
		align-items: flex-start;
		padding: 8px;
	}

	.vspd-toolbar {
		order: 3;
		flex-direction: row;
		width: 100%;
		height: 72px;
		padding: 4px 6px;
		justify-content: space-around;
		border-right: none;
		border-top: 1px solid #e2e8f0;
		overflow-y: visible;
		overflow-x: auto;
	}

	.vspd-tool-btn {
		flex: 1 1 0;
		min-width: 64px;
		min-height: 60px;
		padding: 6px 2px;
	}

	.vspd-panels {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 72px;
		z-index: 20;
		width: auto;
		max-height: 46vh;
		border-left: none;
		border-top: 1px solid #e2e8f0;
		border-radius: 14px 14px 0 0;
		box-shadow: 0 -6px 24px rgba(2, 6, 23, 0.18);
		transform: translateY(110%);
		transition: transform 0.2s ease;
		padding-top: 20px;
	}

	.vspd-panels.open {
		transform: translateY(0);
	}

	.vspd-panel-close {
		display: flex;
	}

	.vspd-swatch {
		width: 44px;
		height: 44px;
	}

	.vspd-object-actions {
		grid-template-columns: 1fr 1fr 1fr;
	}
}

@media (max-width: 480px) {

	.vspd-icon-btn {
		width: 40px;
		height: 40px;
	}

	.vspd-object-actions {
		grid-template-columns: 1fr 1fr;
	}

	.vspd-applied-actions {
		margin-left: 0;
		width: 100%;
	}
}

/* Low-resolution guidance (actionable, not just a warning) */

.vspd-dpi-advice {
	margin: 4px 0 8px;
	font-size: 13px;
	line-height: 1.4;
	color: #6b4e00;
}

.vspd-dpi-advice:empty {
	display: none;
}

.vspd-dpi-fit {
	min-height: 44px;
	padding: 0 16px;
	background: #ffffff;
	border: 1px solid #d9a400;
	border-radius: 8px;
	color: #6b4e00;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.vspd-dpi-fit:hover {
	background: #fff3d1;
}
