/**
 * Front-end tracking lookup styles.
 * Mobile-first vanilla CSS. No frameworks.
 */

.wtl-lookup {
	--wtl-primary-color: #2271b1;
	--wtl-text-color: #1e1e1e;
	--wtl-muted-color: #6b7280;
	--wtl-border-color: #e2e2e2;
	--wtl-bg-color: #ffffff;
	--wtl-error-bg: #fdecea;
	--wtl-error-color: #b3261e;
	--wtl-whatsapp-color: #25d366;
	--wtl-radius: 8px;

	box-sizing: border-box;
	max-width: 520px;
	margin: 0 auto;
	padding: 20px 16px;
	background: var(--wtl-bg-color);
	border: 1px solid var(--wtl-border-color);
	border-radius: var(--wtl-radius);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: var(--wtl-text-color);
}

.wtl-lookup *,
.wtl-lookup *::before,
.wtl-lookup *::after {
	box-sizing: inherit;
}

/* ----- Form ----- */

.wtl-lookup__form {
	width: 100%;
}

.wtl-lookup__field {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wtl-lookup__label {
	font-size: 14px;
	font-weight: 600;
}

.wtl-lookup__input-row {
	display: flex;
	flex-direction: column;
	gap: 10px;
	width: 100%;
}

.wtl-lookup__input {
	width: 100%;
	padding: 12px 14px;
	font-size: 16px; /* Prevents iOS auto-zoom on focus. */
	line-height: 1.4;
	border: 1px solid var(--wtl-border-color);
	border-radius: var(--wtl-radius);
	background: #fff;
	color: var(--wtl-text-color);
}

.wtl-lookup__input:focus {
	outline: none;
	border-color: var(--wtl-primary-color);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wtl-primary-color) 20%, transparent);
}

.wtl-lookup__submit {
	width: 100%;
	padding: 12px 18px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	color: #fff;
	background: var(--wtl-primary-color);
	border: none;
	border-radius: var(--wtl-radius);
	cursor: pointer;
	transition: opacity 0.15s ease-in-out;
}

.wtl-lookup__submit:hover {
	opacity: 0.9;
}

.wtl-lookup__submit:active {
	opacity: 0.8;
}

.wtl-lookup__hint {
	margin: 0;
	font-size: 12px;
	color: var(--wtl-muted-color);
}

/* ----- Status: loading / error ----- */

.wtl-lookup__status {
	margin-top: 14px;
}

.wtl-lookup__loading {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 14px;
	color: var(--wtl-muted-color);
}

.wtl-lookup__loading[hidden] {
	display: none;
}

.wtl-lookup__spinner {
	width: 16px;
	height: 16px;
	border: 2px solid var(--wtl-border-color);
	border-top-color: var(--wtl-primary-color);
	border-radius: 50%;
	animation: wtl-spin 0.7s linear infinite;
	flex-shrink: 0;
}

@keyframes wtl-spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

.wtl-lookup__error {
	padding: 12px 14px;
	background: var(--wtl-error-bg);
	border: 1px solid var(--wtl-error-color);
	border-radius: var(--wtl-radius);
}

.wtl-lookup__error[hidden] {
	display: none;
}

.wtl-lookup__error p {
	margin: 0;
	font-size: 14px;
	color: var(--wtl-error-color);
}

/* ----- Result card ----- */

.wtl-lookup__result {
	margin-top: 16px;
	padding: 16px;
	border: 1px solid var(--wtl-border-color);
	border-radius: var(--wtl-radius);
	background: #fafafa;
}

.wtl-lookup__result[hidden] {
	display: none;
}

.wtl-lookup__result-header {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	margin-bottom: 14px;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--wtl-border-color);
}

.wtl-lookup__result-order-id {
	font-size: 16px;
	font-weight: 700;
}

.wtl-lookup__result-status-badge {
	display: inline-block;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 600;
	color: #fff;
	background: var(--wtl-primary-color);
	border-radius: 999px;
	white-space: nowrap;
}

