/* Generic per-column show/hide toggle. Paired with assets/js/table-column-toggle.js */

/* Wrap — anchor for the absolute-positioned panel. */
.bbd-cols-toggle {
	position: relative;
	display: inline-block;
	margin: 0 0 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Trigger button. Higher specificity to outrank parent-theme button styles. */
.bbd-cols-toggle .bbd-cols-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: #fff;
	border: 1px solid #d0d4d9;
	border-radius: 6px;
	padding: 7px 12px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	color: #333;
	cursor: pointer;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
	transition: border-color .15s, box-shadow .15s, background .15s;
}

.bbd-cols-toggle .bbd-cols-btn:hover {
	background: #f7f8fa;
	border-color: #9da4ab;
}

.bbd-cols-toggle .bbd-cols-btn[aria-expanded="true"] {
	background: #f0f1f4;
	border-color: #6b7280;
	box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.bbd-cols-toggle .bbd-cols-btn .bbd-cols-caret {
	display: inline-block;
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid #6b7280;
	transition: transform .15s;
}

.bbd-cols-toggle .bbd-cols-btn[aria-expanded="true"] .bbd-cols-caret {
	transform: rotate(180deg);
}

/* Floating panel. !important on the layout properties so a parent theme can't
   accidentally inline the items via a `display: inline` reset, etc. */
.bbd-cols-toggle .bbd-cols-panel {
	position: absolute !important;
	top: 100%;
	left: 0;
	margin-top: 6px;
	min-width: 280px;
	max-width: 480px;
	max-height: 60vh;
	overflow-y: auto;
	background: #fff !important;
	border: 1px solid #d0d4d9;
	border-radius: 8px;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
	padding: 8px;
	z-index: 1000;
	display: none;
	box-sizing: border-box;
}

.bbd-cols-toggle .bbd-cols-panel.is-open {
	display: block !important;
}

/* Panel header — quick actions */
.bbd-cols-toggle .bbd-cols-actions {
	display: flex !important;
	gap: 6px;
	padding: 4px 6px 8px;
	border-bottom: 1px solid #eee;
	margin-bottom: 6px;
}

.bbd-cols-toggle .bbd-cols-action {
	flex: 1;
	background: transparent;
	border: 1px solid #d0d4d9;
	border-radius: 4px;
	padding: 5px 8px;
	font-size: 12px;
	color: #444;
	cursor: pointer;
	transition: background .15s, border-color .15s;
}

.bbd-cols-toggle .bbd-cols-action:hover {
	background: #f0f1f4;
	border-color: #9da4ab;
}

/* Items list — single column. Each item gets its own line. */
.bbd-cols-toggle .bbd-cols-list {
	display: block !important;
	padding: 0;
	margin: 0;
}

.bbd-cols-toggle .bbd-cols-item {
	display: flex !important;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	font-size: 13px;
	line-height: 1.3;
	color: #333;
	cursor: pointer;
	border-radius: 4px;
	user-select: none;
}

.bbd-cols-toggle .bbd-cols-item:hover {
	background: #f5f7fa;
}

.bbd-cols-toggle .bbd-cols-item input[type="checkbox"] {
	margin: 0 !important;
	flex-shrink: 0;
	width: 16px;
	height: 16px;
	cursor: pointer;
}

.bbd-cols-toggle .bbd-cols-item .bbd-cols-label {
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Disabled-style for unchecked items so the visible columns stand out. */
.bbd-cols-toggle .bbd-cols-item input:not(:checked) ~ .bbd-cols-label {
	color: #999;
}
