/* =============================================================
   Woo Mobile Case Designer — Personalization styles
   ============================================================= */

/* ── Personalise button ───────────────────────────────────────────────────── */

.wmcd-personalize-btn {
	display: block;
	width: 100%;
	margin-top: 10px !important;
	padding: 14px 24px !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	background-color: #ff6600 !important;
	color: #fff !important;
	border: none !important;
	border-radius: 8px !important;
	cursor: pointer !important;
	transition: background .2s !important;
	letter-spacing: .3px;
}

.wmcd-personalize-btn:hover:not(:disabled) {
	background-color: #e55a00 !important;
}

.wmcd-p-btn-hidden {
	display: none !important;
}

/* ── Overlay ──────────────────────────────────────────────────────────────── */

#wmcd-p-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	z-index: 999999;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
	box-sizing: border-box;
	backdrop-filter: blur(2px);
}

#wmcd-p-overlay.wmcd-p-open {
	display: flex;
}

body.wmcd-p-no-scroll {
	overflow: hidden;
}

/* ── Modal ────────────────────────────────────────────────────────────────── */

.wmcd-p-modal {
	background: #fff;
	border-radius: 14px;
	max-width: 880px;
	width: 100%;
	max-height: 92vh;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
	animation: wmcdModalIn .22s ease;
	position: relative;
}

@keyframes wmcdModalIn {
	from { opacity: 0; transform: scale(.96) translateY(10px); }
	to   { opacity: 1; transform: scale(1)  translateY(0);     }
}

.wmcd-p-modal-inner {
	display: grid;
	grid-template-columns: 1fr 1fr;
	flex: 1;
	overflow: hidden;
}

/* ── Close button ─────────────────────────────────────────────────────────── */

.wmcd-p-close {
	position: absolute;
	top: 12px;
	right: 14px;
	background: none;
	border: none;
	font-size: 26px;
	line-height: 1;
	color: #888;
	cursor: pointer;
	padding: 4px 8px;
	border-radius: 6px;
	transition: color .15s, background .15s;
	z-index: 1;
}

.wmcd-p-close:hover {
	color: #333;
	background: #f2f2f2;
}

/* ── Left column: preview ─────────────────────────────────────────────────── */

.wmcd-p-col-preview {
	background: #f5f6f8;
	border-right: 1px solid #ebebeb;
	border-radius: 14px 0 0 14px;
	padding: 36px 28px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 20px;
	overflow-y: auto;
}

#wmcd-p-mockup {
	width: 100%;
	max-width: 280px;
	height: auto;
	border-radius: 10px;
	box-shadow: 0 6px 24px rgba(0, 0, 0, .12);
}

#wmcd-p-instructions {
	text-align: center;
	color: #555;
	font-size: 13.5px;
	line-height: 1.55;
	max-width: 280px;
}

/* ── Right column: uploads ────────────────────────────────────────────────── */

.wmcd-p-col-uploads {
	padding: 28px 20px 20px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
}

.wmcd-p-modal-title {
	font-size: 17px;
	font-weight: 700;
	color: #1a1a1a;
	margin: 0 0 12px;
}

/* ── Upload fields — 3-column grid ───────────────────────────────────────── */

#wmcd-p-fields {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	align-items: start;
}

.wmcd-p-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.wmcd-p-field-label {
	font-size: 11px;
	font-weight: 600;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* ── Dropzone ─────────────────────────────────────────────────────────────── */

.wmcd-p-dropzone {
	border: 2px dashed #d4d4d4;
	border-radius: 8px;
	background: #fdfdfd;
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: border-color .18s, background .18s;
	overflow: hidden;
	position: relative;
}

.wmcd-p-dropzone:hover,
.wmcd-p-dropzone.wmcd-p-drag-over {
	border-color: #ff6600;
	background: #fff8f4;
}

.wmcd-p-drop-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 8px 6px;
	text-align: center;
	pointer-events: none;
}

.wmcd-p-upload-icon {
	font-size: 22px;
	color: #bbb;
	pointer-events: none;
}

.wmcd-p-drop-hint {
	font-size: 11px;
	color: #888;
	pointer-events: none;
}

.wmcd-p-choose-btn {
	pointer-events: all;
	background: none;
	border: 1.5px solid #ff6600;
	color: #ff6600;
	font-size: 11px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 4px;
	cursor: pointer;
	margin-top: 2px;
	transition: background .15s, color .15s;
}

.wmcd-p-choose-btn:hover {
	background: #ff6600;
	color: #fff;
}

/* ── Preview inside dropzone ──────────────────────────────────────────────── */

.wmcd-p-preview-wrap {
	position: absolute;
	inset: 0;
	padding: 0;
}

.wmcd-p-preview-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 6px;
	display: block;
}

.wmcd-p-remove-upload {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 24px;
	height: 24px;
	background: rgba(0, 0, 0, .55);
	color: #fff;
	border: none;
	border-radius: 50%;
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
}

.wmcd-p-remove-upload:hover {
	background: rgba(200, 0, 0, .8);
}

/* ── Uploading indicator + progress bar ───────────────────────────────────── */

.wmcd-p-uploading {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 5px;
	padding: 8px;
	width: 100%;
	height: 100%;
}

