/*
 * Teja Mehendi - order tracking (thank-you page, customer emails use inline styles, public [tm_track_order] page).
 * Palette from main.css: cream #fcf5ea, paper #fff9f0, blush #f7e0d3, henna #a8412a, henna-deep #8a2f22, brown #5e3326.
 * Contrast: brown on paper ~11:1, henna-deep on paper ~8:1, white on henna ~6:1, error red #a11d1d on paper ~7:1.
 * Form fields reuse .form-card / .field from main.css; everything new is prefixed tm-track.
 */

.tm-track-form,
.tm-track-result {
	max-width: 760px;
	margin: 0 auto 28px;
}

.tm-track-fields {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px 20px;
	margin-bottom: 18px;
}

.tm-track-msg {
	margin: 0 0 18px;
	padding: 12px 14px;
	border: 1.5px solid #a11d1d;
	border-radius: 12px;
	background: #fff6f4;
	color: #7a1515;
	font-weight: 500;
	line-height: 1.5;
}

/* Result header */
.tm-track-result__title { margin: 0 0 4px; font-size: 1.7rem; }
.tm-track-result__meta { margin: 0 0 22px; color: var(--brown, #5e3326); font-size: .95rem; }
.tm-track-h3 { margin: 26px 0 10px; font-size: 1.25rem; color: var(--henna-deep, #8a2f22); }

/* Progress steps */
.tm-track-steps {
	list-style: none;
	margin: 0 0 8px;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0;
}
.tm-track-steps__item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	padding: 0 4px;
	color: var(--brown, #5e3326);
	font-size: .9rem;
	line-height: 1.3;
}
.tm-track-steps__item::before {
	content: "";
	position: absolute;
	top: 15px;
	left: -50%;
	width: 100%;
	height: 3px;
	background: var(--blush, #f7e0d3);
	z-index: 0;
}
.tm-track-steps__item:first-child::before { display: none; }
.tm-track-steps__item.is-done::before,
.tm-track-steps__item.is-current::before { background: var(--henna, #a8412a); }
.tm-track-steps__dot {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin-bottom: 8px;
	border-radius: 50%;
	border: 2px solid var(--henna, #a8412a);
	background: var(--paper, #fff9f0);
	color: #fff;
	font-size: .9rem;
	font-weight: 600;
}
/* Three states, not colour alone: done = solid dot + check; current = paper dot, thick double ring, step number, bold label; pending = empty thin outline. */
.tm-track-steps__item.is-done .tm-track-steps__dot { background: var(--henna, #a8412a); }
.tm-track-steps__item.is-current .tm-track-steps__dot {
	width: 38px;
	height: 38px;
	margin: -3px 0 5px;
	background: var(--paper, #fff9f0);
	border: 4px solid var(--henna-deep, #8a2f22);
	box-shadow: 0 0 0 3px var(--blush, #f7e0d3);
	color: var(--henna-deep, #8a2f22);
	font-size: 1rem;
	font-weight: 700;
}
.tm-track-steps__item:not(.is-done):not(.is-current) .tm-track-steps__dot { border: 2px solid #8a5a4a; background: transparent; }
.tm-track-steps__item:not(.is-done):not(.is-current) { color: #6f5448; }
.tm-track-steps__item.is-current .tm-track-steps__label { font-weight: 700; color: var(--henna-deep, #8a2f22); }

/* Shipment block */
.tm-track-ship {
	margin: 22px 0 0;
	padding: 18px 20px;
	background: var(--blush, #f7e0d3);
	border: 1px solid var(--line, rgba(168, 65, 42, .28));
	border-radius: 16px;
	color: var(--brown, #5e3326);
}
.tm-track-ship__title { margin: 0 0 10px; font-size: 1.25rem; color: var(--henna-deep, #8a2f22); }
.tm-track-ship__list { margin: 0 0 14px; display: grid; gap: 8px; }
.tm-track-ship__list > div { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.tm-track-ship__list dt { min-width: 140px; font-weight: 500; color: var(--henna-deep, #8a2f22); }
.tm-track-ship__list dd { margin: 0; overflow-wrap: anywhere; }
.tm-track-ship__num { font-weight: 600; letter-spacing: .04em; user-select: all; }
.tm-track-ship__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tm-track-ship__note { margin: 12px 0 0; font-size: .92rem; }
.tm-track-btn { padding: 10px 22px; font-size: .92rem; text-decoration: none; }
.tm-track-btn:focus-visible,
.tm-track-form .btn:focus-visible { outline: 3px solid var(--henna-deep, #8a2f22); outline-offset: 3px; }
.tm-track-ship .btn--ghost { background: var(--paper, #fff9f0); }
.tm-track-thanks { margin: 14px 0 0; }

/* Delhivery live status (inc/delhivery.php) */
.tm-track-live { margin: 0 0 14px; padding-top: 12px; border-top: 1px solid var(--line, rgba(168, 65, 42, .28)); }
.tm-track-live__title { margin: 0 0 6px; font-size: 1.05rem; color: var(--henna-deep, #8a2f22); }
.tm-track-live__status { margin: 0 0 8px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tm-track-live__badge { padding: 2px 12px; border-radius: 16px; background: var(--henna-deep, #8a2f22); color: #fff; font-size: .85rem; }

/* Items and notes */
.tm-track-items { margin: 0; padding: 0; list-style: none; }
.tm-track-items li { padding: 8px 0; border-bottom: 1px solid var(--line, rgba(168, 65, 42, .28)); }
.tm-track-items li:last-child { border-bottom: 0; }
.tm-track-items__qty { color: var(--henna-deep, #8a2f22); font-weight: 500; white-space: nowrap; }
.tm-track-notes { margin: 0 0 18px; padding: 0; list-style: none; }
.tm-track-notes li { padding: 10px 0; border-bottom: 1px solid var(--line, rgba(168, 65, 42, .28)); }
.tm-track-notes li:last-child { border-bottom: 0; }
.tm-track-notes__date { display: block; margin-bottom: 4px; font-size: .85rem; color: var(--muted, #7a5a4c); }
.tm-track-notes__text p { margin: 0 0 6px; max-width: none; overflow-wrap: anywhere; }
.tm-track-notes__text a { color: var(--henna-deep, #8a2f22); text-decoration: underline; text-underline-offset: 3px; }

/* Visually hidden (screen reader text) */
.tm-track-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* Narrow screens: stack the fields, make the steps a vertical list */
@media (max-width: 560px) {
	.tm-track-fields { grid-template-columns: 1fr; }
	.tm-track-form .btn,
	.tm-track-ship__actions .btn { width: 100%; }
	.tm-track-steps { grid-template-columns: 1fr; gap: 14px; }
	.tm-track-steps__item { flex-direction: row; align-items: center; text-align: left; gap: 12px; padding: 0; font-size: 1rem; }
	.tm-track-steps__item::before { display: none; }
	/* Equal 44px outer width for every dot so the labels line up: 32px + 6px each side; current 38px + 3px each side. */
	.tm-track-steps__dot { margin: 0 6px; flex: none; }
	.tm-track-steps__item.is-current .tm-track-steps__dot { margin: 0 3px; }
	.tm-track-ship__list dt { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.tm-track-steps__item.is-current .tm-track-steps__dot { box-shadow: none; }
}

/* Programmatic focus target after a lookup */
.tm-track-result[data-tm-focus]:focus,
.tm-track-msg[data-tm-focus]:focus { outline: 3px solid var(--henna-deep, #8a2f22); outline-offset: 3px; }
