/* ============================================================
   Haika Post Tracking — Frontend Styles
   Mobile-first, RTL-aware via logical properties.
   No external fonts, no CDN.
   ============================================================ */

.hpt-card {
	--hpt-color-primary: #2271b1;
	--hpt-color-primary-dark: #135e96;
	--hpt-color-success: #10b981;
	--hpt-color-success-bg: #d1fae5;
	--hpt-color-text: #1f2937;
	--hpt-color-text-muted: #6b7280;
	--hpt-color-border: #e5e7eb;
	--hpt-color-line: #e5e7eb;
	--hpt-color-bg: #ffffff;
	--hpt-color-bg-soft: #f9fafb;
	--hpt-radius-lg: 14px;
	--hpt-radius-md: 10px;
	--hpt-radius-sm: 6px;
	--hpt-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.03);

	border: 1px solid var(--hpt-color-border);
	border-radius: var(--hpt-radius-lg);
	background: var(--hpt-color-bg);
	margin: 0 0 24px;
	overflow: hidden;
	box-shadow: var(--hpt-shadow);
	font-size: 14px;
	color: var(--hpt-color-text);
	line-height: 1.6;
}

/* ============ Card header ============ */
.hpt-card-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	padding: 14px 18px;
	background: var(--hpt-color-bg-soft);
	border-bottom: 1px solid var(--hpt-color-border);
}
.hpt-card-title {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 700;
	font-size: 15px;
	color: var(--hpt-color-text);
}
.hpt-card-title .hpt-icon { color: var(--hpt-color-primary); }

.hpt-status-badge {
	display: inline-block;
	background: rgba(34, 113, 177, 0.08);
	color: var(--hpt-color-primary);
	border: 1px solid rgba(34, 113, 177, 0.2);
	border-radius: 999px;
	padding: 4px 12px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
	line-height: 1.4;
}

.hpt-card-body { padding: 20px 18px; }

/* ============ Timeline ============
   Mobile (default): vertical layout — dot on the inline-start, content beside.
   Desktop (>= 768px): horizontal layout — dots in a row, content below.
   Uses logical properties (inset-inline-start/end) to support both LTR and RTL
   automatically without special-casing.
   ================================== */

.hpt-timeline {
	display: flex;
	flex-direction: column;
	margin: 0 0 8px;
	padding: 4px 4px 0;
}

.hpt-timeline-step {
	position: relative;
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	gap: 14px;
	padding-bottom: 22px;
	min-height: 0;
}
.hpt-timeline-step:last-child { padding-bottom: 0; }

/* Connecting line on mobile (vertical), positioned at the dot's center column */
.hpt-timeline-step:not(:last-child)::after {
	content: '';
	position: absolute;
	top: 26px;
	bottom: -2px;
	inset-inline-start: 13px;
	width: 2px;
	background: var(--hpt-color-line);
	z-index: 0;
	transition: background 0.3s ease;
}
.hpt-timeline-step.is-completed:not(:last-child)::after {
	background: var(--hpt-color-success);
}

/* Dot */
.hpt-timeline-dot {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: var(--hpt-color-bg);
	border: 2px solid var(--hpt-color-line);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	z-index: 2;
	position: relative;
	color: transparent;
	transition: all 0.3s ease;
}
.hpt-timeline-step.is-completed .hpt-timeline-dot {
	background: var(--hpt-color-success);
	border-color: var(--hpt-color-success);
	color: #fff;
}
.hpt-timeline-step.is-current .hpt-timeline-dot {
	background: var(--hpt-color-primary);
	border-color: var(--hpt-color-primary);
	color: #fff;
}
.hpt-timeline-step.is-current .hpt-timeline-dot::before {
	content: '';
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	background: var(--hpt-color-primary);
	opacity: 0;
	z-index: -1;
	animation: hptPulse 1.8s ease-out infinite;
}
.hpt-timeline-step.is-current .hpt-dot-inner {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #fff;
}

@keyframes hptPulse {
	0%   { transform: scale(0.6); opacity: 0.5; }
	80%  { transform: scale(1.5); opacity: 0; }
	100% { transform: scale(1.5); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.hpt-timeline-step.is-current .hpt-timeline-dot::before {
		animation: none;
		opacity: 0.2;
		transform: scale(1.3);
	}
}

/* Content */
.hpt-timeline-content {
	flex: 1;
	min-width: 0;
	padding-block-start: 2px;
}
.hpt-timeline-label {
	font-size: 14px;
	font-weight: 600;
	color: var(--hpt-color-text);
	line-height: 1.4;
}
.hpt-timeline-step.is-pending .hpt-timeline-label {
	color: var(--hpt-color-text-muted);
	font-weight: 500;
}
.hpt-timeline-step.is-current .hpt-timeline-label {
	color: var(--hpt-color-primary);
}
.hpt-timeline-time {
	font-size: 12px;
	color: var(--hpt-color-text-muted);
	margin-block-start: 3px;
	font-weight: 500;
	letter-spacing: 0.2px;
}
.hpt-timeline-time-muted { font-style: italic; }

/* ============ Desktop horizontal timeline ============ */
@media (min-width: 768px) {
	.hpt-timeline {
		flex-direction: row;
		justify-content: space-between;
		align-items: stretch;
		padding: 8px 4px 4px;
		gap: 0;
	}
	.hpt-timeline-step {
		flex: 1 1 0;
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 10px;
		padding-bottom: 0;
		min-width: 0;
	}
	.hpt-timeline-step:not(:last-child)::after {
		top: 13px;
		bottom: auto;
		inset-inline-start: 50%;
		inset-inline-end: auto;
		width: 100%;
		height: 2px;
	}
	.hpt-timeline-content {
		padding-block-start: 0;
		width: 100%;
	}
	.hpt-timeline-label { font-size: 13px; }
	.hpt-timeline-time  { font-size: 11px; }
}

/* ============ Details (company + tracking code) ============ */
.hpt-details {
	margin: 6px 0 0;
	padding: 14px 0 0;
	border-top: 1px dashed var(--hpt-color-border);
	display: flex;
	flex-direction: column;
	gap: 12px;
}
.hpt-detail-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
}
.hpt-detail-label {
	color: var(--hpt-color-text-muted);
	font-size: 13px;
	font-weight: 500;
}
.hpt-detail-value {
	font-weight: 600;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
	max-width: 100%;
}
.hpt-detail-value a {
	color: var(--hpt-color-primary);
	text-decoration: none;
}
.hpt-detail-value a:hover { text-decoration: underline; }

