/* ==========================================================================
   NACEX Tracking – Frontend styles
   ========================================================================== */

/* Wrapper */
.nacex-trk-wrap {
	max-width: 680px;
	margin: 0 auto;
	font-family: inherit;
	width: 100%;
	box-sizing: border-box;
	padding: 0 12px;
}

.nacex-trk-title {
	font-size: 1.5em;
	margin-bottom: 1em;
}

/* ------------------------------------------------------------------
   Form
   ------------------------------------------------------------------ */
.nacex-trk-form {
	background: #f8f9fa;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 24px;
}

.nacex-trk-field label {
	display: block;
	font-weight: 600;
	margin-bottom: 8px;
	font-size: 0.95em;
	color: #1a1a2e;
}

.nacex-trk-input-row {
	display: flex;
	gap: 8px;
}

.nacex-trk-input-row input[type="text"] {
	flex: 1;
	padding: 11px 14px;
	border: 2px solid #cbd5e1;
	border-radius: 7px;
	font-size: 1em;
	transition: border-color 0.2s;
	outline: none;
	background: #fff;
	color: #1a1a2e;
}

.nacex-trk-input-row input[type="text"]:focus {
	border-color: #e2001a; /* NACEX red */
}

.nacex-trk-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 11px 20px;
	background: #e2001a;
	color: #fff;
	border: none;
	border-radius: 7px;
	font-size: 0.95em;
	font-weight: 600;
	cursor: pointer;
	transition: background 0.2s, transform 0.1s;
	white-space: nowrap;
}

.nacex-trk-btn:hover {
	background: #b8001a;
}

.nacex-trk-btn:active {
	transform: scale(0.97);
}

.nacex-trk-btn:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.nacex-trk-icon-search {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

/* Spinner */
.nacex-trk-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: nacex-spin 0.7s linear infinite;
	flex-shrink: 0;
}

.nacex-trk-btn.is-loading .nacex-trk-spinner {
	display: inline-block;
}

.nacex-trk-btn.is-loading .nacex-trk-icon-search,
.nacex-trk-btn.is-loading .nacex-trk-btn-text {
	display: none;
}

@keyframes nacex-spin {
	to { transform: rotate(360deg); }
}

.nacex-trk-hint {
	margin: 6px 0 0;
	font-size: 0.82em;
	color: #64748b;
}

/* ------------------------------------------------------------------
   Result area
   ------------------------------------------------------------------ */
.nacex-trk-result {
	margin-top: 20px;
}

/* Error message */
.nacex-trk-error {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	padding: 14px 16px;
	border: 1px solid #fca5a5;
	background: #fef2f2;
	border-radius: 8px;
	color: #991b1b;
	font-size: 0.95em;
}

.nacex-trk-error svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
	color: #ef4444;
	margin-top: 1px;
}

/* ------------------------------------------------------------------
   Status card
   ------------------------------------------------------------------ */
.nacex-trk-card {
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 1px 6px rgba(0,0,0,0.07);
	width: 100%;
}

.nacex-trk-card-header {
	padding: 18px 20px;
	background: #1a1a2e;
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 10px;
}

.nacex-trk-card-header h3 {
	margin: 0;
	font-size: 1em;
	font-weight: 600;
	color: #fff;
}

.nacex-trk-card-header .nacex-trk-num {
	font-size: 0.85em;
	color: #94a3b8;
	margin-top: 2px;
}

/* Status badge */
.nacex-trk-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 12px;
	border-radius: 999px;
	font-size: 0.82em;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
}

.nacex-trk-badge::before {
	content: '';
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: currentColor;
}

