/** Workspaces page styles */

/* Desktop */
.workspaces-page {
	padding: var(--space-4);
}

.workspaces-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
	gap: var(--space-4);
	margin-top: var(--space-4);
}

/* Workspace card */
.workspace-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-4);
	padding: var(--space-5);
	border: 1px solid var(--border);
	border-radius: 12px;
	background: var(--panel);
	transition:
		box-shadow 0.15s ease,
		border-color 0.15s ease;
}

.workspace-card:hover {
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
	border-color: color-mix(in srgb, var(--border) 80%, var(--brand));
}

.workspace-card.loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Top row: title + status */
.workspace-card-top {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
}

.workspace-title-link {
	display: block;
	text-decoration: none;
	color: inherit;
	flex: 1;
	min-width: 0;
}

.workspace-title-link:hover .workspace-name {
	color: var(--brand);
}

.workspace-title-stack {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	min-width: 0;
}

.workspace-title-row {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	min-width: 0;
}

.workspace-name {
	margin: 0;
	font-size: var(--font-size-lg);
	font-weight: 700;
	color: var(--ink);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1;
	min-width: 0;
}

.workspace-project-name {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	font-size: var(--font-size-sm);
	font-weight: 500;
	color: var(--muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.workspace-project-name .icon {
	color: var(--brand);
}

/* Body: meta row + instance chips */
.workspace-card-body {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.workspace-meta-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--space-3);
	font-size: var(--font-size-sm);
	color: var(--muted);
}

.workspace-meta-row > span {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
}

.workspace-repo {
	color: var(--muted);
}

.workspace-branch {
	color: var(--muted);
}

.workspace-instance-count {
	padding: var(--space-1) var(--space-2);
	background: var(--bg);
	border-radius: 999px;
	font-size: var(--font-size-xs);
	font-weight: 500;
	color: var(--success);
}

/* Instance chips */
.instance-chips {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2);
}

.instance-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	font-size: var(--font-size-xs);
	padding: var(--space-1) var(--space-2);
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--ink);
	max-width: 100%;
}

.instance-chip.running {
	background: var(--success-light);
	border-color: color-mix(in srgb, var(--success) 25%, transparent);
	color: var(--success);
}

.instance-chip a {
	color: inherit;
	text-decoration: none;
	margin-left: var(--space-1);
}

.instance-chip a:hover {
	text-decoration: underline;
}

/* Actions */
.workspace-actions {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	margin-top: auto;
	padding-top: var(--space-3);
	border-top: 1px solid var(--border);
}

.workspace-actions .btn-primary {
	margin-right: auto;
}

/* Status badges */
.status-badge {
	flex-shrink: 0;
	font-size: var(--font-size-xs);
	font-weight: 600;
	padding: var(--space-1) var(--space-2);
	border-radius: 999px;
	text-transform: capitalize;
}

.status-ready {
	background: var(--success-light);
	color: var(--success);
}

.status-syncing {
	background: var(--warning-light);
	color: var(--warning);
}

.status-error {
	background: var(--danger-light);
	color: var(--danger);
}

/* Empty state */
.empty-state {
	text-align: center;
	padding: var(--space-10) var(--space-4);
	color: var(--muted);
}

.empty-state p {
	margin-bottom: var(--space-4);
}

/* Mobile */
@media (max-width: 767px) {
	.workspaces-page {
		padding: var(--space-3);
	}

	.workspaces-grid {
		grid-template-columns: 1fr;
		gap: var(--space-3);
	}

	.workspace-card {
		padding: var(--space-4);
		gap: var(--space-3);
	}

	.workspace-actions {
		flex-wrap: wrap;
	}

	.workspace-actions .btn-primary {
		width: 100%;
		justify-content: center;
	}

	.mobile-workspaces-list {
		gap: var(--space-3);
		margin-top: 0;
	}
}
