/**
 * Hollywood Prints Designer UI — Phase 3 mobile studio chrome.
 *
 * Scoped to body.hp-mobile-designer (max-width: 899px via Phase 1 JS).
 * Desktop (≥900px) is unchanged. Does not alter Fabric print coordinates.
 */

.hp-mobile-designer {
	--hp-pink: #FF39A3;
	--hp-mint: #77FFC9;
	--hp-yellow: #FEC85C;
	--hp-surface: #FFFFFF;
	--hp-surface-muted: #F6F6F8;
	--hp-border: #E7E7EC;
	--hp-text: #242424;
	--hp-text-muted: #6F6F78;
	--hp-canvas-bg: #F2F2F4;
	--hp-toolbar-height: 64px;
	--hp-purchase-height: 72px;
	--hp-sheet-max: min(52dvh, 420px);
	--hp-font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--hp-mobile-future-toolbar-space: calc(var(--hp-toolbar-height) + var(--hp-purchase-height) + 8px);
}

/* -------------------------------------------------------------------------
   Canvas-first: tighten vertical chrome; keep canvas visible above bars.
   ------------------------------------------------------------------------- */

.hp-mobile-designer #wcdp-container {
	/* Fill viewport under header; fixed chrome overlays the reserved opts margin. */
	padding-bottom: 0 !important;
	min-height: calc(100dvh - var(--hp-mobile-header-offset, 56px)) !important;
	max-height: calc(100dvh - var(--hp-mobile-header-offset, 56px));
	overflow: hidden;
	box-sizing: border-box;
}

.hp-mobile-designer #wcdp-editor-container {
	flex: 1 1 auto !important;
	min-height: 0 !important;
	height: 100%;
	max-height: 100%;
	overflow: hidden;
}

.hp-mobile-designer #wcdp-canvas-container {
	min-height: 0 !important;
	flex: 1 1 auto;
	padding: 4px 12px 0 !important;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.hp-mobile-designer.hp-sheet-is-open #wcdp-canvas-container {
	/* Keep shirt visible above the sheet; do not cover full canvas. */
	max-height: calc(100dvh - var(--hp-mobile-header-offset, 56px) - var(--hp-sheet-max) - 8px);
}

.hp-mobile-designer #wcdp-opts-below-canvas {
	flex: 0 0 auto;
	padding: 2px 12px 8px !important;
	gap: 10px;
	/* Push Front/Back above the fixed toolbar + purchase bar. */
	margin-bottom: calc(var(--hp-toolbar-height) + var(--hp-purchase-height) + env(safe-area-inset-bottom, 0px) + 4px) !important;
	position: relative;
	z-index: 1;
}

.hp-mobile-designer #wcdp-zoom-canvas-container {
	display: none !important; /* declutter; zoom remains available in WCDP if needed later */
}

/* Front / Back: clear, tappable side controls under the preview */
.hp-mobile-designer #wcdp-canvas-thumbs-container {
	gap: 20px;
}

.hp-mobile-designer #wcdp-canvas-thumbs-container > div {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 72px;
	min-height: 72px;
	padding: 6px 10px;
	border-radius: 14px;
	border: 2px solid transparent;
	background: var(--hp-surface);
	box-shadow: 0 1px 2px rgba(36, 36, 36, 0.06);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.hp-mobile-designer #wcdp-canvas-thumbs-container > div.dp-canvas-active {
	border-color: var(--hp-pink);
	box-shadow: 0 0 0 2px rgba(255, 57, 163, 0.15);
}

.hp-mobile-designer #wcdp-canvas-thumbs-container img {
	width: 48px !important;
	max-width: 48px !important;
	border-radius: 6px;
}

.hp-mobile-designer #wcdp-canvas-thumbs-container label {
	font-family: var(--hp-font);
	font-size: 12px !important;
	font-weight: 600;
	color: var(--hp-text);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* -------------------------------------------------------------------------
   Bottom editing toolbar
   ------------------------------------------------------------------------- */

