/* ==========================================================================
   Miller Columns Popover (3 colonnes : Moteur | Version | Storage)
   ========================================================================== */

.miller-popover {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	left: auto;
	width: 520px;
	max-width: calc(100vw - 24px);
	box-sizing: border-box;
	background: var(--bg-menu);
	border: 1px solid var(--border);
	border-radius: 8px;
	box-shadow: var(--shadow);
	z-index: 150;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	pointer-events: auto;
}

.miller-popover[hidden] {
	display: none;
}

.miller__back {
	display: none;
	align-items: center;
	gap: 4px;
	height: 24px;
	padding: 0 8px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--focus);
	font-family: inherit;
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.12s ease;
}

.miller__back:hover {
	background: var(--bg-hover);
}

.miller__back:focus-visible {
	outline: 2px solid var(--focus);
	outline-offset: 1px;
}

.miller-popover__header {
	display: grid;
	grid-template-columns: minmax(0, 160fr) minmax(0, 170fr) minmax(0, 190fr);
	padding: 6px 10px;
	border-bottom: 1px solid var(--border);
	background: var(--bg);
	font-size: 11px;
	font-weight: 600;
	color: var(--text-muted);
	letter-spacing: 0.03em;
}

.miller-popover__viewport {
	width: 100%;
	overflow: hidden;
}

.miller-popover__body {
	display: grid;
	grid-template-columns: minmax(0, 160fr) minmax(0, 170fr) minmax(0, 190fr);
	height: 180px;
}

.miller__col {
	min-width: 0;
	min-height: 0;
	overflow-y: auto;
	padding: 4px;
	border-right: 1px solid var(--border);
	scrollbar-width: thin;
}

.miller__col:last-child {
	border-right: 0;
}

.miller__item {
	width: 100%;
	height: 28px;
	padding: 0 8px;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: var(--text);
	font-family: inherit;
	font-size: 12px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	text-align: left;
	transition: background-color 0.12s ease;
}

.miller__item:hover {
	background: var(--bg-hover);
}

.miller__item.is-selected {
	background: rgba(9, 105, 218, 0.08);
	font-weight: 600;
	color: var(--focus);
	border-left: 3px solid var(--focus);
	padding-left: 9px;
}

@media (prefers-color-scheme: dark) {
	.miller__item.is-selected {
		background: rgba(88, 166, 255, 0.14);
	}
}

html[data-theme="dark"] .miller__item.is-selected {
	background: rgba(88, 166, 255, 0.14);
}

.miller__dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	flex-shrink: 0;
}

.miller__label {
	flex: 1;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.miller__arrow {
	font-size: 13px;
	color: var(--text-muted);
}

.miller__tag {
	font-size: 9px;
	font-weight: 600;
	text-transform: uppercase;
	padding: 1px 4px;
	border-radius: 3px;
	background: var(--bg);
	border: 1px solid var(--border);
	color: var(--text-muted);
}

.miller__tag--active {
	background: var(--tag-active-bg);
	color: var(--tag-active-text);
	border-color: var(--tag-active-border);
}

.miller-popover__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 12px;
	border-top: 1px solid var(--border);
	background: var(--bg);
}

.miller__preview-wrap {
	display: flex;
	align-items: baseline;
	gap: 6px;
	font-size: 12px;
}

.miller__preview-label {
	color: var(--text-muted);
	font-size: 11px;
}

.miller__preview {
	font-size: 12px;
	font-weight: 600;
	color: var(--text);
}

.miller__confirm-btn {
	height: 26px;
	padding: 0 12px;
	border: 0;
	border-radius: 4px;
	background: var(--focus);
	color: #ffffff;
	font-family: inherit;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: opacity 0.12s ease;
}

.miller__confirm-btn:hover {
	opacity: 0.9;
}

.miller__confirm-btn:disabled,
.miller__confirm-btn[aria-disabled="true"] {
	opacity: 0.4;
	cursor: not-allowed;
}

