/* PackSmart front-end wizard — modern & bold, mobile-first */

.packsmart-wizard {
	--ps-accent: #4f46e5;
	--ps-accent-2: #6366f1;
	--ps-accent-strong: #4338ca;
	--ps-tint: #eef2ff;
	--ps-ring: rgba(79, 70, 229, .28);
	--ps-ink: #0f172a;
	--ps-body: #334155;
	--ps-muted: #64748b;
	--ps-line: #e2e8f0;
	--ps-surface: #ffffff;
	--ps-subtle: #f8fafc;
	--ps-ok: #16a34a;
	--ps-radius: 16px;
	--ps-radius-sm: 10px;
	--ps-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px -12px rgba(15, 23, 42, .18);

	max-width: 760px;
	margin: 0 auto;
	padding: clamp(18px, 4vw, 32px);
	background: var(--ps-surface);
	border: 1px solid var(--ps-line);
	border-radius: var(--ps-radius);
	box-shadow: var(--ps-shadow);
	color: var(--ps-body);
	font-size: 15px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
}
.packsmart-wizard * { box-sizing: border-box; }

/* ---------------- Step indicator ---------------- */
.ps-steps {
	display: flex;
	list-style: none;
	padding: 0;
	margin: 0 0 26px;
	counter-reset: ps;
}
.ps-steps li {
	flex: 1;
	position: relative;
	text-align: center;
	font-size: 12px;
	font-weight: 600;
	color: var(--ps-muted);
	min-width: 0;
}
.ps-steps li::before {
	counter-increment: ps;
	content: counter(ps);
	position: relative;
	z-index: 1;
	display: block;
	width: 32px;
	height: 32px;
	line-height: 32px;
	border-radius: 50%;
	background: #fff;
	border: 2px solid var(--ps-line);
	color: var(--ps-muted);
	margin: 0 auto 8px;
	font-weight: 700;
	transition: all .25s ease;
}
/* connector line between circles */
.ps-steps li:not(:first-child)::after {
	content: '';
	position: absolute;
	top: 15px;
	left: -50%;
	width: 100%;
	height: 3px;
	background: var(--ps-line);
	z-index: 0;
	transition: background .25s ease;
}
.ps-steps li.is-active { color: var(--ps-ink); }
.ps-steps li.is-active::before {
	background: linear-gradient(135deg, var(--ps-accent), var(--ps-accent-2));
	border-color: transparent;
	color: #fff;
	box-shadow: 0 0 0 5px var(--ps-ring);
}
.ps-steps li.is-done::before {
	content: '✓';
	background: var(--ps-ok);
	border-color: transparent;
	color: #fff;
}
.ps-steps li.is-done::after,
.ps-steps li.is-active::after { background: var(--ps-accent); }
.ps-step-label { display: block; padding: 0 2px; }

/* ---------------- Panels ---------------- */
.ps-panel { display: none; animation: ps-fade .28s ease; }
.ps-panel.is-active { display: block; }
@keyframes ps-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ps-panel h3 {
	margin: 0 0 18px;
	font-size: clamp(20px, 3.4vw, 26px);
	font-weight: 800;
	letter-spacing: -.02em;
	color: var(--ps-ink);
	line-height: 1.2;
}
.ps-panel h4 { margin: 22px 0 10px; font-size: 15px; font-weight: 700; color: var(--ps-ink); }

/* ---------------- Form grid & fields ---------------- */
.ps-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ps-grid .ps-full { grid-column: 1 / -1; }
.ps-grid label, .ps-disclosure label {
	display: flex;
	flex-direction: column;
	font-size: 12.5px;
	font-weight: 600;
	color: var(--ps-body);
	gap: 5px;
}
.packsmart-wizard input,
.packsmart-wizard select,
.packsmart-wizard textarea {
	width: 100%;
	padding: 11px 13px;
	border: 1.5px solid var(--ps-line);
	border-radius: var(--ps-radius-sm);
	font-size: 15px;
	font-weight: 500;
	color: var(--ps-ink);
	background: var(--ps-surface);
	transition: border-color .15s ease, box-shadow .15s ease;
	accent-color: var(--ps-accent);
}
.packsmart-wizard input:focus,
.packsmart-wizard select:focus,
.packsmart-wizard textarea:focus {
	outline: none;
	border-color: var(--ps-accent);
	box-shadow: 0 0 0 4px var(--ps-ring);
}
.packsmart-wizard input[readonly] { background: var(--ps-subtle); color: var(--ps-muted); }
.packsmart-wizard input::placeholder { color: #94a3b8; }

/* ---------------- Buttons & actions ---------------- */
.ps-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 28px;
	gap: 12px;
}
.ps-btn {
	background: linear-gradient(135deg, var(--ps-accent), var(--ps-accent-2));
	color: #fff;
	border: 0;
	border-radius: var(--ps-radius-sm);
	padding: 13px 26px;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: -.01em;
	cursor: pointer;
	transition: transform .12s ease, box-shadow .2s ease, opacity .2s ease;
	box-shadow: 0 8px 20px -8px var(--ps-ring);
}
.ps-btn:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px var(--ps-ring); }
.ps-btn:active { transform: translateY(0); }
.ps-btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.ps-btn.is-loading { opacity: 1; pointer-events: none; }
.ps-btn.is-loading::before {
	content: '';
	display: inline-block;
	width: 15px;
	height: 15px;
	margin-right: 9px;
	vertical-align: -2px;
	border: 2px solid rgba(255, 255, 255, .55);
	border-top-color: #fff;
	border-radius: 50%;
	animation: ps-spin .7s linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }
