/* ==========================================================================
   BST Logo Customizer
   Theme colors are injected via CSS custom properties by PHP at runtime.
   Fallback values here are only used if PHP injection fails.
   ========================================================================== */

/* -----------------------------------------------------------------------
   Quote page design preview (injected by quote-preview.js)
   ----------------------------------------------------------------------- */

/* -----------------------------------------------------------------------
   Quote page design preview thumbnail
   ----------------------------------------------------------------------- */

/* Styles are applied inline by JS to beat theme overrides — nothing needed here. */

/* -----------------------------------------------------------------------
   Trigger button (shown inline on product page)
   ----------------------------------------------------------------------- */

.bst-trigger-wrap {
	margin: 12px 0;
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}

.bst-trigger-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 10px 20px;
	font-size: 15px;
	font-weight: 600;
	border: 2px solid var(--bst-lc-primary, #2c87c5);
	border-radius: 4px;
	background: transparent;
	color: var(--bst-lc-primary, #2c87c5);
	cursor: pointer;
	transition: background 0.15s, color 0.15s;
	line-height: 1.4;
}

.bst-trigger-btn:hover {
	background: var(--bst-lc-primary, #2c87c5);
	color: var(--bst-lc-primary-text, #fff);
}

.bst-trigger-status {
	font-size: 13px;
	font-weight: 600;
	color: #2e7d32;
}

/* -----------------------------------------------------------------------
   Modal overlay
   ----------------------------------------------------------------------- */

.bst-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.bst-modal-overlay.bst-modal-open {
	opacity: 1;
	pointer-events: auto;
}

/* -----------------------------------------------------------------------
   Modal container
   ----------------------------------------------------------------------- */

.bst-modal {
	background: #fff;
	border-radius: 6px;
	box-shadow: 0 8px 40px rgba(0, 0, 0, 0.35);
	width: 100%;
	max-width: 960px;
	max-height: 90vh;
	display: flex;
	flex-direction: column;
	transform: translateY(-20px);
	transition: transform 0.2s ease;
	overflow: hidden;
}

.bst-modal-overlay.bst-modal-open .bst-modal {
	transform: translateY(0);
}

.bst-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	border-bottom: 1px solid #e5e5e5;
	background: #f9f9f9;
	flex-shrink: 0;
}

.bst-modal-header h3 {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	color: #333;
}

.bst-modal-close {
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	color: #666;
	cursor: pointer;
	padding: 0 4px;
	transition: color 0.15s;
}

.bst-modal-close:hover {
	color: #c0392b;
}

.bst-modal-body {
	overflow-y: auto;
	padding: 20px;
	flex: 1;
}

/* Lock body scroll when modal is open */
body.bst-modal-active {
	overflow: hidden;
}

/* -----------------------------------------------------------------------
   Customizer inside modal — reset top margin/border since modal provides it
   ----------------------------------------------------------------------- */

.bst-modal-body .bst-customizer-wrap {
	margin: 0;
	border-top: none;
	padding-top: 0;
}

#bst-logo-customizer {
	--bst-lc-primary:      #2c87c5;
	--bst-lc-primary-dark: #1f6da0;
	--bst-lc-primary-rgb:  44, 135, 197;   /* r, g, b — used for rgba() */
	--bst-lc-primary-text: #ffffff;         /* text on solid primary bg  */
}

.bst-customizer-wrap {
	box-sizing: border-box;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 14px;
	color: #333;
	margin: 20px 0 30px;
	border-top: 3px solid var(--bst-lc-primary);
	padding-top: 20px;
}

.bst-customizer-wrap *,
.bst-customizer-wrap *::before,
.bst-customizer-wrap *::after {
	box-sizing: inherit;
}

/* -----------------------------------------------------------------------
   Two-column layout
   ----------------------------------------------------------------------- */

.bst-customizer-layout {
	display: flex;
	gap: 24px;
	align-items: flex-start;
	flex-wrap: wrap;
}

/* -----------------------------------------------------------------------
   Canvas column — wraps the thumbnail strip + canvas side by side
   ----------------------------------------------------------------------- */

.bst-canvas-col {
	flex: 0 0 auto;
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 8px;
}

/* -----------------------------------------------------------------------
   Mockup image switcher — paginated vertical strip to the left of the canvas
   ----------------------------------------------------------------------- */

.bst-mockup-switcher {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	flex-shrink: 0;
}

.bst-mockup-nav {
	width: 52px;
	height: 20px;
	padding: 0;
	border: 1px solid #ddd;
	border-radius: 3px;
	background: #f7f7f7;
	color: #666;
	font-size: 9px;
	line-height: 1;
	cursor: pointer;
	flex-shrink: 0;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.bst-mockup-nav:hover:not( :disabled ) {
	background: var(--bst-lc-primary, #2c87c5);
	border-color: var(--bst-lc-primary, #2c87c5);
	color: #fff;
}

.bst-mockup-nav:disabled {
	opacity: 0.25;
	cursor: default;
}

.bst-mockup-thumb {
	width: 52px;
	height: 52px;
	padding: 0;
	border: 2px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	background: #fff;
	flex-shrink: 0;
	transition: border-color 0.15s, box-shadow 0.15s;
	display: block;
}

.bst-mockup-thumb:hover {
	border-color: var(--bst-lc-primary, #2c87c5);
}

.bst-mockup-thumb.active {
	border-color: var(--bst-lc-primary, #2c87c5);
	box-shadow: 0 0 0 2px rgba( var(--bst-lc-primary-rgb, 44, 135, 197), 0.30 );
}

.bst-mockup-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* -----------------------------------------------------------------------
   Canvas (right of thumbnail strip)
   ----------------------------------------------------------------------- */

.bst-canvas-wrap {
	flex: 0 0 auto;
	position: relative;
	border: 2px solid #ccc;
	background: #f5f5f5;
	line-height: 0;
}

.bst-canvas-wrap canvas {
	display: block;
	cursor: default;
}

.bst-canvas-hint {
	font-size: 11px;
	color: #888;
	text-align: center;
	margin: 4px 0 0;
	line-height: 1.4;
}

/* -----------------------------------------------------------------------
   Controls (right column)
   ----------------------------------------------------------------------- */

.bst-controls-wrap {
	flex: 1 1 280px;
	min-width: 280px;
	border: 1px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
}

/* -----------------------------------------------------------------------
   Tabs
   ----------------------------------------------------------------------- */

.bst-tabs {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	background: #f0f0f0;
	border-bottom: 2px solid var(--bst-lc-primary);
}

.bst-tab {
	flex: 1;
	padding: 10px 6px;
	text-align: center;
	cursor: pointer;
	font-size: 13px;
	font-weight: 500;
	color: #555;
	border-right: 1px solid #ddd;
	transition: background 0.15s, color 0.15s;
	user-select: none;
	line-height: 1.2;
}

.bst-tab:last-child {
	border-right: none;
}

.bst-tab:hover {
	background: rgba( var(--bst-lc-primary-rgb), 0.10 );
	color: var(--bst-lc-primary);
}

.bst-tab.active {
	background: #fff;
	color: var(--bst-lc-primary);
	border-bottom: 2px solid #fff;
	margin-bottom: -2px;
	font-weight: 600;
}

/* -----------------------------------------------------------------------
   Tab panels
   ----------------------------------------------------------------------- */

.bst-tab-content {
	display: none;
	padding: 16px;
	background: #fff;
}

.bst-tab-content.active {
	display: block;
}

/* -----------------------------------------------------------------------
   Form elements
   ----------------------------------------------------------------------- */

.bst-field-group {
	margin-bottom: 14px;
}

.bst-label {
	display: block;
	font-weight: 600;
	margin-bottom: 4px;
}

.bst-hint-text {
	color: #777;
	font-size: 12px;
	display: block;
	margin-bottom: 6px;
}

.bst-upload-row,
.bst-url-row {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}

.bst-url-row input[type="url"],
#bst-text-input,
#bst-font-family,
#bst-font-size {
	flex: 1;
	min-width: 0;
	padding: 7px 10px;
	border: 1px solid #bbb;
	border-radius: 3px;
	font-size: 13px;
	line-height: 1.4;
}

.bst-url-row input[type="url"]:focus,
#bst-text-input:focus,
#bst-font-family:focus,
#bst-font-size:focus {
	outline: none;
	border-color: var(--bst-lc-primary);
	box-shadow: 0 0 0 2px rgba( var(--bst-lc-primary-rgb), 0.20 );
}

#bst-text-color {
	width: 44px;
	height: 34px;
	padding: 2px;
	border: 1px solid #bbb;
	border-radius: 3px;
	cursor: pointer;
}

.bst-field-row {
	display: flex;
	gap: 12px;
	align-items: flex-end;
	flex-wrap: wrap;
}

.bst-half {
	flex: 1 1 80px;
}

.bst-checkbox-row {
	margin-bottom: 14px;
	gap: 16px;
}

.bst-checkbox-row label {
	display: flex;
	align-items: center;
	gap: 5px;
	cursor: pointer;
}

/* -----------------------------------------------------------------------
   Range sliders
   ----------------------------------------------------------------------- */

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

.bst-range-row input[type="range"] {
	flex: 1;
	cursor: pointer;
	accent-color: var(--bst-lc-primary);
}

.bst-range-label {
	min-width: 42px;
	font-size: 13px;
	color: #555;
	text-align: right;
}

/* -----------------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------------- */

.bst-btn {
	display: inline-block;
	padding: 7px 14px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	border: 1px solid #bbb;
	border-radius: 3px;
	background: #f7f7f7;
	color: #333;
	cursor: pointer;
	text-align: center;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
	white-space: nowrap;
}

.bst-btn:hover {
	background: #e8e8e8;
	border-color: #999;
}

.bst-btn-primary {
	background: var(--bst-lc-primary);
	border-color: var(--bst-lc-primary-dark);
	color: var(--bst-lc-primary-text);
}

.bst-btn-primary:hover {
	background: var(--bst-lc-primary-dark);
	border-color: var(--bst-lc-primary-dark);
	color: var(--bst-lc-primary-text);
}

.bst-btn-secondary {
	background: var(--bst-lc-primary);
	border-color: var(--bst-lc-primary-dark);
	color: var(--bst-lc-primary-text);
	margin-top: 10px;
	width: 100%;
	text-align: center;
}

.bst-btn-secondary:hover {
	background: var(--bst-lc-primary-dark);
	border-color: var(--bst-lc-primary-dark);
}

.bst-btn-sm {
	padding: 5px 10px;
	font-size: 12px;
}

.bst-btn-danger {
	background: #c0392b;
	border-color: #a93226;
	color: #fff;
}

.bst-btn-danger:hover {
	background: #a93226;
}

.bst-btn:disabled,
.bst-btn[disabled] {
	opacity: 0.45;
	cursor: not-allowed;
	pointer-events: none;
}

.bst-btn-group {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-top: 16px;
}

/* -----------------------------------------------------------------------
   Status messages
   ----------------------------------------------------------------------- */

.bst-status {
	min-height: 20px;
	font-size: 12px;
	margin-top: 8px;
	padding: 0 2px;
}

.bst-status.success { color: #2e7d32; }
.bst-status.error   { color: #c0392b; }
.bst-status.loading { color: #777; }

/* -----------------------------------------------------------------------
   Instructions
   ----------------------------------------------------------------------- */

.bst-instructions {
	background: rgba( var(--bst-lc-primary-rgb), 0.06 );
	border-left: 3px solid var(--bst-lc-primary);
	padding: 8px 12px;
	margin: 10px 0;
	border-radius: 0 3px 3px 0;
}

.bst-instructions p {
	margin: 3px 0;
	font-size: 12px;
	color: #555;
}

/* -----------------------------------------------------------------------
   Logo history thumbnails
   ----------------------------------------------------------------------- */

.bst-logo-history {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0;
	min-height: 60px;
}

.bst-logo-history:empty::before {
	content: attr(data-empty);
	color: #aaa;
	font-size: 12px;
	font-style: italic;
	align-self: center;
}

.bst-logo-thumb {
	position: relative;
	width: 70px;
	height: 70px;
	border: 2px solid #ddd;
	border-radius: 4px;
	overflow: hidden;
	cursor: pointer;
	background: #fff;
	transition: border-color 0.15s, transform 0.1s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.bst-logo-thumb:hover {
	border-color: var(--bst-lc-primary);
	transform: scale(1.05);
}

.bst-logo-thumb img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
}

.bst-logo-thumb .bst-thumb-remove {
	position: absolute;
	top: 1px;
	right: 2px;
	font-size: 14px;
	line-height: 1;
	color: #e74c3c;
	cursor: pointer;
	display: none;
	background: rgba(255,255,255,0.85);
	border-radius: 50%;
	width: 16px;
	height: 16px;
	text-align: center;
}

.bst-logo-thumb:hover .bst-thumb-remove {
	display: block;
}

/* -----------------------------------------------------------------------
   Save tab preview
   ----------------------------------------------------------------------- */

.bst-design-preview {
	margin: 12px 0;
	text-align: center;
}

.bst-design-preview img {
	max-width: 100%;
	border: 1px solid #ddd;
	border-radius: 3px;
}

/* -----------------------------------------------------------------------
   Artwork tab — info accordion
   ----------------------------------------------------------------------- */

.bst-artwork-info {
	background: #eaf4fb;
	border: 1px solid #b3d9f0;
	border-radius: 4px;
	margin-bottom: 14px;
	font-size: 12px;
	color: #1a4f6e;
}

.bst-artwork-info summary {
	padding: 9px 12px;
	cursor: pointer;
	font-weight: 700;
	font-size: 12px;
	color: #1a4f6e;
	list-style: none;
	user-select: none;
	display: flex;
	align-items: center;
	gap: 6px;
}

.bst-artwork-info summary::-webkit-details-marker {
	display: none;
}

.bst-artwork-info summary::before {
	content: '▶';
	font-size: 9px;
	transition: transform 0.15s;
	display: inline-block;
}

.bst-artwork-info[open] summary::before {
	transform: rotate( 90deg );
}

.bst-artwork-info-body {
	padding: 4px 12px 12px;
	border-top: 1px solid #b3d9f0;
}

.bst-artwork-info-body h4 {
	margin: 10px 0 3px;
	font-size: 12px;
	font-weight: 700;
	color: #1a4f6e;
}

.bst-artwork-info-body p {
	margin: 0 0 4px;
	color: #2c5f7a;
	line-height: 1.55;
	font-size: 12px;
}

.bst-artwork-info-body strong {
	color: #0d3d57;
}

/* -----------------------------------------------------------------------
   Artwork tab — required badge, notice, success state
   ----------------------------------------------------------------------- */

.bst-required-star {
	color: #c0392b;
	font-weight: 700;
	margin-left: 2px;
}

.bst-artwork-required-notice {
	background: #fef9e7;
	border: 1px solid #f0a500;
	border-radius: 3px;
	padding: 9px 12px;
	margin-bottom: 14px;
	font-size: 12px;
	color: #7a4f00;
	line-height: 1.5;
}

.bst-print-file-preview {
	margin-top: 10px;
}

.bst-artwork-done {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 12px;
	background: #eafaf1;
	border: 1px solid #27ae60;
	border-radius: 3px;
	margin-bottom: 6px;
}

.bst-artwork-done-icon {
	color: #27ae60;
	font-size: 16px;
	font-weight: 700;
	flex-shrink: 0;
}

.bst-artwork-done-name {
	font-size: 13px;
	font-weight: 600;
	color: #1a5c32;
	word-break: break-all;
}

#bst-print-preview-img {
	max-width: 100%;
	border: 1px solid #ddd;
	border-radius: 3px;
	margin-top: 6px;
	display: block;
}

/* -----------------------------------------------------------------------
   Responsive — tablet / large phone  (≤ 680px)
   ----------------------------------------------------------------------- */

@media ( max-width: 680px ) {

	/* Stack canvas + controls vertically */
	.bst-customizer-layout {
		flex-direction: column;
		gap: 16px;
	}

	/* Thumbnail strip moves below canvas, becomes a horizontal row */
	.bst-canvas-col {
		flex-direction: column-reverse;
		width: 100%;
	}
	.bst-mockup-switcher {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: center;
		justify-content: center;
		gap: 5px;
	}
	/* Nav arrows become left / right flanks in horizontal layout */
	.bst-mockup-nav {
		width: 24px;
		height: 52px;
		font-size: 9px;
	}

	/* Canvas fills full width — Fabric.js dimensions handled by JS */
	.bst-canvas-wrap {
		width: 100%;
	}

	/* Controls fill full width */
	.bst-controls-wrap {
		width: 100%;
		min-width: 0;
	}
}

/* -----------------------------------------------------------------------
   Responsive — small phone  (≤ 480px)
   ----------------------------------------------------------------------- */

@media ( max-width: 480px ) {

	/* Bottom-sheet modal: slides up from bottom, full width, rounded top corners */
	.bst-modal-overlay {
		padding: 0;
		align-items: flex-end;
	}
	.bst-modal {
		max-width: 100%;
		max-height: 92vh;
		border-radius: 14px 14px 0 0;
	}
	.bst-modal-header {
		padding: 12px 16px;
	}
	.bst-modal-header h3 {
		font-size: 15px;
	}
	.bst-modal-body {
		padding: 12px;
	}

	/* Tabs: smaller font + allow horizontal scroll if they still overflow */
	.bst-tabs {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.bst-tabs::-webkit-scrollbar {
		display: none;
	}
	.bst-tab {
		font-size: 11px;
		padding: 9px 4px;
		white-space: nowrap;
		flex: 1 0 auto;
	}

	/* Touch-friendly tap targets */
	.bst-btn {
		min-height: 42px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	.bst-mockup-thumb {
		width: 44px;
		height: 44px;
	}
	.bst-mockup-nav {
		width: 22px;
		height: 44px;
	}

	/* Reduce layout gap */
	.bst-customizer-layout {
		gap: 12px;
	}

	/* Shrink logo history thumbs slightly on phone */
	.bst-logo-thumb {
		width: 60px;
		height: 60px;
	}
}
