/**
 * Akel Tools Design System — Data display components
 */

/* Avatar */
.at-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	overflow: hidden;
	font-weight: var(--weight-semibold);
	color: #fff;
	background: var(--brand-navy);
	border-radius: 0;
}

.at-avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.at-avatar--xs { width: 24px; height: 24px; font-size: 14px; }
.at-avatar--sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.at-avatar--md { width: 40px; height: 40px; font-size: var(--text-sm); }
.at-avatar--lg { width: 48px; height: 48px; font-size: var(--text-md); }
.at-avatar--xl { width: 64px; height: 64px; font-size: var(--text-lg); }

.at-avatar-group {
	display: flex;
	align-items: center;
}

.at-avatar-group .at-avatar {
	margin-left: -8px;
	border: 2px solid var(--surface-elevated);
}

.at-avatar-group .at-avatar:first-child {
	margin-left: 0;
}

.at-avatar-group__more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	margin-left: -8px;
	font-size: var(--text-xs);
	font-weight: var(--weight-semibold);
	color: var(--text-secondary);
	background: var(--surface-subtle);
	border: 2px solid var(--surface-elevated);
	border-radius: 0;
}

/* Status dot */
.at-status-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 0;
	flex-shrink: 0;
}

.at-status-dot--success { background: var(--brand-success); }
.at-status-dot--danger  { background: var(--brand-danger); }
.at-status-dot--warning { background: var(--brand-warning); }
.at-status-dot--neutral { background: var(--text-tertiary); }
.at-status-dot--accent  { background: var(--brand-accent); }

.at-status-dot--pulse {
	box-shadow: 0 0 0 0 var(--brand-success);
	animation: at-dot-pulse 2s infinite;
}

@keyframes at-dot-pulse {
	0% { box-shadow: 0 0 0 0 rgba(61, 139, 106, 0.5); }
	70% { box-shadow: 0 0 0 6px rgba(61, 139, 106, 0); }
	100% { box-shadow: 0 0 0 0 rgba(61, 139, 106, 0); }
}

/* Status lines — body copy / notes (not filled icons mid-sentence) */
.at-status-lines {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.at-status-lines__item {
	display: grid;
	grid-template-columns: 9.5rem auto minmax(0, 1fr);
	align-items: center;
	gap: var(--space-2) var(--space-3);
}

.at-status-lines__label {
	font-size: var(--text-sm);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}

.at-status-lines__detail {
	font-size: var(--text-base);
	font-weight: var(--weight-medium);
	color: var(--text-secondary);
	line-height: var(--leading-normal);
}

/* Sync status */
.at-sync-status {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: var(--space-1) var(--space-2);
	font-size: var(--text-xs);
	font-weight: var(--weight-semibold);
	border-radius: 0;
}

.at-sync-status--synced {
	color: var(--brand-success-text);
	background: var(--brand-success-soft);
}

.at-sync-status--attention {
	color: var(--brand-warning);
	background: var(--brand-warning-soft);
}

.at-sync-status--error {
	color: var(--brand-danger-text);
	background: var(--brand-danger-soft);
}

.at-sync-status--stale {
	color: var(--text-secondary);
	background: var(--surface-subtle);
}

.at-sync-status--checking {
	color: var(--brand-accent);
	background: var(--brand-accent-soft);
}

/* Stat / KPI */
.at-stat {
	padding: var(--space-4);
}

.at-stat__label {
	font-size: var(--text-caps, 11px);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--text-tertiary);
	margin-bottom: var(--space-1);
}

.at-stat__value {
	font-size: var(--text-3xl);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-tight);
	line-height: var(--leading-tight);
	color: var(--text-primary);
}

.at-stat__delta {
	margin-top: var(--space-2);
	font-size: var(--text-sm);
	font-weight: var(--weight-medium);
	color: var(--text-secondary);
}

.at-stat__delta--up { color: var(--brand-success); }
.at-stat__delta--down { color: var(--brand-danger); }

/* Person card */
.at-card-person {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	padding: var(--space-4);
}