.ps-btn.ps-ghost {
	background: #fff;
	color: var(--ps-accent);
	border: 1.5px solid var(--ps-line);
	box-shadow: none;
}
.ps-btn.ps-ghost:hover { border-color: var(--ps-accent); background: var(--ps-tint); }
.ps-link { background: none; border: 0; color: var(--ps-accent); cursor: pointer; padding: 0; font-size: 13px; font-weight: 600; text-decoration: underline; }

/* ---------------- Notices ---------------- */
.ps-error {
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
	border-radius: var(--ps-radius-sm);
	padding: 12px 14px;
	margin-bottom: 16px;
	font-weight: 600;
	font-size: 14px;
}
.ps-hidden { display: none !important; }
.ps-note { font-size: 13px; color: var(--ps-muted); }

/* ---------------- Checkbox / disclosure ---------------- */
.ps-checkbox { flex-direction: row !important; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.ps-checkbox input { width: 18px; height: 18px; flex: none; }
.ps-disclosure {
	border: 1px solid var(--ps-line);
	border-radius: var(--ps-radius);
	padding: 18px;
	margin-top: 18px;
	background: var(--ps-subtle);
}
.ps-disclosure-text { font-size: 13px; color: var(--ps-body); margin-top: 0; }
.ps-disclosure-link { font-size: 13px; margin: 0 0 14px; }
.ps-disclosure-link a { font-weight: 600; }
.ps-sign { margin-top: 14px; }
.ps-sign-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ps-body); margin-bottom: 6px; }
#ps-sign-pad { border: 2px dashed #94a3b8; border-radius: var(--ps-radius-sm); background: #fff; touch-action: none; max-width: 100%; }

