/* =====================================================================
   Wingo Logistics Tracking — UI v1.2
   ===================================================================== */

.wingo-tracking-box {
	--wgt-primary:        #ea580c;
	--wgt-primary-dark:   #c2410c;
	--wgt-primary-soft:   rgba(234, 88, 12, .12);
	--wgt-text:           #0f172a;
	--wgt-text-soft:      #475569;
	--wgt-muted:          #64748b;
	--wgt-border:         #e5e7eb;
	--wgt-border-soft:    #f1f5f9;
	--wgt-surface:        #ffffff;
	--wgt-surface-alt:    #f8fafc;
	--wgt-shadow:         0 10px 30px -12px rgba(15, 23, 42, .15);
	--wgt-radius:         16px;
	--wgt-radius-sm:      10px;

	max-width: 860px;
	margin: 28px auto;
	padding: 28px;
	background: var(--wgt-surface);
	border: 1px solid var(--wgt-border);
	border-radius: var(--wgt-radius);
	box-shadow: var(--wgt-shadow);
	font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	color: var(--wgt-text);
	line-height: 1.5;
}

/* SVG icon defaults — defensive override for themes that style svg { width:100% } */
.wingo-tracking-box svg,
.wingo-tracking-box .wgt-icon {
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
	max-width: none;
	max-height: none;
	width: 16px;
	height: 16px;
	fill: none;
	stroke: currentColor;
	overflow: visible;
}
.wingo-tracking-box .wgt-icon-search { width: 18px; height: 18px; }

.wingo-tracking-title {
	margin: 0 0 4px;
	font-size: 22px;
	font-weight: 700;
	text-align: center;
	color: var(--wgt-text);
}
.wingo-tracking-subtitle {
	margin: 0 0 20px;
	text-align: center;
	font-size: 13.5px;
	color: var(--wgt-muted);
}

/* ---------- Form ---------- */

.wingo-tracking-form {
	display: flex;
	gap: 10px;
	flex-wrap: wrap;
	align-items: stretch;
}

.wingo-tracking-field {
	position: relative;
	flex: 1 1 260px;
	display: flex;
	align-items: center;
}
.wingo-tracking-field .wgt-icon-search {
	position: absolute;
	left: 14px;
	width: 18px;
	height: 18px;
	color: var(--wgt-muted);
	pointer-events: none;
}
.wingo-tracking-field .wgt-clear {
	position: absolute;
	right: 8px;
	width: 28px;
	height: 28px;
	display: none;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 0;
	border-radius: 50%;
	color: var(--wgt-muted);
	cursor: pointer;
	transition: background .15s, color .15s;
}
.wingo-tracking-field .wgt-clear:hover {
	background: var(--wgt-border-soft);
	color: var(--wgt-text);
}
.wingo-tracking-field.has-value .wgt-clear { display: inline-flex; }

.wingo-tracking-input {
	width: 100%;
	padding: 13px 40px 13px 16px;
	background: var(--wgt-surface);
	border: 1px solid var(--wgt-border);
	border-radius: 14px !important;
	font-size: 15px;
	color: var(--wgt-text);
	outline: none;
	transition: border-color .15s, box-shadow .15s, background .15s;
	-webkit-appearance: none;
	appearance: none;
}
.wingo-tracking-input::placeholder { color: var(--wgt-muted); }
.wingo-tracking-input:hover { border-color: #cbd5e1; }
.wingo-tracking-input:focus {
	border-color: var(--wgt-primary);
	box-shadow: 0 0 0 4px var(--wgt-primary-soft);
}

.wingo-tracking-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 22px;
	min-height: 48px;
	background: var(--wgt-primary);
	color: #fff;
	border: 0;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s, transform .05s, box-shadow .15s;
	box-shadow: 0 6px 14px -6px rgba(234, 88, 12, .55);
}
.wingo-tracking-btn:hover  { background: var(--wgt-primary-dark); }
.wingo-tracking-btn:active { transform: translateY(1px); }
.wingo-tracking-btn:disabled {
	opacity: .65;
	cursor: not-allowed;
	box-shadow: none;
}
.wingo-tracking-btn .wgt-icon { width: 16px; height: 16px; }

/* ---------- Status ---------- */

.wingo-tracking-status {
	margin-top: 14px;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--wgt-text-soft);
	min-height: 22px;
}
.wingo-tracking-status:empty { display: none; }
.wingo-tracking-status.is-error {
	color: #b91c1c;
	padding: 10px 14px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: var(--wgt-radius-sm);
	min-height: 0;
}
.wingo-tracking-status .wgt-icon { width: 16px; height: 16px; flex-shrink: 0; }

.wingo-tracking-spinner {
	display: inline-block;
	width: 14px; height: 14px;
	border: 2px solid var(--wgt-border);
	border-top-color: var(--wgt-primary);
	border-radius: 50%;
	animation: wgt-spin .7s linear infinite;
	flex-shrink: 0;
}
@keyframes wgt-spin { to { transform: rotate(360deg); } }

/* ---------- Skeleton loader ---------- */