/* States */
.nacex-s-ok         { background: #dcfce7; color: #166534; }
.nacex-s-recogido   { background: #dbeafe; color: #1e40af; }
.nacex-s-transito   { background: #fef3c7; color: #92400e; }
.nacex-s-reparto    { background: #ede9fe; color: #5b21b6; }
.nacex-s-incidencia { background: #fee2e2; color: #991b1b; }
.nacex-s-unknown    { background: #f1f5f9; color: #475569; }

/* Card body */
.nacex-trk-card-body {
	padding: 20px;
	background: #fff;
}

/* Last state row */
.nacex-trk-last {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
	padding-bottom: 18px;
	margin-bottom: 18px;
	border-bottom: 1px solid #f1f5f9;
}

@media (max-width: 480px) {
	.nacex-trk-last {
		grid-template-columns: 1fr;
	}
}

.nacex-trk-last-item .nacex-trk-label {
	font-size: 0.75em;
	text-transform: uppercase;
	color: #94a3b8;
	letter-spacing: 0.05em;
	margin-bottom: 2px;
	display: block;
}

.nacex-trk-last-item .nacex-trk-value {
	font-size: 0.97em;
	font-weight: 600;
	color: #1a1a2e;
}

/* ------------------------------------------------------------------
   Timeline / History
   ------------------------------------------------------------------ */
.nacex-trk-history-title {
	font-size: 0.82em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #64748b;
	font-weight: 700;
	margin-bottom: 14px;
}

.nacex-trk-timeline {
	position: relative;
	padding-left: 26px;
	list-style: none;
	margin: 0;
	padding-top: 0;
}

.nacex-trk-history-wrap {
	max-height: 360px;
	overflow-y: auto;
	padding-right: 12px;
	position: relative;
	scrollbar-gutter: stable both-edges;
}

.nacex-trk-history-wrap::-webkit-scrollbar {
	width: 8px;
}

.nacex-trk-history-wrap::-webkit-scrollbar-thumb {
	background: rgba(100, 116, 139, 0.35);
	border-radius: 999px;
}

/* Vertical line */
.nacex-trk-timeline::before {
	content: '';
	position: absolute;
	left: 7px;
	top: 8px;
	bottom: 8px;
	width: 2px;
	background: #e2e8f0;
}

.nacex-trk-timeline-item {
	position: relative;
	margin-bottom: 16px;
}

.nacex-trk-timeline-item:last-child {
	margin-bottom: 0;
}

/* Dot */
.nacex-trk-timeline-item::before {
	content: '';
	position: absolute;
	left: -23px;
	top: 5px;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: #cbd5e1;
	border: 2px solid #fff;
	box-shadow: 0 0 0 2px #cbd5e1;
}

.nacex-trk-timeline-item.is-first::before {
	background: #e2001a;
	box-shadow: 0 0 0 2px #fca5a5;
}

.nacex-trk-tl-date {
	font-size: 0.78em;
	color: #94a3b8;
	margin-bottom: 2px;
}

.nacex-trk-tl-desc {
	font-size: 0.92em;
	color: #1a1a2e;
	font-weight: 500;
}

.nacex-trk-tl-agency {
	font-size: 0.78em;
	color: #64748b;
	margin-top: 1px;
}

/* ------------------------------------------------------------------
   Related expeditions
   ------------------------------------------------------------------ */
.nacex-trk-related-title {
	font-size: 0.82em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #64748b;
	font-weight: 700;
	margin: 18px 0 10px;
}

.nacex-trk-related-item {
	background: #f8f9fa;
	border: 1px solid #e2e8f0;
	border-radius: 7px;
	padding: 10px 14px;
	margin-bottom: 8px;
	font-size: 0.88em;
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 6px;
}

.nacex-trk-related-item .nacex-trk-badge {
	font-size: 0.75em;
}

/* ------------------------------------------------------------------
   Responsive tweaks
   ------------------------------------------------------------------ */
@media (max-width: 520px) {
	.nacex-trk-input-row {
		flex-direction: column;
	}
	.nacex-trk-btn {
		justify-content: center;
		width: 100%;
	}
	.nacex-trk-card-header {
		flex-direction: column;
		align-items: flex-start;
	}
	.nacex-trk-account-shortcut {
		padding: 0 12px 16px;
	}
}

.nacex-trk-account-shortcut {
	margin-bottom: 18px;
}

.nacex-trk-account-shortcut-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 16px;
	background: #1a1a2e;
	color: #fff;
	border-radius: 10px;
	text-decoration: none;
	font-weight: 600;
}

.nacex-trk-account-shortcut-link:hover,
.nacex-trk-account-shortcut-link:focus {
	background: #2e2e46;
}