/* ---------------- Selectable cards (method / options) ---------------- */
.ps-methods { display: flex; flex-direction: column; gap: 12px; }
.ps-method {
	display: flex;
	align-items: center;
	gap: 12px;
	border: 1.5px solid var(--ps-line);
	border-radius: var(--ps-radius);
	padding: 16px 18px;
	cursor: pointer;
	font-weight: 600;
	color: var(--ps-ink);
	transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.ps-method input { width: 20px; height: 20px; flex: none; margin: 0; }
.ps-method select { margin-top: 10px; }
.ps-method:hover { border-color: var(--ps-accent-2); background: var(--ps-subtle); }
.ps-method:has(input:checked) { border-color: var(--ps-accent); background: var(--ps-tint); box-shadow: 0 0 0 3px var(--ps-ring); }

/* ---------------- Supplies ---------------- */
.ps-supplies-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.ps-supply {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 14px;
	border: 1.5px solid var(--ps-line);
	border-radius: var(--ps-radius);
	transition: border-color .15s ease, box-shadow .15s ease;
}
.ps-supply.ps-supply-picked { border-color: var(--ps-accent); box-shadow: 0 0 0 3px var(--ps-ring); }
.ps-supply-img { width: 52px; height: 52px; object-fit: cover; border-radius: var(--ps-radius-sm); flex: none; }
.ps-supply-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ps-supply-name { font-weight: 700; color: var(--ps-ink); }
.ps-supply-price { font-size: 14px; font-weight: 600; color: var(--ps-accent); }
.ps-supply-dims { font-weight: 500; color: var(--ps-muted); }
.packsmart-wizard .ps-supply-qty { width: 78px; flex: none; text-align: center; }
.ps-supplies-add { margin-top: 18px; padding-top: 14px; border-top: 1px dashed #cbd5e1; }
.ps-supplies-add h4 { margin: 0 0 8px; }

.ps-code-input { letter-spacing: .5em; font-weight: 700; font-size: 20px; text-align: center; }

.ps-hint { font-weight: 400; font-size: 12px; color: var(--ps-muted); margin-top: 3px; }
.ps-fallback {
	background: #fffbeb;
	border: 1px solid #fde68a;
	border-radius: var(--ps-radius);
	padding: 22px;
	text-align: center;
}
.ps-fallback p { margin: 0 0 10px; font-weight: 600; color: #92400e; }
.ps-fallback a { font-weight: 800; font-size: 20px; color: var(--ps-accent); text-decoration: none; }

/* ---------------- Declared duty items ---------------- */
.ps-duty-picker { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.ps-duty-picker select { flex: 1; }
.ps-duty-picker .ps-btn { padding: 11px 18px; }
.ps-duty-item {
	display: flex;
	align-items: flex-end;
	gap: 14px;
	padding: 12px 0;
	border-bottom: 1px solid var(--ps-line);
}
.ps-duty-item-name { flex: 1; font-weight: 700; color: var(--ps-ink); font-size: 14px; }
.ps-duty-item label { display: flex; flex-direction: column; font-size: 11.5px; font-weight: 600; color: var(--ps-body); gap: 4px; }
.ps-duty-item input { width: 92px; }
.ps-duty-remove { color: #dc2626; text-decoration: none; font-weight: 800; padding: 0 6px; font-size: 16px; }
.ps-duty-item-name small { color: #dc2626; font-weight: 600; }

/* ---------------- Quote / price ---------------- */
.ps-options { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.ps-option {
	display: flex;
	align-items: center;
	gap: 14px;
	border: 1.5px solid var(--ps-line);
	border-radius: var(--ps-radius);
	padding: 16px 18px;
	cursor: pointer;
	transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.ps-option input { width: 20px; height: 20px; margin: 0; flex: none; }
.ps-option:hover { border-color: var(--ps-accent-2); }
.ps-option:has(input:checked) { border-color: var(--ps-accent); background: var(--ps-tint); box-shadow: 0 0 0 3px var(--ps-ring); }
.ps-option-label { font-weight: 700; color: var(--ps-ink); }
.ps-option-price { margin-left: auto; font-weight: 800; font-size: 20px; color: var(--ps-ink); letter-spacing: -.02em; }

.ps-quote-table { width: 100%; border-collapse: collapse; margin: 10px 0 4px; }
.ps-quote-table td { padding: 9px 0; border-bottom: 1px solid var(--ps-line); font-size: 14.5px; }
.ps-quote-table td:last-child { text-align: right; font-weight: 600; color: var(--ps-ink); }
.ps-quote-total td {
	border-top: 2px solid var(--ps-ink);
	border-bottom: 0;
	font-size: 22px;
	font-weight: 800;
	letter-spacing: -.02em;
	color: var(--ps-ink);
	padding-top: 12px;
}

/* ---------------- Admin-only debug ---------------- */
.ps-rates-debug { margin-top: 20px; }
.ps-rates-debug h4 { margin: 0 0 6px; font-size: 12px; color: var(--ps-muted); text-transform: uppercase; letter-spacing: .03em; }
.ps-debug-table th { text-align: left; font-size: 12px; color: var(--ps-muted); border-bottom: 1px solid var(--ps-line); padding: 4px 10px 4px 0; }
.ps-debug-table td { font-size: 13px; padding: 5px 10px 5px 0; border-bottom: 1px solid #f1f5f9; text-align: left; }
.ps-debug-table td:last-child, .ps-debug-table th:last-child { text-align: right; }
.ps-rate-cheap { background: #ecfdf5; font-weight: 700; }
.ps-route-skip td { color: #9ca3af; }
.ps-debug-note { font-size: 12px; color: var(--ps-muted); margin: 6px 0 0; }
.ps-direct-note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: var(--ps-radius-sm); padding: 8px 12px; margin-top: 12px; }
.ps-debug-pre { background: #0f172a; color: #e2e8f0; font-size: 12px; line-height: 1.4; padding: 12px; border-radius: var(--ps-radius-sm); overflow: auto; max-height: 340px; white-space: pre; }

/* ---------------- Mobile ---------------- */
@media (max-width: 600px) {
	.packsmart-wizard { padding: 16px; border-radius: 0; border-left: 0; border-right: 0; }
	.ps-grid { grid-template-columns: 1fr; gap: 12px; }

	/* Compact stepper: numbered circles only — the panel heading names the step. */
	.ps-steps { margin-bottom: 18px; }
	.ps-steps li::before { width: 28px; height: 28px; line-height: 28px; }
	.ps-steps li:not(:first-child)::after { top: 13px; }
	.ps-step-label { display: none; }

	/* Sticky action bar so Continuar is always reachable. */
	.ps-actions {
		position: sticky;
		bottom: 0;
		margin: 24px -16px 0;
		padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, .95);
		backdrop-filter: blur(8px);
		border-top: 1px solid var(--ps-line);
	}
	.ps-btn { flex: 1; padding: 14px 18px; text-align: center; }
	.ps-duty-picker .ps-btn { flex: none; }
	.ps-option-price, .ps-supply-price { font-size: 18px; }
}