.wmcd-p-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #e8e8e8;
	border-top-color: #ff6600;
	border-radius: 50%;
	animation: wmcdSpin .65s linear infinite;
	flex-shrink: 0;
}

@keyframes wmcdSpin {
	to { transform: rotate(360deg); }
}

.wmcd-p-progress-track {
	width: 78%;
	height: 3px;
	background: #e8e8e8;
	border-radius: 2px;
	overflow: hidden;
}

.wmcd-p-progress-fill {
	height: 100%;
	width: 0%;
	background: #ff6600;
	border-radius: 2px;
	transition: width .12s ease;
}

.wmcd-p-progress-pct {
	font-size: 10px;
	font-weight: 600;
	color: #888;
	line-height: 1;
}

/* ── Field meta / errors ──────────────────────────────────────────────────── */

.wmcd-p-field-meta {
	display: flex;
	gap: 6px;
	font-size: 10px;
	color: #b0b0b0;
}

.wmcd-p-field-error {
	font-size: 10px;
	color: #c0392b;
	background: #fef3f2;
	border-radius: 4px;
	padding: 3px 6px;
}

/* ── Actions row ──────────────────────────────────────────────────────────── */

.wmcd-p-actions {
	margin-top: 20px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

#wmcd-p-global-error {
	font-size: 13px;
	color: #c0392b;
	background: #fef3f2;
	border-left: 3px solid #e74c3c;
	border-radius: 5px;
	padding: 8px 12px;
}

#wmcd-p-add-to-cart {
	width: 100%;
	padding: 15px 24px !important;
	font-size: 16px !important;
	font-weight: 700 !important;
	background-color: #ff6600 !important;
	color: #fff !important;
	border: none !important;
	border-radius: 9px !important;
	cursor: pointer !important;
	transition: background .18s, opacity .18s !important;
}

#wmcd-p-add-to-cart:disabled {
	opacity: .45 !important;
	cursor: not-allowed !important;
}

#wmcd-p-add-to-cart:not(:disabled):hover {
	background-color: #e55a00 !important;
}

.wmcd-p-terms {
	font-size: 12px;
	color: #aaa;
	text-align: center;
	margin-top: 10px;
}

/* ── Cart / order filename list ───────────────────────────────────────────── */

.wmcd-p-filelist {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	font-size: 12.5px;
	color: #666;
}

.wmcd-p-filelist li {
	margin-bottom: 2px;
}

/* ── Admin order panel ────────────────────────────────────────────────────── */

.wmcd-p-admin-panel {
	margin-top: 10px;
	padding: 10px 12px;
	background: #f9f9f9;
	border: 1px solid #e5e5e5;
	border-radius: 5px;
}

.wmcd-p-admin-title {
	margin: 0 0 8px !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	color: #23282d !important;
	text-transform: uppercase;
	letter-spacing: .4px;
}

.wmcd-p-admin-table {
	width: 100%;
	border-collapse: collapse;
}

.wmcd-p-admin-table tr + tr td {
	border-top: 1px solid #efefef;
}

.wmcd-p-admin-col-label {
	font-size: 12px;
	font-weight: 600;
	color: #23282d;
	white-space: nowrap;
	padding: 4px 10px 4px 0;
	width: 1%;
}

.wmcd-p-admin-col-filename {
	font-size: 12px;
	color: #555;
	word-break: break-all;
	padding: 4px 10px 4px 0;
}

.wmcd-p-admin-col-action {
	white-space: nowrap;
	padding: 4px 0;
	width: 1%;
}

.wmcd-p-download-btn.button {
	font-size: 11px !important;
	padding: 2px 8px !important;
	height: auto !important;
	white-space: nowrap;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

@media ( max-width: 640px ) {
	/* Overlay is the scroll container.
	   padding gives the top/bottom offset from the screen edge. */
	#wmcd-p-overlay {
		align-items: flex-start;
		padding: 20px 10px;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Modal grows to its natural content height — no clipping.
	   padding-top reserves a header zone for the close button. */
	.wmcd-p-modal {
		max-height: none;
		width: 100%;
		border-radius: 12px;
		overflow: visible;
		display: flex;
		flex-direction: column;
		padding-top: 44px;
	}

	/* Columns stack vertically, natural height. */
	.wmcd-p-modal-inner {
		display: flex;
		flex-direction: column;
		overflow: visible;
	}

	/* Preview: image full-width on top, instructions full-width below. */
	.wmcd-p-col-preview {
		border-right: none;
		border-bottom: 1px solid #ebebeb;
		border-radius: 0;
		padding: 16px;
		max-height: none;
		overflow: visible;
		flex-direction: column;
		align-items: center;
		justify-content: flex-start;
		gap: 10px;
		flex-shrink: 0;
	}

	#wmcd-p-mockup {
		width: 100%;
		max-width: 100%;
		height: auto;
	}

	#wmcd-p-instructions {
		width: 100%;
		max-width: 100%;
		font-size: 12px;
		text-align: center;
	}

	/* Uploads: natural height, no inner scroll — overlay handles it. */
	.wmcd-p-col-uploads {
		padding: 14px 14px 16px;
		overflow: visible;
	}

	/* Up to 3 photos in a single row; more wrap and the overlay scrolls. */
	#wmcd-p-fields {
		grid-template-columns: repeat(3, 1fr);
	}
}
