/* T-Shirt Designer – Frontend */

.tsd-start-wrap {
	margin: 12px 0 16px;
}

.tsd-start-btn {
	width: 100%;
	max-width: 320px;
	padding: 14px 24px !important;
	font-size: 16px !important;
	font-weight: 600 !important;
	background: #111 !important;
	color: #fff !important;
	border: none !important;
	border-radius: 8px !important;
	cursor: pointer;
	transition: background 0.2s;
}

.tsd-start-btn:hover {
	background: #333 !important;
}

/* ========== Modal ========== */
.tsd-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.tsd-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.65);
}

.tsd-modal-content {
	position: relative;
	background: #fff;
	border-radius: 12px;
	width: 96vw;
	max-width: 1100px;
	height: 90vh;
	max-height: 800px;
	display: flex;
	flex-direction: column;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
	overflow: hidden;
}

.tsd-modal-header {
	flex: 0 0 auto;
}

.tsd-modal-body {
	flex: 1 1 auto;
	min-height: 0;
}

.tsd-modal-footer {
	flex: 0 0 auto;
}

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

.tsd-modal-header h2 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
}

.tsd-close {
	background: none;
	border: none;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	color: #666;
	padding: 0 4px;
}

.tsd-close:hover {
	color: #000;
}

.tsd-modal-body {
	flex: 1;
	display: flex;
	overflow: hidden;
}

/* Toolbar */
.tsd-toolbar {
	width: 260px;
	min-width: 220px;
	background: #f7f7f7;
	border-right: 1px solid #e5e5e5;
	overflow-y: auto;
	padding: 16px;
}

.tsd-tool-section {
	margin-bottom: 20px;
}

.tsd-tool-section > label {
	display: block;
	font-size: 12px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #666;
	margin-bottom: 8px;
}

.tsd-color-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.tsd-swatch {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 2px solid transparent;
	cursor: pointer;
	padding: 0;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
	transition: transform 0.15s, border-color 0.15s;
}

.tsd-swatch:hover {
	transform: scale(1.12);
}

.tsd-swatch.active {
	border-color: #111;
	box-shadow: 0 0 0 2px #111;
}

.tsd-color-name {
	display: block;
	margin-top: 6px;
	font-size: 13px;
	color: #333;
}

.tsd-side-toggle {
	display: flex;
	gap: 4px;
}

.tsd-side-btn {
	flex: 1;
	padding: 8px;
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 6px;
	cursor: pointer;
	font-size: 13px;
}

.tsd-side-btn.active {
	background: #111;
	color: #fff;
	border-color: #111;
}

.tsd-tool-btn {
	display: flex !important;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 10px 12px !important;
	margin-bottom: 8px;
	border: 1px solid #ccc !important;
	background: #fff !important;
	color: #111 !important;
	border-radius: 6px !important;
	cursor: pointer;
	font-size: 14px !important;
	font-weight: 500 !important;
	line-height: 1.4 !important;
	text-align: left !important;
	transition: background 0.15s;
	box-shadow: none !important;
}

.tsd-tool-btn:hover {
	background: #f0f0f0 !important;
	color: #111 !important;
}

.tsd-tool-btn-sm {
	display: block !important;
	width: 100%;
	padding: 7px 10px !important;
	margin-bottom: 6px;
	border: 1px solid #ccc !important;
	background: #fff !important;
	color: #111 !important;
	border-radius: 5px !important;
	cursor: pointer;
	font-size: 13px !important;
	font-weight: 500 !important;
	text-align: left !important;
	box-shadow: none !important;
}

.tsd-tool-btn-sm:hover {
	background: #f0f0f0 !important;
	color: #111 !important;
}

.tsd-tool-btn-sm.tsd-danger {
	color: #c00 !important;
	border-color: #f5c6c6 !important;
}

.tsd-tool-btn-sm.tsd-danger:hover {
	background: #fee !important;
	color: #c00 !important;
}

/* Force readable text on side / style buttons */
.tsd-side-btn {
	color: #111 !important;
}
.tsd-side-btn.active {
	color: #fff !important;
}
.tsd-style-btn,
.tsd-align-btn {
	color: #111 !important;
	background: #fff !important;
}
.tsd-style-btn.active,
.tsd-align-btn.active {
	color: #fff !important;
	background: #111 !important;
}

/* Text controls */
.tsd-text-controls input[type="text"],
.tsd-text-controls select {
	width: 100%;
	padding: 8px;
	margin-bottom: 8px;
	border: 1px solid #ccc;
	border-radius: 5px;
	font-size: 14px;
}

.tsd-font-row {
	display: flex;
	gap: 8px;
	margin-bottom: 8px;
}