.at-card-person__meta {
	flex: 1;
	min-width: 0;
}

.at-card-person__name {
	font-size: var(--text-md);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
	margin: 0;
}

.at-card-person__sub {
	font-size: var(--text-sm);
	color: var(--text-secondary);
	margin: 2px 0 0;
}

/* Property card */
.at-card-property {
	padding: var(--space-5);
}

.at-card-property__title {
	font-size: var(--text-lg);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
	margin: var(--space-2) 0 var(--space-1);
}

.at-card-property__address {
	font-size: var(--text-sm);
	color: var(--text-secondary);
	margin: 0 0 var(--space-3);
}

.at-card-property__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
}

/* Property pair */
.at-pair {
	display: flex;
	gap: var(--space-2);
	font-size: var(--text-sm);
}

.at-pair--stacked {
	flex-direction: column;
	gap: var(--space-1);
}

.at-pair__label {
	color: var(--text-tertiary);
	font-weight: var(--weight-medium);
	flex-shrink: 0;
}

.at-pair__value {
	color: var(--text-primary);
	font-weight: var(--weight-semibold);
}

/* Timeline */
.at-timeline {
	position: relative;
	padding-left: var(--space-6);
	list-style: none;
	margin: 0;
}

.at-timeline::before {
	content: "";
	position: absolute;
	left: 7px;
	top: 8px;
	bottom: 8px;
	width: 2px;
	background: var(--border-default);
}

.at-timeline__item {
	position: relative;
	padding-bottom: var(--space-5);
}

.at-timeline__item:last-child {
	padding-bottom: 0;
}

.at-timeline__dot {
	position: absolute;
	left: calc(-1 * var(--space-6) + 3px);
	top: 4px;
	width: 10px;
	height: 10px;
	background: var(--surface-elevated);
	border: 2px solid var(--brand-accent);
	border-radius: 0;
}

.at-timeline__time {
	font-size: var(--text-xs);
	color: var(--text-tertiary);
	margin-bottom: var(--space-1);
}

.at-timeline__title {
	font-size: var(--text-md);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}

.at-timeline__body {
	font-size: var(--text-sm);
	color: var(--text-secondary);
	margin-top: var(--space-1);
}

/* Callout */
.at-callout {
	padding: var(--space-4);
	border-left: 3px solid var(--brand-accent);
	background: var(--brand-accent-soft);
	border-radius: 0;
}

.at-callout__title {
	font-size: var(--text-md);
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
	margin: 0 0 var(--space-2);
}

.at-callout p {
	margin: 0;
	font-size: var(--text-sm);
	color: var(--text-secondary);
}

.at-blockquote {
	margin: 0;
	padding: var(--space-4) var(--space-5);
	border-left: 3px solid var(--border-strong);
	font-size: var(--text-md);
	font-style: italic;
	color: var(--text-secondary);
}

/* Kbd */
.at-kbd {
	display: inline-block;
	padding: 2px 6px;
	font-family: var(--font-mono);
	font-size: 14px;
	font-weight: var(--weight-medium);
	line-height: 1.4;
	color: var(--text-primary);
	background: var(--surface-subtle);
	border: 1px solid var(--border-default);
	border-bottom-width: 2px;
	border-radius: 0;
}

.at-kbd-seq {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}

/* Code */
.at-code {
	font-family: var(--font-mono);
	font-size: 1em;
	padding: 2px 6px;
	background: var(--surface-subtle);
	border: 1px solid var(--border-default);
	border-radius: 0;
	color: var(--brand-danger-text);
}

.at-code-block {
	display: block;
	padding: var(--space-4);
	font-family: var(--font-mono);
	font-size: var(--text-sm);
	line-height: var(--leading-relaxed);
	color: var(--text-primary);
	background: var(--surface-sunken);
	border: 1px solid var(--border-default);
	border-radius: 0;
	overflow-x: auto;
	white-space: pre;
}