.hp-mobile-toolbar {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: calc(var(--hp-purchase-height) + env(safe-area-inset-bottom, 0px));
	z-index: 10040;
	height: var(--hp-toolbar-height);
	padding: 0 4px;
	background: var(--hp-surface);
	border-top: 1px solid var(--hp-border);
	box-shadow: 0 -4px 16px rgba(36, 36, 36, 0.06);
	font-family: var(--hp-font);
}

.hp-mobile-designer .hp-mobile-toolbar {
	display: flex;
	align-items: stretch;
	justify-content: space-around;
}

.hp-mobile-toolbar__btn {
	appearance: none;
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-width: 44px;
	min-height: 44px;
	margin: 0;
	padding: 4px 2px;
	border: 0;
	border-radius: 12px;
	background: transparent;
	color: var(--hp-text-muted);
	cursor: pointer;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.1;
	-webkit-tap-highlight-color: transparent;
}

.hp-mobile-toolbar__btn svg {
	width: 22px;
	height: 22px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.hp-mobile-toolbar__btn.is-active,
.hp-mobile-toolbar__btn:focus-visible {
	color: var(--hp-pink);
	background: rgba(255, 57, 163, 0.08);
	outline: none;
}

/* -------------------------------------------------------------------------
   Purchase bar
   ------------------------------------------------------------------------- */

.hp-mobile-purchase {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10045;
	min-height: calc(var(--hp-purchase-height) + env(safe-area-inset-bottom, 0px));
	padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
	background: var(--hp-surface);
	border-top: 1px solid var(--hp-border);
	font-family: var(--hp-font);
	box-sizing: border-box;
}

.hp-mobile-designer .hp-mobile-purchase {
	display: flex;
	align-items: center;
	gap: 12px;
}

.hp-mobile-purchase__meta {
	flex: 1 1 auto;
	min-width: 0;
}

.hp-mobile-purchase__price {
	display: block;
	font-size: 18px;
	font-weight: 700;
	color: var(--hp-text);
	line-height: 1.2;
}

.hp-mobile-purchase__price .woocommerce-Price-amount,
.hp-mobile-purchase__price .amount {
	font-weight: 700;
}

.hp-mobile-purchase__summary {
	display: block;
	margin-top: 2px;
	font-size: 12px;
	color: var(--hp-text-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hp-mobile-purchase__cta {
	appearance: none;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 132px;
	min-height: 48px;
	padding: 0 18px;
	border: 0;
	border-radius: 999px;
	background: var(--hp-pink);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	cursor: pointer;
	box-shadow: 0 4px 12px rgba(255, 57, 163, 0.28);
}

.hp-mobile-purchase__cta:hover,
.hp-mobile-purchase__cta:focus-visible {
	background: #e0278e;
	outline: none;
}

.hp-mobile-purchase__cta:disabled,
.hp-mobile-purchase__cta.is-busy {
	opacity: 0.55;
	pointer-events: none;
}

/* -------------------------------------------------------------------------
   Bottom sheet chrome — native WCDP panel is repositioned into this frame.
   ------------------------------------------------------------------------- */

.hp-mobile-sheet-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 10055;
	background: rgba(36, 36, 36, 0.35);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.hp-mobile-designer.hp-sheet-is-open .hp-mobile-sheet-overlay {
	display: block;
	opacity: 1;
}

.hp-mobile-sheet {
	display: none;
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 10060;
	max-height: var(--hp-sheet-max);
	background: var(--hp-surface);
	border-radius: 18px 18px 0 0;
	box-shadow: 0 -8px 28px rgba(36, 36, 36, 0.14);
	font-family: var(--hp-font);
	transform: translateY(110%);
	transition: transform 0.22s ease;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	box-sizing: border-box;
}

.hp-mobile-designer.hp-sheet-is-open .hp-mobile-sheet {
	display: flex;
	flex-direction: column;
	height: var(--hp-sheet-max);
	max-height: var(--hp-sheet-max);
	transform: translateY(0);
}

/* Keep sheet chrome above the CSS-parked WCDP panel. */
.hp-mobile-designer.hp-sheet-is-open .hp-mobile-sheet__handle,
.hp-mobile-designer.hp-sheet-is-open .hp-mobile-sheet__header {
	position: relative;
	z-index: 10070;
	background: var(--hp-surface);
}

.hp-mobile-sheet__handle {
	width: 40px;
	height: 4px;
	margin: 10px auto 4px;
	border-radius: 999px;
	background: var(--hp-border);
	flex: 0 0 auto;
}

.hp-mobile-sheet__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 12px 10px;
	border-bottom: 1px solid var(--hp-border);
	flex: 0 0 auto;
}

.hp-mobile-sheet__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	color: var(--hp-text);
}

.hp-mobile-sheet__close {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	border: 0;
	border-radius: 12px;
	background: var(--hp-surface-muted);
	color: var(--hp-text);
	cursor: pointer;
}

.hp-mobile-sheet__close svg {
	width: 20px;
	height: 20px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
}

.hp-mobile-sheet__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow: hidden;
	position: relative;
}

