/**
 * Stitch Connect - 4-Step Ordering Customizer CSS
 * Matches Trade Embroidery (Colours, Sizes/Quantities, Customise, Add to Basket)
 */

/* Hide standard single product quantity and Add to Cart button when Stitch customizer is present */
form.cart:has(.stitch-order-builder) > .quantity,
form.cart:has(.stitch-order-builder) > button.single_add_to_cart_button,
form.cart:has(#stitch-customizer-box) > .quantity,
form.cart:has(#stitch-customizer-box) > button.single_add_to_cart_button {
	display: none !important;
}

.stitch-order-builder {
	margin: 24px 0 36px 0;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #1f2937;
	box-sizing: border-box;
}

.stitch-order-builder *,
.stitch-order-builder *:before,
.stitch-order-builder *:after {
	box-sizing: border-box;
}

.stitch-main-heading {
	font-size: 1.75rem;
	font-weight: 800;
	color: #111827;
	margin: 0 0 20px 0;
	letter-spacing: -0.02em;
}

/* Step Cards */
.stitch-step-card {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	margin-bottom: 24px;
	padding: 22px 24px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.stitch-step-card:hover {
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.stitch-step-header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
}

.stitch-step-header-toggle {
	justify-content: space-between;
}

.stitch-step-header-left {
	display: flex;
	align-items: center;
	gap: 12px;
}

.stitch-step-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	background-color: #e52629;
	color: #ffffff;
	font-weight: 700;
	font-size: 14px;
	border-radius: 50%;
	line-height: 1;
	flex-shrink: 0;
}

.stitch-step-title {
	font-size: 1.15rem;
	font-weight: 700;
	color: #111827;
	margin: 0;
}

.stitch-section-subhead {
	font-size: 0.95rem;
	font-weight: 700;
	color: #374151;
	margin: 16px 0 12px 0;
}

/* STEP 1: Swatches */
.stitch-swatches-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.stitch-swatch-item {
	background: none;
	border: 2px solid transparent;
	padding: 2px;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.15s ease;
	line-height: 0;
}

.stitch-swatch-preview {
	display: block;
	width: 26px;
	height: 26px;
	border-radius: 4px;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15);
	transition: transform 0.15s ease;
}

.stitch-swatch-item:hover .stitch-swatch-preview {
	transform: scale(1.12);
}

.stitch-swatch-item.is-active {
	border-color: #111827;
	box-shadow: 0 0 0 1px #111827;
}

/* STEP 2: Sizes & Quantities */
.stitch-selected-color-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 18px;
	font-size: 0.95rem;
	font-weight: 700;
	color: #111827;
}

.stitch-color-indicator {
	display: inline-block;
	width: 16px;
	height: 16px;
	border-radius: 3px;
	border: 1px solid rgba(0, 0, 0, 0.15);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.stitch-size-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px 28px;
}

@media (max-width: 640px) {
	.stitch-size-grid {
		grid-template-columns: 1fr;
	}
}

.stitch-size-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 0;
	border-bottom: 1px solid #f3f4f6;
}

.stitch-size-check-label {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	min-width: 65px;
	font-weight: 700;
	font-size: 0.95rem;
	color: #1f2937;
	margin: 0;
	user-select: none;
}

.stitch-size-checkbox {
	width: 16px;
	height: 16px;
	accent-color: #e52629;
	cursor: pointer;
	margin: 0;
}

.stitch-stock-badge {
	font-size: 0.82rem;
	color: #6b7280;
	font-weight: 400;
	flex: 1;
	margin: 0 12px;
}

.stitch-qty-stepper {
	display: inline-flex;
	align-items: center;
	border: 1px solid #d1d5db;
	border-radius: 4px;
	overflow: hidden;
	background: #ffffff;
}

.stitch-stepper-btn {
	background: #f9fafb;
	border: none;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
	font-weight: bold;
	color: #374151;
	cursor: pointer;
	transition: background 0.15s ease;
	user-select: none;
	padding: 0;
}

.stitch-stepper-btn:hover {
	background: #e5e7eb;
}