/* Product card */
.at-card-product {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	background: var(--surface-elevated);
	border: 1px solid var(--border-default);
	box-shadow: var(--shadow-sm);
	transition:
		box-shadow var(--duration-fast) var(--ease-out),
		border-color var(--duration-fast) var(--ease-out),
		transform var(--duration-fast) var(--ease-out);
}

.at-card-product:hover {
	border-color: var(--brand-accent);
	box-shadow: var(--shadow-md);
	transform: translateY(-2px);
}

.at-card-product__media {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #fff;
	padding: var(--space-5);
}

.at-card-product__media img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	transition: transform var(--duration-fast) var(--ease-out);
}

.at-card-product:hover .at-card-product__media img {
	transform: scale(1.03);
}

.at-card-product__fav {
	position: absolute;
	top: var(--space-3);
	right: var(--space-3);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	background: var(--surface-elevated);
	border: 1px solid var(--border-default);
	box-shadow: var(--shadow-sm);
	color: var(--text-tertiary);
	cursor: pointer;
	opacity: 0.5;
	transition:
		opacity var(--duration-fast) var(--ease-out),
		color var(--duration-fast) var(--ease-out),
		border-color var(--duration-fast) var(--ease-out);
}

.at-card-product:hover .at-card-product__fav,
.at-card-product__fav.is-active {
	opacity: 1;
}

.at-card-product__fav:hover {
	border-color: var(--brand-accent);
	color: var(--brand-accent);
}

.at-card-product__fav.is-active {
	color: var(--brand-accent);
}

.at-card-product__fav svg {
	width: 20px;
	height: 20px;
}

.at-card-product__fav.is-active svg {
	fill: currentColor;
}

.at-card-product__badge {
	position: absolute;
	bottom: var(--space-2);
	left: var(--space-2);
	z-index: 2;
	display: inline-flex;
	align-items: center;
	padding: var(--space-1) var(--space-3);
	font-size: var(--text-caps);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: #fff;
	background: var(--brand-success);
}

.at-card-product__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: var(--space-4) var(--space-5);
	min-height: 0;
}

.at-card-product__eyebrow {
	margin: 0 0 var(--space-1);
	font-size: var(--text-caps);
	font-weight: var(--weight-semibold);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--text-tertiary);
	line-height: var(--leading-snug);
}

.at-card-product__chips {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-2);
	margin-bottom: var(--space-2);
}

.at-card-product__level {
	display: inline-flex;
	align-items: center;
	padding: var(--space-1) var(--space-3);
	font-size: var(--text-caps);
	font-weight: var(--weight-bold);
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--text-primary);
	background: transparent;
	border: 1px solid var(--text-primary);
}

.at-card-product__title {
	margin: 0;
	font-size: var(--text-xl);
	font-weight: var(--weight-semibold);
	line-height: var(--leading-snug);
	color: var(--text-primary);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.at-card-product__brand {
	display: flex;
	align-items: center;
	min-height: 44px;
	margin-top: auto;
	padding-top: var(--space-2);
	font-size: var(--text-lg);
	color: var(--text-secondary);
}

.at-card-product__brand img {
	max-height: 44px;
	max-width: 160px;
	width: auto;
	height: auto;
	object-fit: contain;
	object-position: left center;
	filter: grayscale(30%) opacity(0.85);
	mix-blend-mode: multiply;
}

.at-card-product__note {
	margin: var(--space-2) 0 0;
	font-size: var(--text-sm);
	color: var(--text-secondary);
	line-height: var(--leading-normal);
}

@media (max-width: 639px) {
	.at-card-product__media {
		padding: var(--space-3);
	}

	.at-card-product__body {
		padding: var(--space-3);
	}

	.at-card-product__title {
		font-size: var(--text-lg);
	}

	.at-card-product__brand {
		min-height: 36px;
		font-size: var(--text-sm);
	}

	.at-card-product__brand img {
		max-height: 36px;
	}

	.at-card-product__level,
	.at-card-product__chips .at-badge {
		font-size: var(--text-caps);
	}
}

@media (hover: none) {
	.at-card-product .at-card-product__fav {
		opacity: 1;
	}
}
