/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

/* Tab bar rendered above the action list inside a TabbedActionListWidget
 * popup. Styles are intentionally minimal so consumers can override via
 * the `tabBarClassName` option. */

.action-widget .tabbed-action-list-body.collapsed {
	height: 0;
	overflow: clip;
	visibility: hidden;
}

.action-widget .tabbed-action-list-body.animating {
	overflow: clip;
	visibility: visible;
}

.action-widget .tabbed-action-list-tabbar {
	display: flex;
	align-items: center;
	padding: 0 0 4px;
}

.action-widget .tabbed-action-list-tabbar .monaco-custom-radio {
	width: 100%;
	gap: 4px;
}

.action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button {
	border: none;
	border-radius: 4px;
}

.action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button:not(.active) {
	color: var(--vscode-descriptionForeground);
}

/* A closing tab holds its old label while it shrinks, so it has to clip it. */
.action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button.label-collapsing {
	overflow: hidden;
}

.action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button.label-collapsing > span:not(.codicon) {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* An image icon is drawn by the tab itself, so it survives the tab's label being replaced. It sits
 * where a codicon would, with the same margin text buttons give codicons. */
.action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button.tabbed-action-list-tab-image-icon::before {
	content: '';
	flex: 0 0 auto;
	width: var(--vscode-codiconFontSize);
	height: var(--vscode-codiconFontSize);
	margin: 0 0.2em;
	background-image: var(--tabbed-action-list-tab-icon-light);
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
}

.vs-dark .action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button.tabbed-action-list-tab-image-icon::before,
.hc-black .action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button.tabbed-action-list-tab-image-icon::before {
	background-image: var(--tabbed-action-list-tab-icon-dark);
}

/* Images can't take the muted foreground of inactive tabs, so they fade to the same 70% instead. */
.action-widget .tabbed-action-list-tabbar .monaco-custom-radio .monaco-button.tabbed-action-list-tab-image-icon:not(.active)::before {
	opacity: 0.7;
}

.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	padding: 0;
	margin: 0;
	border: none;
	border-radius: var(--vscode-cornerRadius-small);
	background: transparent;
	color: var(--vscode-descriptionForeground);
	cursor: pointer;
}

.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action.align-end {
	margin-left: auto;
}

/* Consecutive end-aligned actions stay grouped at the end of the tab bar. */
.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action.align-end ~ .tabbed-action-list-tabbar-action.align-end {
	margin-left: var(--vscode-spacing-size40);
}

.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action:hover:not(.disabled),
.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action.checked {
	background-color: var(--vscode-toolbar-hoverBackground);
	color: var(--vscode-foreground);
}

/* Follows the checked rule at equal specificity, so a disabled action never looks pressed or interactive. */
.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action.disabled {
	background-color: transparent;
	color: var(--vscode-descriptionForeground);
	cursor: default;
}

/* Dims only the icon, matching disabled buttons and toggles, so the focus outline stays fully visible. */
.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action.disabled > .codicon {
	opacity: 0.4;
}

.action-widget .tabbed-action-list-tabbar .tabbed-action-list-tabbar-action:focus-visible {
	outline: 1px solid var(--vscode-focusBorder);
	outline-offset: -1px;
}

.action-widget .tabbed-action-list-footer,
.action-widget .tabbed-action-list-empty {
	flex: 0 0 auto;
}

.action-widget.showing-details {
	position: relative;
}

.action-widget.showing-details > .tabbed-action-list-main {
	position: absolute;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
}

.tabbed-action-list-details-header {
	display: flex;
	align-items: center;
	gap: var(--vscode-spacing-size80);
	padding: var(--vscode-spacing-size40);
}

.tabbed-action-list-details-header .monaco-button {
	width: auto;
	padding: var(--vscode-spacing-size40) var(--vscode-spacing-size80);
	border: none;
	border-radius: var(--vscode-cornerRadius-small);
}

.tabbed-action-list-details-header > .monaco-action-bar {
	flex: 0 0 auto;
}

.tabbed-action-list-details-viewport {
	overflow: hidden;
}

.action-widget.showing-details .tabbed-action-list-details:focus {
	outline: none;
}

.action-widget.showing-details.keyboard-navigation .tabbed-action-list-details:focus {
	outline: var(--vscode-strokeThickness) solid var(--vscode-focusBorder);
	outline-offset: calc(-1 * var(--vscode-strokeThickness));
}
