/**
 * Pawshtails sizing chat widget — harness PDP only.
 * See inc/sizing-chat.php for the rendered markup.
 * All selectors are prefixed `.psc-` so this can't bleed into
 * other components.
 */

:root {
	--psc-orange:      #FF6B35;
	--psc-orange-dark: #e55a24;
	--psc-cream:       #FFF8F0;
	--psc-ink:         #1a1a1a;
	--psc-mute:        #5e5a55;
	--psc-rule:        #e8e4dd;
	--psc-surface:     #ffffff;
	--psc-success:     #1e7a3d;
	--psc-success-bg:  #e7f7ec;
	--psc-error:       #b32d1e;
	--psc-error-bg:    #fdecea;
	--psc-font-body:   'Sen', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
	--psc-font-display:'Allenoire', 'Fraunces', Georgia, serif;
	--psc-font-script: 'Caveat', cursive;
}

/* ------------ Floating launcher ------------ */
/* Positioned at BOTTOM-LEFT (not bottom-right) because Klaviyo's
 * marketing popups and minimised tabs anchor to bottom-right by
 * convention — keeping the sizing launcher on the left avoids
 * any current or future clash with Klaviyo's UI. */
.psc-launcher {
	position: fixed;
	bottom: max(18px, env(safe-area-inset-bottom, 0px));
	left:  max(18px, env(safe-area-inset-left, 0px));
	background: var(--psc-orange);
	color: #fff;
	border: 0;
	border-radius: 999px;
	padding: 12px 20px 12px 16px;
	font-family: var(--psc-font-body);
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-shadow: 0 8px 24px rgba(255, 107, 53, 0.35);
	z-index: 9998;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	animation: psc-pulse 2.6s ease-in-out infinite;
}
.psc-launcher svg { width: 18px; height: 18px; }
.psc-launcher:hover {
	background: var(--psc-orange-dark);
	transform: translateY(-2px);
	box-shadow: 0 12px 32px rgba(255, 107, 53, 0.45);
}
.psc-launcher[aria-expanded="true"] {
	animation: none;
}
@keyframes psc-pulse {
	0%, 100% { transform: translateY(0); }
	50%      { transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
	.psc-launcher { animation: none; }
}

/* ------------ Panel ------------ */
/* Explicitly respect the [hidden] attribute. Without this, my own
 * .psc-panel { display: flex } rule beats the UA's [hidden]{display:none}
 * via specificity (class > attribute), which leaves the panel in the
 * DOM at opacity:0 but still receiving clicks — so tapping the launcher
 * area actually hits one of the panel's file-upload labels underneath,
 * opening the file dialog instead of opening the chat. */
.psc-panel[hidden] { display: none !important; }
.psc-panel {
	position: fixed;
	bottom: max(18px, env(safe-area-inset-bottom, 0px));
	left:   max(18px, env(safe-area-inset-left, 0px));
	width: min(400px, calc(100vw - 32px));
	max-height: min(640px, calc(100vh - 36px));
	background: var(--psc-surface);
	border-radius: 16px;
	border: 1px solid var(--psc-rule);
	overflow: hidden;
	box-shadow: 0 20px 48px rgba(0, 0, 0, 0.18);
	z-index: 9999;
	display: flex;
	flex-direction: column;
	transform: translateY(12px) scale(0.98);
	opacity: 0;
	transition: transform 0.2s ease, opacity 0.2s ease;
	font-family: var(--psc-font-body);
}
.psc-panel.psc-panel-open {
	transform: translateY(0) scale(1);
	opacity: 1;
}
@media (max-width: 480px) {
	.psc-panel {
		width: calc(100vw - 16px);
		left: 8px;
		right: auto;
		bottom: 8px;
		max-height: 90vh;
		border-radius: 14px;
	}
	.psc-launcher {
		padding: 10px 16px 10px 14px;
		font-size: 13px;
		left: 12px;
		right: auto;
	}
}

/* ------------ Head ------------ */
.psc-head {
	background: var(--psc-ink);
	color: #fff;
	padding: 16px 18px;
	display: flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
}
.psc-avatar {
	width: 36px; height: 36px;
	border-radius: 50%;
	background: var(--psc-orange);
	font-family: var(--psc-font-script);
	font-size: 24px;
	font-weight: 700;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	flex-shrink: 0;
}
.psc-head-text { min-width: 0; }
.psc-title {
	font-family: var(--psc-font-display);
	font-size: 16px;
	line-height: 1.2;
	font-weight: 500;
}
.psc-sub {
	font-size: 12px;
	opacity: 0.75;
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 1px;
}
.psc-online-dot {
	width: 7px; height: 7px;
	background: #4ade80;
	border-radius: 50%;
	display: inline-block;
}
.psc-close {
	margin-left: auto;
	background: transparent;
	border: 0;
	color: #fff;
	opacity: 0.65;
	cursor: pointer;
	padding: 4px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	transition: opacity 0.15s;
}
.psc-close svg { width: 20px; height: 20px; }
.psc-close:hover { opacity: 1; }

/* ------------ Body ------------ */
.psc-body {
	padding: 18px;
	background: var(--psc-cream);
	overflow-y: auto;
	flex: 1;
}
.psc-bubble {
	background: var(--psc-surface);
	border-radius: 12px;
	padding: 14px 16px;
	margin-bottom: 14px;
	font-size: 14px;
	line-height: 1.55;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	color: var(--psc-ink);
}
.psc-bubble p { margin: 0 0 8px; }
.psc-bubble p:last-child { margin-bottom: 0; }
.psc-bubble strong { color: var(--psc-ink); }
.psc-bubble-sub {
	font-size: 12.5px;
	color: var(--psc-mute);
	margin-top: 10px;
	padding-top: 10px;
	border-top: 1px dashed var(--psc-rule);
}
.psc-side-note {
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--psc-mute);
	padding: 10px 14px;
	background: rgba(255, 107, 53, 0.08);
	border-radius: 6px;
	margin-bottom: 16px;
}
.psc-side-note strong { color: var(--psc-ink); font-weight: 600; }