/* ============ Tracking code (clickable to copy) ============ */
.hpt-code {
	background: var(--hpt-color-bg-soft);
	padding: 6px 12px;
	border-radius: var(--hpt-radius-sm);
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New", monospace;
	letter-spacing: 0.4px;
	color: var(--hpt-color-text);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 600;
}
button.hpt-copyable, .hpt-copyable {
	border: 1px solid var(--hpt-color-border);
	cursor: pointer;
	transition: all 0.15s ease;
	position: relative;
	font: inherit;
	color: inherit;
	font-weight: 600;
}
.hpt-copyable .hpt-icon-copy {
	color: var(--hpt-color-text-muted);
	opacity: 0.7;
	transition: opacity 0.15s ease;
}
.hpt-copyable:hover {
	background: #fff;
	border-color: var(--hpt-color-primary);
	color: var(--hpt-color-primary);
}
.hpt-copyable:hover .hpt-icon-copy {
	opacity: 1;
	color: var(--hpt-color-primary);
}
.hpt-copyable:focus-visible {
	outline: 2px solid var(--hpt-color-primary);
	outline-offset: 2px;
}
.hpt-copyable.is-copied {
	background: var(--hpt-color-success-bg);
	border-color: var(--hpt-color-success);
	color: #065f46;
}
.hpt-copyable.is-copied .hpt-icon-copy {
	color: var(--hpt-color-success);
	opacity: 1;
}

/* Toast on copy */
.hpt-toast {
	position: absolute;
	bottom: calc(100% + 8px);
	inset-inline-start: 50%;
	transform: translateX(-50%) translateY(4px);
	background: #1f2937;
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 5px 10px;
	border-radius: var(--hpt-radius-sm);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease, transform 0.2s ease;
	white-space: nowrap;
	z-index: 10;
	letter-spacing: 0.2px;
}
.hpt-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}
[dir="rtl"] .hpt-toast {
	transform: translateX(50%) translateY(4px);
}
[dir="rtl"] .hpt-toast.is-visible {
	transform: translateX(50%) translateY(0);
}

.hpt-company {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 600;
}
.hpt-company-logo {
	height: 22px;
	width: auto;
	max-width: 60px;
	max-height: 22px;
	min-height: 16px;
	object-fit: contain;
	display: inline-block;
}

/* ============ Action button ============ */
.hpt-actions {
	margin-top: 18px;
	display: flex;
	justify-content: center;
}
.hpt-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 22px;
	border-radius: var(--hpt-radius-md);
	background: var(--hpt-color-primary);
	color: #fff !important;
	font-weight: 600;
	text-decoration: none;
	border: none;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.4;
	transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
	box-shadow: 0 1px 2px rgba(34, 113, 177, 0.2);
}
.hpt-btn:hover {
	background: var(--hpt-color-primary-dark);
	color: #fff !important;
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(34, 113, 177, 0.25);
}
.hpt-btn:focus-visible {
	outline: 2px solid var(--hpt-color-primary);
	outline-offset: 2px;
}
.hpt-btn[disabled] {
	background: #d1d5db !important;
	color: #6b7280 !important;
	cursor: not-allowed;
	transform: none;
	box-shadow: none;
}
.hpt-btn[disabled]:hover {
	background: #d1d5db !important;
	transform: none;
	box-shadow: none;
}
.hpt-btn .hpt-icon-external { transition: transform 0.2s ease; }
.hpt-btn:hover .hpt-icon-external { transform: translate(2px, -2px); }
[dir="rtl"] .hpt-btn:hover .hpt-icon-external { transform: translate(-2px, -2px); }

/* ============ Timeline-only card ============ */
.hpt-card-timeline-only .hpt-card-body { padding: 22px 18px; }

/* ============ Small screens fine-tuning ============ */
@media (max-width: 380px) {
	.hpt-card-header { padding: 12px 14px; }
	.hpt-card-body { padding: 16px 14px; }
	.hpt-detail-row {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}
	.hpt-detail-value { justify-content: flex-start; }
}