/*
 * When the sheet is open, JS moves #wcdp-custom-tool-panel into
 * #hp-mobile-sheet-body so it escapes the app-shell #wcdp-container
 * stacking context (z-index 10040) that otherwise hides controls under
 * the opaque sheet (z-index 10060).
 */
.hp-mobile-designer.hp-sheet-is-open #hp-mobile-sheet-body #wcdp-custom-tool-panel,
.hp-mobile-designer.hp-sheet-is-open #wcdp-custom-tool-panel {
	position: absolute !important;
	left: 0 !important;
	right: 0 !important;
	top: 0 !important;
	bottom: 0 !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0 !important;
	height: auto !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 8px 12px !important;
	overflow: auto !important;
	-webkit-overflow-scrolling: touch;
	z-index: 1 !important;
	pointer-events: auto !important;
	background: var(--hp-surface) !important;
	border-radius: 0 !important;
	box-sizing: border-box !important;
}

.hp-mobile-designer.hp-sheet-is-open #wcdp-vertical-tab {
	display: flex !important;
	flex-direction: column !important;
	width: 100% !important;
	min-width: 0 !important;
	height: auto !important;
}

.hp-mobile-designer.hp-sheet-is-open #wcdp-tabs-icons {
	display: none !important; /* our toolbar replaces tab icons */
}

.hp-mobile-designer.hp-sheet-is-open #wcdp-tabs-content {
	width: 100% !important;
	min-height: 0 !important;
	height: auto !important;
	max-height: none !important;
	background: transparent !important;
}

.hp-mobile-designer.hp-sheet-is-open #wcdp-box-options-btn {
	display: none !important; /* ATC lives in purchase bar */
}

.hp-mobile-designer.hp-sheet-is-open .wcdp-tab-section {
	padding-bottom: 16px;
}

/* Soft accent for sheet open state on mint/yellow chips if present */
.hp-mobile-designer .hp-mobile-toolbar__btn[data-hp-sheet="product"].is-active {
	color: #0b6b4a;
	background: rgba(119, 255, 201, 0.35);
}

.hp-mobile-designer .hp-mobile-toolbar__btn[data-hp-sheet="designs"].is-active {
	color: #8a6200;
	background: rgba(254, 200, 92, 0.35);
}

/* Keyboard: lift sheet when visualViewport shrinks (JS sets --hp-vv-offset).
   Panel is reparented inside the sheet, so it follows automatically. */
.hp-mobile-designer.hp-sheet-is-open.hp-keyboard-open .hp-mobile-sheet {
	bottom: var(--hp-vv-offset, 0px) !important;
}

@media (min-width: 900px) {
	.hp-mobile-toolbar,
	.hp-mobile-purchase,
	.hp-mobile-sheet,
	.hp-mobile-sheet-overlay {
		display: none !important;
	}
}