/* ------------ Form ------------ */
.psc-form { margin: 0; }
.psc-field { margin-bottom: 10px; }
.psc-field-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-bottom: 10px;
}
.psc-label {
	display: block;
	font-size: 12px;
	font-weight: 700;
	color: var(--psc-ink);
	margin-bottom: 4px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.psc-optional {
	font-weight: 400;
	color: var(--psc-mute);
	font-size: 12px;
	font-style: italic;
	text-transform: none;
	letter-spacing: 0;
	margin-left: 4px;
}
.psc-form input[type="text"],
.psc-form input[type="email"],
.psc-form input[type="number"],
.psc-form textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1.5px solid var(--psc-rule);
	border-radius: 8px;
	background: var(--psc-surface);
	color: var(--psc-ink);
	font-family: inherit;
	font-size: 14px;
	line-height: 1.4;
}
.psc-form input:focus, .psc-form textarea:focus {
	outline: 0;
	border-color: var(--psc-orange);
	box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.15);
}
.psc-form textarea { resize: vertical; min-height: 68px; }

/* ------------ Upload slots ------------ */
.psc-upload-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
	margin-bottom: 14px;
}
.psc-upload {
	display: block;
	cursor: pointer;
	position: relative;
	margin: 0;
}
.psc-upload-inner {
	background: var(--psc-surface);
	border: 2px dashed var(--psc-rule);
	border-radius: 10px;
	padding: 16px 10px 14px;
	text-align: center;
	font-size: 12px;
	color: var(--psc-mute);
	transition: border-color 0.15s, background 0.15s;
}
.psc-upload:hover .psc-upload-inner {
	border-color: var(--psc-orange);
	background: var(--psc-cream);
}
.psc-upload-inner svg {
	width: 28px; height: 28px;
	color: var(--psc-orange);
	margin-bottom: 6px;
}
.psc-upload-label {
	font-weight: 700;
	color: var(--psc-ink);
	font-size: 13px;
	margin-top: 2px;
}
.psc-upload-hint { font-size: 11.5px; color: var(--psc-mute); }
.psc-upload-preview {
	border: 2px solid var(--psc-orange);
	border-radius: 10px;
	overflow: hidden;
	background: #000;
	position: relative;
}
.psc-upload-preview img {
	display: block;
	width: 100%;
	height: 110px;
	object-fit: cover;
	background: #000;
}
.psc-upload-swap {
	position: absolute;
	top: 6px;
	right: 6px;
	background: rgba(255, 255, 255, 0.92);
	color: var(--psc-ink);
	border: 0;
	padding: 4px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
}

/* ------------ Error + send ------------ */
.psc-error {
	margin: 10px 0;
	padding: 10px 12px;
	background: var(--psc-error-bg);
	color: var(--psc-error);
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
}
.psc-send {
	width: 100%;
	margin-top: 8px;
	padding: 14px;
	background: var(--psc-orange);
	color: #fff;
	border: 0;
	border-radius: 999px;
	font-family: inherit;
	font-weight: 700;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.15s;
}
.psc-send:hover { background: var(--psc-orange-dark); }
.psc-send:disabled { opacity: 0.65; cursor: not-allowed; }

/* ------------ Confirmation state ------------ */
.psc-confirm {
	text-align: center;
	padding: 20px 4px;
}
.psc-tick {
	width: 56px; height: 56px;
	background: var(--psc-success);
	color: #fff;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 14px;
}
.psc-tick svg { width: 28px; height: 28px; }
.psc-confirm-title {
	font-family: var(--psc-font-display);
	font-size: 20px;
	font-weight: 500;
	margin: 0 0 8px;
	color: var(--psc-ink);
}
.psc-confirm-text {
	color: var(--psc-mute);
	font-size: 14px;
	margin: 0 0 20px;
	line-height: 1.5;
}
.psc-confirm-text strong { color: var(--psc-ink); }
.psc-fasttrack {
	background: var(--psc-cream);
	border: 1.5px solid var(--psc-orange);
	border-radius: 12px;
	padding: 16px 18px;
	text-align: left;
}
.psc-fasttrack-headline {
	font-family: var(--psc-font-script);
	font-size: 22px;
	color: var(--psc-orange);
	line-height: 1;
	margin-bottom: 8px;
}
.psc-fasttrack-body {
	font-size: 13px;
	color: var(--psc-ink);
	margin: 0 0 12px;
	line-height: 1.55;
}
.psc-fasttrack-btn {
	display: inline-block;
	padding: 10px 18px;
	background: var(--psc-orange);
	color: #fff;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
	transition: background 0.15s;
}
.psc-fasttrack-btn:hover {
	background: var(--psc-orange-dark);
	color: #fff;
}

@media (prefers-color-scheme: dark) { /* keep widget in light look — chat looks wrong in dark */ }
