/* ============================================================
   WP TrackPlus — Styles Page de Suivi Client
   Design inspiré de ParcelPanel
   ============================================================ */

:root {
	--wpt-primary:      #2271b1;
	--wpt-primary-dark: color-mix(in srgb, var(--wpt-primary) 75%, black);
	--wpt-text:         #1a1a2e;
	--wpt-text-muted:   #6c757d;
	--wpt-border:       #e5e7eb;
	--wpt-bg:           #f8f9fa;
	--wpt-white:        #ffffff;
	--wpt-radius:       12px;
	--wpt-shadow:       0 2px 20px rgba(0,0,0,.08);
	--wpt-progress-bg:  #e5e7eb;
}

/* ─── Wrapper global ────────────────────────────────────────── */
.wpt-tracking-wrapper {
	max-width: 800px;
	margin: 40px auto;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: var(--wpt-text);
}

/* ─── En-tête ───────────────────────────────────────────────── */
.wpt-tracking-header {
	text-align: center;
	margin-bottom: 32px;
}

.wpt-logo {
	max-height: 60px;
	width: auto;
	margin-bottom: 16px;
}

.wpt-tracking-title {
	font-size: 28px;
	font-weight: 700;
	margin: 0 0 8px;
	color: var(--wpt-text);
}

.wpt-tracking-subtitle {
	color: var(--wpt-text-muted);
	font-size: 15px;
	margin: 0;
}

/* ─── Carte formulaire ──────────────────────────────────────── */
.wpt-tracking-card {
	background: var(--wpt-white);
	border: 1px solid var(--wpt-border);
	border-radius: var(--wpt-radius);
	box-shadow: var(--wpt-shadow);
	padding: 32px;
}

/* ─── Champs ────────────────────────────────────────────────── */
.wpt-field-group {
	margin-bottom: 20px;
}

.wpt-label {
	display: block;
	font-size: 14px;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--wpt-text);
}

.wpt-required {
	color: #e74c3c;
}

.wpt-input {
	width: 100%;
	padding: 12px 16px;
	font-size: 15px;
	border: 1.5px solid var(--wpt-border);
	border-radius: 8px;
	outline: none;
	transition: border-color 0.2s;
	box-sizing: border-box;
	color: var(--wpt-text);
	background: var(--wpt-white);
}

.wpt-input:focus {
	border-color: var(--wpt-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wpt-primary) 15%, transparent);
}

.wpt-input::placeholder {
	color: #adb5bd;
}

/* ─── Boutons ───────────────────────────────────────────────── */
.wpt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 13px 24px;
	font-size: 15px;
	font-weight: 600;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.2s, transform 0.1s;
}

.wpt-btn:active {
	transform: scale(0.98);
}

.wpt-btn-primary {
	width: 100%;
	background: var(--wpt-primary);
	color: var(--wpt-white);
}

.wpt-btn-primary:hover {
	background: var(--wpt-primary-dark);
	color: var(--wpt-white);
	text-decoration: none;
}

.wpt-btn-primary:disabled {
	opacity: 0.7;
	cursor: not-allowed;
}

.wpt-btn-secondary {
	background: var(--wpt-bg);
	color: var(--wpt-text);
	border: 1px solid var(--wpt-border);
	font-size: 14px;
	padding: 10px 20px;
}

.wpt-btn-secondary:hover {
	background: #e9ecef;
	text-decoration: none;
	color: var(--wpt-text);
}

.wpt-btn-track {
	background: var(--wpt-primary);
	color: var(--wpt-white);
	padding: 10px 20px;
	font-size: 14px;
	border-radius: 6px;
	white-space: nowrap;
}

.wpt-btn-track:hover {
	background: var(--wpt-primary-dark);
	color: var(--wpt-white);
	text-decoration: none;
}

/* ─── Alertes ───────────────────────────────────────────────── */
.wpt-alert {
	padding: 12px 16px;
	border-radius: 8px;
	font-size: 14px;
	margin-top: 16px;
}

.wpt-alert-error {
	background: #fdf2f2;
	border: 1px solid #f5c2c7;
	color: #842029;
}

.wpt-alert-success {
	background: #d1e7dd;
	border: 1px solid #a3cfbb;
	color: #0a3622;
}

/* ─── Zone de résultats ─────────────────────────────────────── */
.wpt-result-wrapper {
	margin-top: 24px;
}