.miller__confirm-btn:disabled:hover,
.miller__confirm-btn[aria-disabled="true"]:hover {
	opacity: 0.4;
}

.miller__confirm-btn--remove {
	background: #cf222e;
}

.miller__confirm-btn--remove:hover {
	background: #b62324;
}

@media (max-width: 560px) {
	/* Compact engines bar on mobile: hide "Engines:" text label and condense Add Engine to a single '+' icon */
	.engines-bar__label {
		display: none;
	}

	.engine-picker__text {
		display: none;
	}

	.engine-picker__btn {
		width: 28px;
		height: 28px;
		padding: 0;
		justify-content: center;
		position: relative;
	}

	/* Expand touch target to 44x44px (WCAG AAA touch target) on touchscreens without enlarging visual bounds */
	.engine-picker__btn::before {
		content: "";
		position: absolute;
		inset: -8px;
	}

	.miller-popover {
		right: 0;
		left: auto;
		width: calc(100vw - 32px);
		max-width: calc(100vw - 32px);
	}

	.miller-popover__header {
		grid-template-columns: auto minmax(0, 1fr);
		align-items: center;
		gap: 8px;
		min-height: 36px;
		padding: 6px 10px;
	}

	.miller-popover__viewport {
		overflow: hidden;
		width: 100%;
	}

	.miller-popover__body {
		display: flex;
		width: 100%;
		height: 240px;
		transform: translateX(0%);
		transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
		will-change: transform;
	}

	.miller-popover__body > .miller__col {
		display: block;
		flex: 0 0 100%;
		width: 100%;
		box-sizing: border-box;
		border-right: 0;
		padding: 6px;
	}

	.miller-popover[data-step="1"] .miller-popover__body {
		transform: translateX(0%);
	}

	.miller-popover[data-step="2"] .miller-popover__body {
		transform: translateX(-100%);
	}

	.miller-popover[data-step="3"] .miller-popover__body {
		transform: translateX(-200%);
	}

	.miller-popover__step {
		display: none;
	}

	.miller-popover[data-step="1"] [data-step-title="1"],
	.miller-popover[data-step="2"] [data-step-title="2"],
	.miller-popover[data-step="3"] [data-step-title="3"] {
		display: block;
		grid-column: 2;
		grid-row: 1;
		min-width: 0;
		font-size: 12px;
		font-weight: 600;
	}

	.miller-popover[data-step="1"] [data-step-title="1"] {
		grid-column: 1 / -1;
	}

	.miller__back {
		height: 36px;
		padding: 0 10px;
		font-size: 13px;
	}

	.miller__back:active {
		background: var(--bg-hover);
	}

	.miller-popover[data-step="2"] .miller__back,
	.miller-popover[data-step="3"] .miller__back {
		display: inline-flex;
		grid-column: 1;
		grid-row: 1;
	}

	.miller__item {
		height: 44px;
		font-size: 13px;
		padding: 0 12px;
		-webkit-tap-highlight-color: transparent;
	}

	.miller__item:active {
		background: var(--bg-hover);
		transform: scale(0.98);
	}

	.miller-popover__footer {
		gap: 8px;
		flex-wrap: wrap;
	}

	.miller__preview-wrap {
		min-width: 0;
		flex: 1 1 0;
		flex-wrap: wrap;
	}

	.miller__preview {
		min-width: 0;
		overflow-wrap: anywhere;
	}

	.miller__confirm-btn {
		flex-shrink: 0;
		margin-left: auto;
		min-height: 32px;
		padding: 0 14px;
		font-size: 12px;
	}

	.miller-popover[data-step="1"] .miller__confirm-btn,
	.miller-popover[data-step="2"] .miller__confirm-btn {
		display: none;
	}
}

@media (max-width: 560px) and (prefers-reduced-motion: reduce) {
	.miller-popover__body {
		transition: none;
	}
}

@media (max-width: 480px) {
	.engines-bar__inner,
	.dashboard-main {
		padding-left: 16px;
		padding-right: 16px;
	}
}