.stitch-qty-input {
	width: 44px;
	height: 32px;
	border: none;
	border-left: 1px solid #d1d5db;
	border-right: 1px solid #d1d5db;
	text-align: center;
	font-weight: 700;
	font-size: 0.92rem;
	color: #111827;
	padding: 0;
	margin: 0;
	-moz-appearance: textfield;
}

.stitch-qty-input::-webkit-outer-spin-button,
.stitch-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* STEP 3: Customise */
.stitch-customise-checkbox-wrap {
	display: flex;
	align-items: center;
	cursor: pointer;
	margin: 0;
}

.stitch-customise-checkbox-wrap input[type="checkbox"] {
	width: 18px;
	height: 18px;
	accent-color: #e52629;
	cursor: pointer;
}

.stitch-positions-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 24px;
}

@media (max-width: 900px) {
	.stitch-positions-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 580px) {
	.stitch-positions-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

.stitch-pos-card {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 16px 10px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	user-select: none;
}

.stitch-pos-card:hover {
	border-color: #cbd5e1;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}

.stitch-pos-icon svg {
	width: 52px;
	height: 52px;
	stroke: #374151;
	fill: none;
	transition: stroke 0.2s ease;
}

.stitch-pos-icon .pos-highlight {
	stroke: #e52629;
	fill: rgba(229, 38, 41, 0.15);
	stroke-width: 1.8;
	transition: all 0.2s ease;
}

.stitch-pos-name {
	font-size: 0.88rem;
	font-weight: 700;
	color: #1f2937;
	transition: color 0.2s ease;
}

/* Active State for Position Cards */
.stitch-pos-card.is-selected {
	background: #e52629 !important;
	border-color: #e52629 !important;
	color: #ffffff !important;
	box-shadow: 0 4px 12px rgba(229, 38, 41, 0.35);
}

.stitch-pos-card.is-selected svg {
	stroke: #ffffff !important;
}

.stitch-pos-card.is-selected .pos-highlight {
	stroke: #ffffff !important;
	fill: rgba(255, 255, 255, 0.45) !important;
}

.stitch-pos-card.is-selected .stitch-pos-name {
	color: #ffffff !important;
}

/* Application Type Pills (Print vs Embroidery) */
.stitch-type-section {
	margin-bottom: 24px;
}

.stitch-type-pills {
	display: flex;
	gap: 12px;
	flex-wrap: wrap;
}

.stitch-type-pill {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 18px;
	border: 1.5px solid #e5e7eb;
	border-radius: 6px;
	background: #f9fafb;
	font-size: 0.88rem;
	font-weight: 600;
	color: #374151;
	cursor: pointer;
	transition: all 0.15s ease;
	margin: 0;
}

.stitch-type-pill input[type="radio"] {
	accent-color: #e52629;
	margin: 0;
}

.stitch-type-pill.is-active {
	border-color: #e52629;
	background: #fef2f2;
	color: #991b1b;
}

/* Artwork Method Cards */
.stitch-methods-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-bottom: 20px;
}

@media (max-width: 580px) {
	.stitch-methods-grid {
		grid-template-columns: 1fr;
	}
}

.stitch-method-card {
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	padding: 16px 12px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	user-select: none;
}

.stitch-method-card:hover {
	border-color: #cbd5e1;
}

.stitch-method-card svg {
	width: 42px;
	height: 42px;
	stroke: #374151;
	fill: none;
	transition: stroke 0.2s ease;
}

.stitch-method-name {
	font-size: 0.88rem;
	font-weight: 700;
	color: #1f2937;
	transition: color 0.2s ease;
}

.stitch-method-card.is-selected {
	background: #e52629 !important;
	border-color: #e52629 !important;
	color: #ffffff !important;
	box-shadow: 0 4px 12px rgba(229, 38, 41, 0.35);
}

.stitch-method-card.is-selected svg {
	stroke: #ffffff !important;
}

.stitch-method-card.is-selected .stitch-method-name {
	color: #ffffff !important;
}

/* Method Panels */
.stitch-method-panel {
	display: none;
	padding: 14px 0 6px 0;
}

.stitch-method-panel.is-active {
	display: block;
}

/* Drag-and-drop dropzone */
.stitch-dropzone {
	border: 2px dashed #cbd5e0;
	border-radius: 8px;
	background: #f8fafc;
	padding: 24px 16px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s ease;
}

.stitch-dropzone:hover,
.stitch-dropzone.dragover {
	border-color: #e52629;
	background: #fff5f5;
}

.stitch-dropzone-icon {
	font-size: 28px;
	width: 28px;
	height: 28px;
	color: #e52629;
	margin-bottom: 8px;
}

.stitch-dropzone-prompt {
	margin: 0 0 4px 0;
	font-size: 0.95rem;
	color: #2d3748;
}

.stitch-dropzone-hint {
	margin: 0;
	font-size: 0.8rem;
	color: #718096;
}

.stitch-file-status {
	margin-top: 10px;
	font-size: 0.88rem;
	font-weight: 600;
	color: #047857;
	background: #ecfdf5;
	padding: 6px 12px;
	border-radius: 4px;
	display: inline-block;
}

/* Textarea & Notice box */
.stitch-field-wrap {
	margin-top: 6px;
}

.stitch-field-label {
	display: block;
	font-size: 0.88rem;
	font-weight: 600;
	color: #374151;
	margin-bottom: 6px;
}

.stitch-textarea {
	width: 100%;
	padding: 10px 12px;
	font-size: 0.9rem;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #f9fafb;
	color: #1f2937;
	resize: vertical;
	outline: none;
}

.stitch-textarea:focus {
	border-color: #e52629;
	background: #ffffff;
	box-shadow: 0 0 0 2px rgba(229, 38, 41, 0.15);
}

.stitch-notice-box {
	background: #f0fdf4;
	border: 1px solid #bbf7d0;
	border-radius: 6px;
	padding: 14px 16px;
	color: #166534;
	font-size: 0.88rem;
	line-height: 1.5;
}

.stitch-notice-box p {
	margin: 0;
}

/* STEP 4: Add to basket & Breakdown Table */
.stitch-breakdown-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 24px;
	font-size: 0.92rem;
}