.tsd-font-row input[type="number"] {
	width: 70px;
	padding: 6px;
	border: 1px solid #ccc;
	border-radius: 5px;
}

.tsd-font-row input[type="color"] {
	flex: 1;
	height: 34px;
	border: 1px solid #ccc;
	border-radius: 5px;
	cursor: pointer;
}

.tsd-font-style,
.tsd-align-row {
	display: flex;
	gap: 6px;
	margin-bottom: 8px;
}

.tsd-style-btn,
.tsd-align-btn {
	flex: 1;
	padding: 6px;
	border: 1px solid #ccc;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
}

.tsd-style-btn.active,
.tsd-align-btn.active {
	background: #111;
	color: #fff;
	border-color: #111;
}

/* Canvas area */
.tsd-canvas-wrap {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	background: #e8e8e8;
	padding: 20px;
	overflow: auto;
}

.tsd-canvas-bg {
	position: relative;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
	overflow: hidden;
}

#tsd-canvas {
	display: block;
}

.tsd-hint {
	margin-top: 12px;
	font-size: 12px;
	color: #777;
	text-align: center;
}

/* Footer */
.tsd-modal-footer {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 12px;
	padding: 14px 20px;
	border-top: 1px solid #e5e5e5;
	background: #fafafa;
}

.tsd-fee-info {
	margin-right: auto;
	font-size: 14px;
	color: #555;
}

.tsd-modal-footer .button {
	padding: 10px 20px !important;
	border-radius: 6px !important;
}

.tsd-modal-footer .button.alt {
	background: #111 !important;
	color: #fff !important;
	border: none !important;
}

/* Cart badge */
.tsd-custom-badge {
	font-size: 0.85em;
	color: #666;
	font-weight: normal;
}

/* Placement / size options */
.tsd-placement-options {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.tsd-placement-btn {
	display: flex !important;
	flex-direction: column;
	align-items: flex-start !important;
	width: 100%;
	padding: 10px 12px !important;
	border: 1px solid #ccc !important;
	border-radius: 8px !important;
	background: #fff !important;
	color: #111 !important;
	cursor: pointer;
	text-align: left !important;
	box-shadow: none !important;
	transition: border-color 0.15s, background 0.15s;
}

.tsd-placement-btn:hover {
	background: #f5f5f5 !important;
}

.tsd-placement-btn.active {
	border-color: #111 !important;
	background: #111 !important;
	color: #fff !important;
}

.tsd-placement-title {
	font-size: 13px;
	font-weight: 600;
}

.tsd-placement-fee {
	font-size: 12px;
	opacity: 0.85;
	margin-top: 2px;
}


/* Clipart grid in designer */
.tsd-clipart-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	max-height: 200px;
	overflow-y: auto;
	padding: 2px;
}

.tsd-clipart-btn {
	display: flex !important;
	align-items: center;
	justify-content: center;
	aspect-ratio: 1;
	padding: 4px !important;
	border: 1px solid #ddd !important;
	border-radius: 6px !important;
	background: #fff !important;
	cursor: pointer;
	overflow: hidden;
	box-shadow: none !important;
	transition: border-color 0.15s, transform 0.1s;
}

.tsd-clipart-btn:hover {
	border-color: #111 !important;
	transform: scale(1.04);
}

.tsd-clipart-btn img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	pointer-events: none;
}

.tsd-footer-actions {
	display: flex;
	gap: 12px;
	align-items: center;
}