.wtl-lookup__result-details {
	margin: 0 0 16px 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wtl-lookup__result-row {
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding-bottom: 10px;
	border-bottom: 1px dashed var(--wtl-border-color);
}

.wtl-lookup__result-row:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

.wtl-lookup__result-row dt {
	font-size: 12px;
	font-weight: 600;
	color: var(--wtl-muted-color);
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.wtl-lookup__result-row dd {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	word-break: break-word;
}

.wtl-lookup__result-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wtl-lookup__btn {
	display: block;
	width: 100%;
	padding: 12px 16px;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	border-radius: var(--wtl-radius);
	transition: opacity 0.15s ease-in-out;
}

.wtl-lookup__btn:hover {
	opacity: 0.9;
}

.wtl-lookup__btn--track {
	color: #fff;
	background: var(--wtl-primary-color);
}

.wtl-lookup__btn--whatsapp {
	color: #fff;
	background: var(--wtl-whatsapp-color);
}

/* ----- Responsive: tablet and up ----- */

@media (min-width: 600px) {

	.wtl-lookup {
		padding: 28px 24px;
	}

	.wtl-lookup__input-row {
		flex-direction: row;
	}

	.wtl-lookup__input {
		flex: 1 1 auto;
	}

	.wtl-lookup__submit {
		width: auto;
		flex: 0 0 auto;
		white-space: nowrap;
	}

	.wtl-lookup__result-header {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.wtl-lookup__result-row {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
	}

	.wtl-lookup__result-row dt {
		flex: 0 0 auto;
	}

	.wtl-lookup__result-row dd {
		flex: 0 0 auto;
		text-align: right;
	}

	.wtl-lookup__result-actions {
		flex-direction: row;
	}

	.wtl-lookup__btn {
		width: auto;
		flex: 1 1 0;
	}
}

/* ----- Responsive: desktop ----- */

@media (min-width: 900px) {

	.wtl-lookup {
		max-width: 560px;
	}
}

/* ----------------------------------------------------------------------- */
/* Multi-order match list                                                  */
/* Shown instead of the single result card when a phone search returns     */
/* more than one order. Purely additive — does not alter any rule above.   */
/* ----------------------------------------------------------------------- */

.wtl-lookup__multi-list {
	margin-top: 16px;
}

.wtl-lookup__multi-list[hidden] {
	display: none;
}

.wtl-lookup__multi-heading {
	margin: 0 0 10px 0;
	font-size: 13px;
	font-weight: 600;
	color: var(--wtl-muted-color);
}

.wtl-lookup__multi-grid {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.wtl-lookup__mini-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 12px;
	background: #fff;
	border: 1px solid var(--wtl-border-color);
	border-radius: var(--wtl-radius);
}

.wtl-lookup__mini-card-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.wtl-lookup__mini-card-order {
	font-size: 14px;
	font-weight: 700;
}

.wtl-lookup__mini-card-status {
	display: inline-block;
	padding: 3px 9px;
	font-size: 11px;
	font-weight: 600;
	color: #fff;
	background: var(--wtl-primary-color);
	border-radius: 999px;
	white-space: nowrap;
}

.wtl-lookup__mini-card-date {
	font-size: 12px;
	color: var(--wtl-muted-color);
}

.wtl-lookup__mini-card-view {
	align-self: flex-start;
	margin-top: 2px;
	min-height: 40px;
	padding: 10px 16px;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	background: var(--wtl-primary-color);
	border: none;
	border-radius: var(--wtl-radius);
	cursor: pointer;
	transition: opacity 0.15s ease-in-out;
}

.wtl-lookup__mini-card-view:hover {
	opacity: 0.9;
}

/* Responsive grid: 2 columns from tablet up, 3 from desktop up. */

@media (min-width: 600px) {

	.wtl-lookup__multi-grid {
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 12px;
	}

	.wtl-lookup__mini-card-view {
		align-self: stretch;
		width: 100%;
	}
}

@media (min-width: 900px) {

	.wtl-lookup__multi-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* ----------------------------------------------------------------------- */
/* Result info card                                                        */
/* Shown between the result details and the action buttons. Blue variant   */
/* when a tracking number exists, grey variant when it doesn't. Purely     */
/* additive — does not alter any rule above.                               */
/* ----------------------------------------------------------------------- */

.wtl-lookup__info-card {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 14px 0;
	padding: 12px 14px;
	border: 1px solid transparent;
	border-radius: var(--wtl-radius);
}

.wtl-lookup__info-card[hidden] {
	display: none;
}

.wtl-lookup__info-icon {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-top: 1px;
}

.wtl-lookup__info-icon svg {
	display: block;
}

.wtl-lookup__info-content {
	flex: 1 1 auto;
	min-width: 0;
}

.wtl-lookup__info-title {
	margin: 0 0 4px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
}

.wtl-lookup__info-text {
	margin: 0 0 6px;
	font-size: 12.5px;
	line-height: 1.5;
}

.wtl-lookup__info-text:last-child {
	margin-bottom: 0;
}

.wtl-lookup__info-list {
	margin: 0 0 6px;
	padding-left: 18px;
	font-size: 12.5px;
	line-height: 1.6;
}

.wtl-lookup__info-list li {
	margin-bottom: 2px;
}

/* Blue variant: tracking number exists ("Parcel Telah Dipos"). */
.wtl-lookup__info-card--posted {
	background: #eff6ff;
	border-color: #bfdbfe;
}

.wtl-lookup__info-card--posted .wtl-lookup__info-icon {
	color: #2563eb;
}

.wtl-lookup__info-card--posted .wtl-lookup__info-title {
	color: #1d4ed8;
}

.wtl-lookup__info-card--posted .wtl-lookup__info-text,
.wtl-lookup__info-card--posted .wtl-lookup__info-list {
	color: #1e3a8a;
}

/* Grey variant: no tracking number yet ("Pesanan Sedang Diproses"). */
.wtl-lookup__info-card--processing {
	background: #f3f4f6;
	border-color: #e5e7eb;
}

.wtl-lookup__info-card--processing .wtl-lookup__info-icon {
	color: #6b7280;
}

.wtl-lookup__info-card--processing .wtl-lookup__info-title {
	color: #374151;
}

.wtl-lookup__info-card--processing .wtl-lookup__info-text {
	color: #4b5563;
}