.stitch-breakdown-table th {
	text-align: left;
	padding: 10px 12px;
	background: #f9fafb;
	border-bottom: 1px solid #e5e7eb;
	color: #4b5563;
	font-weight: 600;
	font-size: 0.84rem;
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

.stitch-breakdown-table th.stitch-col-qty,
.stitch-breakdown-table th.stitch-col-total {
	text-align: right;
}

.stitch-breakdown-table td {
	padding: 12px;
	border-bottom: 1px solid #f3f4f6;
	color: #1f2937;
}

.stitch-breakdown-table td.stitch-col-qty,
.stitch-breakdown-table td.stitch-col-total {
	text-align: right;
}

.stitch-breakdown-total-row td {
	font-weight: 700;
	font-size: 1rem;
	border-top: 2px solid #e5e7eb;
	border-bottom: none;
	padding-top: 14px;
}

.stitch-vat-tag {
	font-size: 0.8rem;
	font-weight: normal;
	color: #6b7280;
}

.stitch-empty-row td {
	text-align: center;
	color: #9ca3af;
	font-style: italic;
	padding: 20px 12px;
}

/* Action Button */
.stitch-action-wrap {
	margin-top: 18px;
}

.stitch-add-to-basket-button {
	background-color: #e52688;
	color: #ffffff;
	font-size: 1.05rem;
	font-weight: 800;
	padding: 14px 34px;
	border: none;
	border-radius: 24px;
	cursor: pointer;
	letter-spacing: 0.5px;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-shadow: 0 4px 14px rgba(229, 38, 136, 0.35);
}

.stitch-add-to-basket-button:hover:not(:disabled) {
	background-color: #d11e7a;
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(229, 38, 136, 0.45);
}

.stitch-add-to-basket-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
	box-shadow: none;
}

.stitch-feedback-msg {
	margin-top: 12px;
	padding: 10px 14px;
	border-radius: 6px;
	font-size: 0.9rem;
	font-weight: 600;
}

.stitch-feedback-msg.is-error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.stitch-feedback-msg.is-success {
	background: #f0fdf4;
	color: #166534;
	border: 1px solid #bbf7d0;
}

/* Spinner */
.stitch-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-radius: 50%;
	border-top-color: #ffffff;
	animation: stitch-spin 0.8s linear infinite;
}

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