/* ─── Carte résultat principale ─────────────────────────────── */
.wpt-result-card {
	background: var(--wpt-white);
	border: 1px solid var(--wpt-border);
	border-radius: var(--wpt-radius);
	box-shadow: var(--wpt-shadow);
	overflow: hidden;
}

/* ─── En-tête de la commande ─────────────────────────────────── */
.wpt-result-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 28px;
	flex-wrap: wrap;
	gap: 10px;
}

.wpt-result-title {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 2px;
	color: var(--wpt-text);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wpt-result-date {
	font-size: 13px;
	color: var(--wpt-text-muted);
	display: block;
}

.wpt-order-status-badge {
	display: inline-block;
	padding: 5px 16px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	background: var(--wpt-bg);
	color: var(--wpt-text-muted);
	border: 1px solid var(--wpt-border);
	text-transform: capitalize;
	white-space: nowrap;
}
.wpt-order-status-badge[data-status="completed"],
.wpt-order-status-badge[data-status="shipped"],
.wpt-order-status-badge[data-status="delivered"] {
	background: #d4edda;
	color: #155724;
	border-color: #c3e6cb;
}
.wpt-order-status-badge[data-status="processing"] {
	background: #fff3cd;
	color: #856404;
	border-color: #ffe69c;
}

.wpt-result-divider {
	height: 1px;
	background: var(--wpt-border);
	margin: 0;
}

/* ─── Bloc par shipment ──────────────────────────────────────── */
.wpt-shipment-block {
	padding: 24px 28px;
}

.wpt-shipment-block--sep {
	border-top: 1px solid var(--wpt-border);
}

/* ─── Barre de meta infos (carrier / tracking num / date) ────── */
.wpt-shipment-meta-bar {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	align-items: center;
	margin-bottom: 24px;
	font-size: 13px;
	color: var(--wpt-text-muted);
}

.wpt-meta-carrier {
	font-weight: 600;
	color: var(--wpt-text);
}

.wpt-meta-number {
	font-family: 'Courier New', monospace;
	background: #eff6ff;
	color: var(--wpt-primary);
	padding: 3px 8px;
	border-radius: 4px;
}

.wpt-meta-date {
	color: var(--wpt-text-muted);
}

/* ─── Last Mile (collapsible) ──────────────────────────────── */
.wpt-last-mile-details {
	width: 100%;
	margin-bottom: 20px;
}
.wpt-last-mile-summary {
	padding: 8px 14px;
	font-size: 13px;
	font-weight: 600;
	color: var(--wpt-primary, #2271b1) !important;
	cursor: pointer;
	list-style: none;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
	background-color: color-mix(in srgb, var(--wpt-primary, #2271b1) 8%, transparent) !important;
	border: 1px solid color-mix(in srgb, var(--wpt-primary, #2271b1) 30%, transparent) !important;
	border-radius: 6px;
	width: auto;
	text-align: left;
	transition: background-color .15s, border-color .15s;
}
.wpt-last-mile-summary:hover,
.wpt-last-mile-summary:focus {
	background-color: color-mix(in srgb, var(--wpt-primary, #2271b1) 15%, transparent) !important;
	border-color: color-mix(in srgb, var(--wpt-primary, #2271b1) 50%, transparent) !important;
	outline: none;
}
.wpt-last-mile-summary::-webkit-details-marker { display: none; }
.wpt-last-mile-summary::marker { display: none; content: ''; }
.wpt-last-mile-summary::before {
	content: '▸';
	display: inline-block;
	flex-shrink: 0;
	font-size: 11px;
	transition: transform .2s;
}
.wpt-last-mile-details[open] .wpt-last-mile-summary::before {
	transform: rotate(90deg);
}
.wpt-last-mile-content {
	padding: 0 14px 12px;
	font-size: 13px;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}
.wpt-last-mile-carrier {
	font-weight: 600;
	color: #1e40af;
}
.wpt-last-mile-number {
	font-family: 'Courier New', monospace;
	background: #e2e8f0;
	color: #1e293b;
	padding: 2px 6px;
	border-radius: 4px;
	text-decoration: none;
	word-break: break-all;
}
.wpt-last-mile-number:hover {
	text-decoration: underline;
}

/* ─── Barre de progression ───────────────────────────────────── */
.wpt-progress {
	position: relative;
	margin-bottom: 20px;
}

/* Piste de la barre (fond gris) */
.wpt-progress-bar-track {
	position: absolute;
	top: 18px;
	left: 10%;
	right: 10%;
	height: 3px;
	background: var(--wpt-progress-bg);
	z-index: 0;
}

/* Remplissage de la barre (couleur) */
.wpt-progress-bar-fill {
	height: 100%;
	background: var(--wpt-primary);
	transition: width 0.4s ease;
}

/* Étapes */
.wpt-progress-steps {
	position: relative;
	display: flex;
	justify-content: space-between;
	z-index: 1;
}

.wpt-step {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex: 1;
	gap: 8px;
}

/* Nœud de l'étape */
.wpt-step-node {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--wpt-white);
	border: 2px solid var(--wpt-progress-bg);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 0.3s, background 0.3s;
}

.wpt-step-icon {
	width: 18px;
	height: 18px;
	opacity: 0.35;
	transition: opacity 0.3s;
}

.wpt-step-icon svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* Étape active */
.wpt-step--active .wpt-step-node {
	border-color: var(--wpt-primary);
	background: #eff6ff;
}

.wpt-step--active .wpt-step-icon {
	opacity: 1;
	color: var(--wpt-primary);
}

/* Étape courante (la dernière active) */
.wpt-step--current .wpt-step-node {
	background: var(--wpt-primary);
	border-color: var(--wpt-primary);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--wpt-primary) 18%, transparent);
}

.wpt-step--current .wpt-step-icon {
	opacity: 1;
	color: var(--wpt-white);
}

.wpt-step--current .wpt-step-icon svg {
	fill: var(--wpt-white);
}

/* Label d'étape */
.wpt-step-label {
	text-align: center;
	font-size: 11px;
	font-weight: 600;
	color: var(--wpt-text-muted);
	line-height: 1.3;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
}

.wpt-step--active .wpt-step-label {
	color: var(--wpt-text);
}

.wpt-step--current .wpt-step-label {
	color: var(--wpt-primary);
}

.wpt-step-date {
	font-size: 10px;
	font-weight: 400;
	color: var(--wpt-text-muted);
}

/* ─── Badge statut courant ───────────────────────────────────── */
.wpt-current-status {
	margin-bottom: 20px;
}

.wpt-status-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 14px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	border: 1.5px solid currentColor;
	background: transparent;
}

.wpt-status-chip::before {
	content: '';
	display: inline-block;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: currentColor;
}

/* ─── Timeline des événements ────────────────────────────────── */
.wpt-timeline {
	margin-top: 4px;
}

.wpt-timeline-item {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}

.wpt-timeline-left {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex-shrink: 0;
	width: 16px;
}

.wpt-timeline-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--wpt-border);
	border: 2px solid var(--wpt-white);
	box-shadow: 0 0 0 1px var(--wpt-border);
	flex-shrink: 0;
	margin-top: 4px;
}

.wpt-timeline-dot--active {
	background: var(--wpt-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--wpt-primary) 20%, transparent);
}

.wpt-timeline-line {
	width: 2px;
	flex: 1;
	min-height: 24px;
	background: var(--wpt-border);
	margin: 4px 0;
}

.wpt-timeline-content {
	padding-bottom: 20px;
	flex: 1;
	min-width: 0;
}

.wpt-timeline-item:last-child .wpt-timeline-content {
	padding-bottom: 0;
}

.wpt-timeline-desc {
	font-size: 14px;
	color: var(--wpt-text);
	font-weight: 500;
	line-height: 1.4;
	margin-bottom: 3px;
}

.wpt-timeline-item--first .wpt-timeline-desc {
	font-weight: 600;
	color: var(--wpt-primary);
}

.wpt-timeline-sub {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

.wpt-timeline-time {
	font-size: 12px;
	color: var(--wpt-text-muted);
	font-weight: 500;
}

.wpt-timeline-location {
	font-size: 12px;
	color: var(--wpt-text-muted);
}

.wpt-timeline-location::before {
	content: '· ';
}

/* ─── Fallback lien externe ──────────────────────────────────── */
.wpt-fallback-link {
	margin-top: 16px;
}

/* ─── Aucun tracking ────────────────────────────────────────── */
.wpt-no-tracking {
	padding: 36px 24px;
	text-align: center;
	color: var(--wpt-text-muted);
}

.wpt-no-tracking-icon {
	font-size: 40px;
	margin-bottom: 12px;
}

.wpt-no-tracking p {
	margin: 0 0 8px;
	font-size: 15px;
}

.wpt-no-tracking-sub {
	font-size: 13px;
}

/* ─── Carte Google Maps ──────────────────────────────────────── */
.wpt-google-map {
	position: relative;
	width: 100%;
	height: 260px;
	overflow: hidden;
	background: #e9ecef;
}
.wpt-google-map iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.wpt-google-map__card {
	position: absolute;
	top: 8px;
	left: 8px;
	background: #fff;
	border-radius: 8px;
	padding: 10px 14px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, .2);
	max-width: 260px;
	min-width: 200px;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 10px;
}
.wpt-google-map__card-title {
	font-size: 11px;
	font-weight: 700;
	color: var(--wpt-text-muted);
	text-transform: uppercase;
	letter-spacing: .06em;
	margin: 0 0 2px;
	white-space: nowrap;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.wpt-google-map__card-address {
	font-size: 13px;
	color: var(--wpt-text);
	margin: 0;
	line-height: 1.3;
}

/* ─── Date de livraison estimée ─────────────────────────────── */
.wpt-estimated-delivery {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 14px 0;
	padding: 12px 16px;
	background: #eef6ff;
	border: 1px solid #c5ddf9;
	border-radius: 8px;
	font-size: 14px;
}
.wpt-estimated-delivery__label {
	color: var(--wpt-text-muted);
	display: flex;
	align-items: center;
	white-space: nowrap;
}
.wpt-estimated-delivery__date {
	font-weight: 600;
	color: var(--wpt-text);
	text-align: right;
}

/* ─── Produits commandés ─────────────────────────────────────── */
.wpt-order-items {
	padding: 20px 28px;
}
.wpt-order-items__title {
	font-size: 14px;
	font-weight: 600;
	color: var(--wpt-text-muted);
	margin: 0 0 14px;
	text-transform: uppercase;
	letter-spacing: .04em;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.wpt-order-item {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 0;
	border-bottom: 1px solid var(--wpt-border);
}
.wpt-order-item:last-child {
	border-bottom: none;
}
.wpt-order-item__img {
	width: 54px;
	height: 54px;
	flex-shrink: 0;
	border-radius: 6px;
	overflow: hidden;
	border: 1px solid var(--wpt-border);
	background: #f8f9fa;
}
.wpt-order-item__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.wpt-order-item__info {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex: 1;
}
.wpt-order-item__qty {
	font-size: 13px;
	font-weight: 700;
	color: var(--wpt-primary);
	white-space: nowrap;
}
.wpt-order-item__name {
	font-size: 14px;
	color: var(--wpt-text);
}

/* ─── Bloc de contact ────────────────────────────────────────── */
.wpt-contact-block {
	margin: 0;
	padding: 20px 28px;
	border-top: 1px solid var(--wpt-border);
	background: #fafbfc;
}
.wpt-contact-block__title {
	font-size: 15px;
	font-weight: 700;
	color: var(--wpt-text);
	margin: 0 0 8px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.wpt-contact-block__text {
	font-size: 14px;
	color: var(--wpt-text-muted);
	margin: 0;
	line-height: 1.6;
}

/* ─── Footer résultat ───────────────────────────────────────── */
.wpt-result-footer {
	padding: 16px 28px;
	border-top: 1px solid var(--wpt-border);
	background: var(--wpt-bg);
}

/* ─── Mon compte ────────────────────────────────────────────── */
.wpt-myaccount-tracking {
	margin-top: 32px;
}

.wpt-myaccount-tracking h2 {
	font-size: 18px;
	margin-bottom: 12px;
}

.wpt-tracking-table {
	width: 100%;
	border-collapse: collapse;
}

.wpt-tracking-table th,
.wpt-tracking-table td {
	padding: 10px 12px;
	text-align: left;
	border-bottom: 1px solid var(--wpt-border);
	font-size: 14px;
}

.wpt-track-btn {
	font-size: 13px !important;
	padding: 6px 14px !important;
}

/* ─── Badge statut (compatibility) ──────────────────────────── */
.wpt-status-badge {
	display: inline-block;
	padding: 5px 14px;
	border-radius: 20px;
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	white-space: nowrap;
}

/* ─── Sidebar recommandations ───────────────────────────────── */

/* Conteneur global : formulaire en haut, ligne résultats en dessous */
.wpt-page-layout {
	display: flex;
	flex-direction: column;
	max-width: 1000px;
	width: 100%;
	margin-top: 40px;
	margin-bottom: 40px;
	margin-left: auto;
	margin-right: auto;
	box-sizing: border-box;
	padding: 0 20px;
}

/* Neutralise les marges négatives que le thème applique à .alignfull */
.wpt-page-layout.alignfull {
	margin-left: auto !important;
	margin-right: auto !important;
	width: 100%;
	max-width: 1000px;
}

/* Le formulaire occupe toute la largeur, sans ses propres marges */
.wpt-page-layout .wpt-tracking-wrapper {
	width: 100%;
	max-width: none;
	margin: 0;
}

/* Ligne résultats + sidebar côte à côte */
.wpt-results-row {
	display: flex;
	align-items: flex-start;
	gap: 28px;
	width: 100%;
	margin-top: 0;
}

.wpt-results-row .wpt-result-wrapper {
	flex: 1;
	min-width: 0;
}

.wpt-sidebar {
	display: none; /* masquée par défaut, révélée par JS après succès de la recherche */
	width: 320px;
	flex-shrink: 0;
	margin-top: 24px;
}

.wpt-sidebar-card {
	background: var(--wpt-white);
	border: 1px solid var(--wpt-border);
	border-radius: var(--wpt-radius);
	box-shadow: var(--wpt-shadow);
	padding: 20px;
	position: sticky;
	top: 20px;
}

/* Contenu dynamique : délai livraison + produits commandés */
.wpt-sidebar-tracking {
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 1px solid var(--wpt-border);
}

.wpt-sidebar-tracking .wpt-order-items {
	padding: 0;
}

.wpt-sidebar-tracking .wpt-estimated-delivery {
	flex-wrap: wrap;
}

.wpt-sidebar-divider {
	margin: 10px 0;
}

.wpt-sidebar-title {
	font-size: 14px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--wpt-text-muted);
	margin: 0 0 16px;
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wpt-rec-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.wpt-rec-item a {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none;
	color: var(--wpt-text);
	transition: color .15s;
}

.wpt-rec-item a:hover span {
	color: var(--wpt-primary);
	text-decoration: underline;
}

.wpt-rec-item__img {
	width: 56px;
	height: 56px;
	flex-shrink: 0;
	border-radius: 8px;
	overflow: hidden;
	border: 1px solid var(--wpt-border);
	background: #f8f9fa;
}

.wpt-rec-item__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.wpt-rec-item span {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.35;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
	.wpt-results-row {
		flex-direction: column;
	}

	.wpt-sidebar {
		width: 100%;
		max-width: 780px;
		margin: 0 auto;
	}

	.wpt-rec-list {
		display: grid;
		grid-template-columns: repeat(3, 1fr);
		gap: 12px;
	}

	.wpt-rec-item a {
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 8px;
	}

	.wpt-rec-item img {
		width: 100%;
		height: 90px;
	}
}

@media (max-width: 640px) {
	.wpt-tracking-wrapper {
		margin: 20px 12px;
	}

	.wpt-rec-list {
		grid-template-columns: 1fr 1fr;
	}

	.wpt-tracking-card {
		padding: 20px 16px;
	}

	.wpt-result-header {
		padding: 16px 16px;
	}

	.wpt-shipment-block {
		padding: 20px 16px;
	}

	.wpt-result-footer {
		padding: 14px 16px;
	}

	/* Barre de progression : masquer les labels sur très petits écrans */
	.wpt-step-label {
		font-size: 10px;
	}

	.wpt-progress-bar-track {
		left: 12%;
		right: 12%;
	}

	.wpt-shipment-meta-bar {
		gap: 10px;
	}
}

@media (max-width: 400px) {
	.wpt-step-label {
		display: none;
	}

	.wpt-step-node {
		width: 32px;
		height: 32px;
	}

	.wpt-step-icon {
		width: 14px;
		height: 14px;
	}

	.wpt-progress-bar-track {
		top: 14px;
	}
}