/* Responsive / Mobile */
@media (max-width: 768px) {
	.tsd-modal {
		align-items: stretch;
		justify-content: stretch;
	}

	.tsd-modal-content {
		width: 100vw !important;
		height: 100vh !important;
		height: 100dvh !important;
		max-width: 100vw !important;
		max-height: 100vh !important;
		max-height: 100dvh !important;
		border-radius: 0 !important;
		display: flex !important;
		flex-direction: column !important;
		overflow: hidden !important;
	}

	.tsd-modal-header {
		padding: 8px 12px;
		flex: 0 0 auto;
		z-index: 20;
	}

	.tsd-modal-header h2 {
		font-size: 13px;
		line-height: 1.25;
		padding-right: 28px;
	}

	/* Body: canvas sticky + scrollable tools */
	.tsd-modal-body {
		flex: 1 1 auto;
		min-height: 0;
		display: flex !important;
		flex-direction: column;
		overflow-y: auto;
		overflow-x: hidden;
		-webkit-overflow-scrolling: touch;
	}

	/* Canvas stays on top while scrolling tools */
	.tsd-canvas-wrap {
		order: 1;
		position: sticky;
		top: 0;
		z-index: 15;
		flex: 0 0 auto;
		padding: 6px 8px 8px;
		background: #e8e8e8;
		max-height: none !important;
		overflow: visible !important;
		box-shadow: 0 2px 8px rgba(0,0,0,0.06);
	}

	.tsd-canvas-bg {
		margin: 0 auto;
		box-shadow: 0 2px 10px rgba(0,0,0,0.1);
		max-width: 100%;
	}

	#tsd-canvas {
		max-width: 100% !important;
		height: auto !important;
	}

	.tsd-hint {
		display: none;
	}

	/* Tools below canvas */
	.tsd-toolbar {
		order: 2;
		display: flex;
		flex-direction: column;
		width: 100%;
		min-width: 0;
		max-height: none !important;
		flex: 0 0 auto;
		border-right: none;
		border-top: 1px solid #e5e5e5;
		padding: 10px 12px 20px;
		overflow: visible;
		background: #fff;
	}

	/* Order: Add Elements → Clipart → Color → Side (placement hidden, shown in footer) */
	.tsd-section-elements { order: 1; }
	.tsd-section-clipart  { order: 2; }
	.tsd-section-color    { order: 3; }
	.tsd-section-side     { order: 4; }
	.tsd-text-controls    { order: 5; }
	#tsd-layer-controls   { order: 6; }
	.tsd-section-placement {
		display: none !important; /* moved to footer on mobile */
	}

	.tsd-tool-section {
		margin-bottom: 12px;
	}

	.tsd-tool-section label {
		font-size: 11px;
		margin-bottom: 6px;
	}

	/* Smaller color swatches */
	.tsd-section-color .tsd-color-swatches {
		gap: 6px;
	}

	.tsd-section-color .tsd-swatch {
		width: 22px !important;
		height: 22px !important;
		border-width: 1px !important;
	}

	.tsd-section-color .tsd-color-name {
		font-size: 11px;
	}

	.tsd-tool-btn,
	.tsd-tool-btn-sm {
		padding: 10px 12px !important;
		font-size: 13px !important;
		min-height: 42px;
	}

	.tsd-clipart-grid {
		grid-template-columns: repeat(4, 1fr);
		max-height: 160px;
	}

	.tsd-side-btn {
		padding: 10px;
		min-height: 40px;
		font-size: 13px;
	}

	/* FOOTER: ukuran desain + fee + buttons — always visible */
	.tsd-modal-footer {
		flex: 0 0 auto !important;
		display: flex !important;
		flex-direction: column;
		align-items: stretch;
		padding: 8px 10px !important;
		padding-bottom: max(10px, env(safe-area-inset-bottom, 10px)) !important;
		gap: 6px;
		border-top: 1px solid #ddd !important;
		background: #fff !important;
		box-shadow: 0 -4px 16px rgba(0,0,0,0.1);
		z-index: 25;
	}

	.tsd-footer-placement {
		display: flex !important;
		flex-direction: row;
		flex-wrap: nowrap;
		gap: 4px;
		width: 100%;
	}

	.tsd-footer-placement .tsd-placement-btn {
		flex: 1 1 0;
		min-width: 0;
		padding: 6px 4px !important;
		align-items: center !important;
		text-align: center !important;
		border-radius: 6px !important;
	}

	.tsd-footer-placement .tsd-placement-title {
		font-size: 10px;
		font-weight: 600;
		line-height: 1.2;
	}

	.tsd-footer-placement .tsd-placement-fee {
		font-size: 9px;
		margin-top: 1px;
	}

	.tsd-fee-info {
		width: 100%;
		margin: 0 !important;
		font-size: 11px;
		text-align: center;
		line-height: 1.3;
		color: #333;
	}

	.tsd-footer-actions {
		display: flex;
		gap: 8px;
		width: 100%;
	}

	.tsd-footer-actions .button {
		flex: 1 1 50% !important;
		min-height: 44px !important;
		padding: 10px 8px !important;
		font-size: 13px !important;
		font-weight: 600 !important;
		display: inline-flex !important;
		align-items: center !important;
		justify-content: center !important;
	}

	.tsd-footer-actions #tsd-save-design,
	.tsd-footer-actions .button.alt {
		background: #111 !important;
		color: #fff !important;
		border: none !important;
	}

	.tsd-start-btn {
		max-width: 100%;
		min-height: 48px;
		font-size: 15px !important;
	}
}

/* Desktop: hide footer placement clone */
@media (min-width: 769px) {
	.tsd-footer-placement {
		display: none !important;
	}

	.tsd-footer-actions {
		display: contents;
	}
}

@media (max-width: 400px) {
	.tsd-clipart-grid {
		grid-template-columns: repeat(3, 1fr);
	}

	.tsd-footer-placement .tsd-placement-title {
		font-size: 9px;
	}
}