.wgt-skeleton {
	margin-top: 18px;
	padding: 20px;
	background: var(--wgt-surface-alt);
	border: 1px solid var(--wgt-border);
	border-radius: var(--wgt-radius);
}
.wgt-sk-line {
	height: 12px;
	border-radius: 6px;
	background: linear-gradient(90deg, var(--wgt-border-soft) 0%, var(--wgt-border) 50%, var(--wgt-border-soft) 100%);
	background-size: 200% 100%;
	animation: wgt-shimmer 1.4s linear infinite;
	margin-bottom: 10px;
}
.wgt-sk-line.w-40 { width: 40%; }
.wgt-sk-line.w-60 { width: 60%; }
.wgt-sk-line.w-80 { width: 80%; }
.wgt-sk-line.h-lg { height: 22px; }
.wgt-sk-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0; }
.wgt-sk-block {
	height: 96px; border-radius: var(--wgt-radius-sm);
	background: linear-gradient(90deg, var(--wgt-border-soft) 0%, var(--wgt-border) 50%, var(--wgt-border-soft) 100%);
	background-size: 200% 100%;
	animation: wgt-shimmer 1.4s linear infinite;
}
@keyframes wgt-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}

/* ---------- Result card ---------- */

.wingo-tracking-result:empty { display: none; }
.wgt-card {
	margin-top: 20px;
	background: var(--wgt-surface-alt);
	border: 1px solid var(--wgt-border);
	border-radius: var(--wgt-radius);
	padding: 22px;
	animation: wgt-fade-in .35s ease-out;
}
@keyframes wgt-fade-in {
	from { opacity: 0; transform: translateY(6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.wgt-header {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	padding-bottom: 18px;
	border-bottom: 1px dashed var(--wgt-border);
}
.wgt-id-label {
	display: block;
	font-size: 11.5px;
	color: var(--wgt-muted);
	text-transform: uppercase;
	letter-spacing: .06em;
	margin-bottom: 4px;
}
.wgt-id-value {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 19px;
	font-weight: 700;
	color: var(--wgt-text);
	letter-spacing: .01em;
}
.wgt-copy {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	background: transparent;
	border: 1px solid var(--wgt-border);
	border-radius: 8px;
	color: var(--wgt-muted);
	cursor: pointer;
	transition: all .15s;
}
.wgt-copy:hover { color: var(--wgt-primary); border-color: var(--wgt-primary); }
.wgt-copy.is-copied { color: #16a34a; border-color: #16a34a; }
.wgt-copy .wgt-icon { width: 14px; height: 14px; }

.wgt-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 14px;
	border-radius: 999px;
	font-size: 13px;
	font-weight: 600;
	background: #e2e8f0;
	color: #334155;
	white-space: nowrap;
}
.wgt-badge::before {
	content: "";
	width: 8px; height: 8px;
	border-radius: 50%;
	background: currentColor;
	opacity: .85;
}
.wgt-badge--delivered { background: #dcfce7; color: #15803d; }
.wgt-badge--out       { background: #ffedd5; color: #c2410c; }
.wgt-badge--transit,
.wgt-badge--customs   { background: #dbeafe; color: #1d4ed8; }
.wgt-badge--picked    { background: #ede9fe; color: #6d28d9; }
.wgt-badge--draft     { background: #f1f5f9; color: #475569; }
.wgt-badge--failed,
.wgt-badge--returned  { background: #fee2e2; color: #b91c1c; }

/* ---------- Progress stepper ---------- */

.wgt-stepper {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 0;
	margin: 22px 0 6px;
	padding: 4px 0;
}
.wgt-step {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 8px;
	font-size: 12px;
	color: var(--wgt-muted);
}
.wgt-step::before,
.wgt-step::after {
	content: "";
	position: absolute;
	top: 17px;
	height: 3px;
	background: var(--wgt-border);
	z-index: 0;
}
.wgt-step::before { left: 0;  right: 50%; }
.wgt-step::after  { left: 50%; right: 0;  }
.wgt-step:first-child::before { display: none; }
.wgt-step:last-child::after   { display: none; }

.wgt-step-icon {
	position: relative;
	z-index: 1;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: var(--wgt-surface);
	border: 2px solid var(--wgt-border);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--wgt-muted);
	transition: all .25s;
}
.wgt-step-icon .wgt-icon { width: 16px; height: 16px; }

.wgt-step.is-done .wgt-step-icon,
.wgt-step.is-active .wgt-step-icon {
	background: var(--wgt-primary);
	border-color: var(--wgt-primary);
	color: #fff;
}
.wgt-step.is-done::before,
.wgt-step.is-done::after,
.wgt-step.is-active::before {
	background: var(--wgt-primary);
}
.wgt-step.is-active .wgt-step-icon {
	box-shadow: 0 0 0 5px var(--wgt-primary-soft);
}
.wgt-step.is-active .wgt-step-label {
	color: var(--wgt-primary);
	font-weight: 600;
}
.wgt-step.is-failed .wgt-step-icon {
	background: #ef4444;
	border-color: #ef4444;
	color: #fff;
}
.wgt-step.is-failed .wgt-step-label { color: #b91c1c; font-weight: 600; }

.wgt-step-label {
	line-height: 1.25;
	max-width: 110px;
}

/* ---------- Info grid ---------- */

.wgt-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 14px;
	margin: 20px 0 4px;
}
.wgt-panel {
	background: var(--wgt-surface);
	border: 1px solid var(--wgt-border);
	border-radius: var(--wgt-radius-sm);
	padding: 16px 18px;
}
.wgt-panel h4 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 12px;
	font-size: 13px;
	font-weight: 700;
	color: var(--wgt-primary);
	text-transform: uppercase;
	letter-spacing: .05em;
}
.wgt-panel h4 .wgt-icon { width: 16px; height: 16px; }

.wgt-list { list-style: none; margin: 0; padding: 0; }
.wgt-list li {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid var(--wgt-border-soft);
	font-size: 14px;
}
.wgt-list li:last-child { border-bottom: 0; }
.wgt-list span { color: var(--wgt-muted); flex-shrink: 0; }
.wgt-list strong {
	color: var(--wgt-text);
	text-align: right;
	font-weight: 600;
	word-break: break-word;
}

/* ---------- Timeline ---------- */

.wgt-history-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 22px 0 14px;
	gap: 12px;
	flex-wrap: wrap;
}
.wgt-history-title {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: var(--wgt-primary);
	text-transform: uppercase;
	letter-spacing: .05em;
}
.wgt-history-toggle {
	background: transparent;
	border: 1px solid var(--wgt-border);
	color: var(--wgt-text-soft);
	border-radius: 8px;
	padding: 6px 12px;
	font-size: 12.5px;
	cursor: pointer;
	transition: all .15s;
}
.wgt-history-toggle:hover { color: var(--wgt-primary); border-color: var(--wgt-primary); }

.wgt-timeline {
	list-style: none;
	margin: 0;
	padding: 4px 0 0 8px;
	position: relative;
}
.wgt-timeline::before {
	content: "";
	position: absolute;
	left: 14px;
	top: 10px;
	bottom: 10px;
	width: 2px;
	background: linear-gradient(180deg, var(--wgt-primary), var(--wgt-border));
}
.wgt-timeline-item {
	position: relative;
	padding: 4px 0 18px 38px;
}
.wgt-timeline-item:last-child { padding-bottom: 4px; }
.wgt-timeline-dot {
	position: absolute;
	left: 7px;
	top: 6px;
	width: 16px; height: 16px;
	border-radius: 50%;
	background: var(--wgt-surface);
	border: 2px solid #cbd5e1;
	z-index: 1;
	transition: all .2s;
}
.wgt-timeline-item.is-current .wgt-timeline-dot {
	background: var(--wgt-primary);
	border-color: var(--wgt-primary);
	box-shadow: 0 0 0 5px var(--wgt-primary-soft);
}
.wgt-tl--delivered .wgt-timeline-dot { border-color: #16a34a; background: #16a34a; }
.wgt-tl--out       .wgt-timeline-dot { border-color: #f97316; background: #f97316; }
.wgt-tl--transit   .wgt-timeline-dot,
.wgt-tl--customs   .wgt-timeline-dot { border-color: #3b82f6; background: #3b82f6; }
.wgt-tl--picked    .wgt-timeline-dot { border-color: #8b5cf6; background: #8b5cf6; }
.wgt-tl--failed    .wgt-timeline-dot,
.wgt-tl--returned  .wgt-timeline-dot { border-color: #ef4444; background: #ef4444; }
.wgt-timeline-item.is-current .wgt-timeline-dot { background: var(--wgt-primary); border-color: var(--wgt-primary); }

.wgt-timeline-status {
	display: inline-block;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--wgt-muted);
	margin-bottom: 2px;
}
.wgt-timeline-item.is-current .wgt-timeline-status { color: var(--wgt-primary); }

.wgt-timeline-detail {
	font-size: 14.5px;
	font-weight: 600;
	color: var(--wgt-text);
	line-height: 1.45;
}
.wgt-timeline-meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin-top: 4px;
	font-size: 13px;
	color: var(--wgt-muted);
}
.wgt-timeline-meta .wgt-icon { width: 13px; height: 13px; vertical-align: -2px; }
.wgt-timeline-loc { margin-left: 0; }
.wgt-timeline-rel {
	font-size: 12px;
	color: var(--wgt-muted);
	font-style: italic;
}

.wgt-timeline.is-collapsed .wgt-timeline-item:not(.is-current):nth-child(n+4) {
	display: none;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
	.wingo-tracking-box { padding: 18px; margin: 16px auto; border-radius: 12px; }
	.wingo-tracking-title { font-size: 19px; }
	.wgt-card { padding: 16px; }
	.wgt-id-value { font-size: 17px; }
	.wgt-step-label { font-size: 10.5px; max-width: 64px; }
	.wgt-step-icon { width: 30px; height: 30px; }
	.wgt-step::before, .wgt-step::after { top: 14px; }
	.wingo-tracking-btn { flex: 1 1 100%; }
}
