/* Dynamic Product Tabs Builder for WooCommerce - Admin Styles */

/* Admin Header: React-like layout for Product Tabs screen */
.woocommerce-product-tabs-layout__header {
	background: #fff;
	box-sizing: border-box;
	margin-left: -20px;
	margin-top: -8px;
	margin-bottom: 20px;
	padding: 0 20px;
	width: calc(100% + 40px);
}
.woocommerce-product-tabs-layout__header-wrapper {
	align-items: center;
	display: flex;
	min-height: 60px;
	padding-right: 20px;
}
.woocommerce-product-tabs-layout__header-heading {
	align-items: center;
	background: #fff;
	display: flex !important;
	flex: 1 auto;
	font-size: 14px;
	font-weight: 600;
	height: 60px;
	margin: 0;
	padding: 0;
}
.woocommerce-product-tabs-layout__header .links-area p {
	margin: 0;
	color: #3c434a;
}
.woocommerce-product-tabs-layout__header .links-area a {
	text-decoration: none;
}
.woocommerce-product-tabs-layout__header .links-area a:hover,
.woocommerce-product-tabs-layout__header .links-area a:focus {
	text-decoration: underline;
}

.post-type-dptbfw_tab .wp-heading-inline {
	margin-top: 20px;
	font-weight: 600;
	font-size: 1.3em;
}

.post-type-dptbfw_tab .wta-sub-heading {
	font-size: 13px;
	line-height: 1.5;
	margin: 1em 0;
	color: #646970;
}

/* Slight spacing before the WP nav tabs under the header */
.woocommerce-nav-tab-wrapper {
	margin-top: 8px;
}

@media (prefers-color-scheme: dark) {
	.woocommerce-product-tabs-layout__header {
	background: #1e1e1e;
	border-color: #3c434a;
	}
	.woocommerce-product-tabs-layout__header-heading {
	color: #f0f0f1;
	}
	.woocommerce-product-tabs-layout__header .links-area p {
	color: #c3c4c7;
	}
}

#dptbfw-product-tabs-metabox.dptbfw-wrap {
	margin-top: 8px;
}

#dptbfw-product-tabs-metabox .description {
	color: #646970;
}

@media (prefers-color-scheme: dark) {
	#dptbfw-product-tabs-metabox .description {
		color: #c3c4c7;
	}
}

.dptbfw-tabs-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.dptbfw-tab-item {
	border: 1px solid #ccd0d4;
	background: #fff;
	border-radius: 4px;
	margin: 10px 0;
}

.dptbfw-tab-item__header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	background: #f6f7f7;
	border-bottom: 1px solid #ccd0d4;
}

.dptbfw-sort-handle {
	cursor: move;
	color: #646970;
	touch-action: none;
	-ms-touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

.dptbfw-tab-item__title {
	flex: 1 1 auto;
}

.dptbfw-remove-tab {
	color: #a00;
	text-decoration: none;
	font-weight: 600;
	font-size: 18px;
	line-height: 1;
}

.dptbfw-remove-tab:hover,
.dptbfw-remove-tab:focus {
	color: #dc3232;
}

.dptbfw-tab-item__fields {
	padding: 10px;
}

.dptbfw-tab-item__fields p {
	margin: 10px 0;
}

.dptbfw-tab-item__fields textarea.widefat {
	min-height: 140px;
}

/* Sortable placeholder */
.dptbfw-sort-placeholder {
	border: 2px dashed #b3b9bf;
	background: #f0f0f1;
	height: 42px;
	margin: 10px 0;
}

/* Settings page: sortable lists (default Woo tabs, global tabs, unified all tabs) */
#dptbfw-default-tabs-order,
#dptbfw-global-tabs-order,
#dptbfw-all-tabs-order {
	list-style: none;
	margin: 8px 0 16px;
	padding: 0;
	max-width: 520px;
}

#dptbfw-default-tabs-order .dptbfw-sortable-item,
#dptbfw-global-tabs-order .dptbfw-sortable-item,
#dptbfw-all-tabs-order .dptbfw-sortable-item {
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid #ccd0d4;
	background: #fff;
	border-radius: 4px;
	margin: 8px 0;
	padding: 6px 10px;
}

#dptbfw-default-tabs-order .dashicons-move,
#dptbfw-global-tabs-order .dashicons-move,
#dptbfw-all-tabs-order .dashicons-move {
	cursor: move;
	color: #646970;
}

/* Reorder tab (All Tabs): WordPress Components-like styling */
.dptbfw-reorder-card .components-card__body {
	padding: 0; /* item group expects flush edges */
}

#dptbfw-all-tabs-order.components-item-group {
	margin: 8px 0 16px;
	padding: 0;
	max-width: 520px;
}

#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item {
	display: flex;
	align-items: center;
	gap: 8px;
	background: #fff;
	border: 1px solid #ccd0d4;
	border-radius: 4px;
	margin: 8px 0;
	padding: 8px 12px; /* aligns with components-item default spacing */
}
#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item:hover {
	background: #f9f9f9;
	border-color: #c7cfd8;
}
#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item.ui-sortable-helper,
#dptbfw-all-tabs-order.components-item-group .dptbfw-drag-helper {
	box-shadow: 0 2px 8px rgba(0,0,0,.1);
	cursor: grabbing;
}
#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .dptbfw-sort-handle {
	cursor: grab;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: #646970;
	padding: 4px;
	touch-action: none;
	-ms-touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}
#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .dptbfw-sort-handle:active {
	cursor: grabbing;
}
#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .dptbfw-grip-icon {
	width: 18px;
	height: 18px;
	fill: currentColor;
	opacity: .85;
}
@media (prefers-color-scheme: dark) {
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item {
	background: #1e1e1e;
	border-color: #3c434a;
	}
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item:hover {
	background: #2c3338;
	border-color: #50575e;
	}
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item,
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .components-text {
	color: #f0f0f1;
	}
}

#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .dptbfw-sort-handle {
	cursor: move;
	background: transparent;
	touch-action: none;
	-ms-touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
	touch-action: none;
	-ms-touch-action: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .components-text {
	flex: 1 1 auto;
	font-weight: 600;
}

/* Placeholder sized like a components item */
#dptbfw-all-tabs-order.components-item-group .dptbfw-sort-placeholder {
	height: 40px;
	border: 2px dashed #b3b9bf;
	background: #f0f0f1;
	margin: 0;
}

@media (prefers-color-scheme: dark) {
	#dptbfw-all-tabs-order.components-item-group .dptbfw-sort-placeholder {
	background: #2c3338;
	border-color: #3c434a;
	}
}

/* Small helper styles */
.dptbfw-icon-preview {
	margin-left: 6px;
	color: #646970;
	opacity: 0.9;
}

/* Icon Picker: action row under inputs */
.dptbfw-icon-picker-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 6px;
}

/* Icon Picker: modal */
.dptbfw-icon-modal {
	position: fixed;
	inset: 0;
	z-index: 100000; /* above WP admin notices */
	display: none;
}
.dptbfw-icon-modal.is-open {
	display: block;
}
.dptbfw-icon-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}
.dptbfw-icon-modal__dialog {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	background: #fff;
	color: #1e1e1e;
	border: 1px solid #ccd0d4;
	border-radius: 6px;
	box-shadow: 0 10px 50px rgba(0,0,0,0.25);
	width: 720px;
	max-width: calc(100vw - 40px);
	max-height: calc(100vh - 40px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.dptbfw-icon-modal__header {
	display: flex;
	justify-content: flex-start;
	align-items: center;
	padding: 10px 12px;
	background: #f6f7f7;
	border-bottom: 1px solid #ccd0d4;
}
.dptbfw-icon-modal__header h2 {
	margin: 0;
	font-size: 16px;
}
.dptbfw-icon-modal__body {
	padding: 12px;
	overflow: auto;
}
.dptbfw-icon-modal__search {
	width: 100%;
	max-width: 100%;
	margin: 0 0 12px;
}
.dptbfw-icon-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
	gap: 8px;
}
.dptbfw-icon-item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	border: 1px solid #ccd0d4;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
}
.dptbfw-icon-item:hover,
.dptbfw-icon-item:focus {
	background: #f0f0f1;
	border-color: #949aa0;
}
.dptbfw-icon-item .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}
.dptbfw-icon-item .fa-solid,
.dptbfw-icon-item .fa-brands {
	font-size: 20px;
	width: 20px;
	height: 20px;
	line-height: 1;
}
.dptbfw-icon-preview i,
.dptbfw-pt-icon-preview i {
	font-size: 16px;
	line-height: 1;
}

/* Icon Picker: WordPress Components-like modal */
.components-modal__screen-overlay.is-dptbfw {
	position: fixed;
	inset: 0;
	z-index: 100000; /* above WP admin notices */
	display: none;
	background: rgba(0, 0, 0, 0.45);
}
.components-modal__screen-overlay.is-dptbfw.is-open {
	display: flex;
	align-items: center;
	justify-content: center;
}
.components-modal__screen-overlay.is-dptbfw .components-modal__frame {
	position: relative;
	top: auto;
	left: auto;
	transform: none;
	background: #fff;
	color: #1e1e1e;
	border: 1px solid #ccd0d4;
	border-radius: 6px;
	box-shadow: 0 10px 50px rgba(0,0,0,0.25);
	width: 720px;
	max-width: calc(100vw - 40px);
	max-height: calc(100vh - 40px);
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.components-modal__screen-overlay.is-dptbfw .components-modal__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 12px;
	background: #f6f7f7;
	border-bottom: 1px solid #ccd0d4;
	/* Keep header above scrollable content and prevent overlap */
	position: sticky;
	top: 0;
	z-index: 2;
}
.components-modal__screen-overlay.is-dptbfw .components-modal__header-heading {
	margin: 0;
	font-size: 16px;
}
.components-modal__screen-overlay.is-dptbfw .components-modal__content {
	padding: 0;
	overflow: auto;
}
.components-modal__screen-overlay.is-dptbfw .components-modal__content-area {
	padding: 12px;
	/* Make inner area scrollable while header stays fixed */
	flex: 1 1 auto;
	overflow: auto;
	min-height: 0; /* allow flex child to shrink and enable scrolling */
}

/* Ensure the icon picker body can shrink inside the scroll container */
.components-modal__screen-overlay.is-dptbfw .dptbfw-icon-modal__body {
	min-height: 0;
}

/* Tweak picker body inside components modal */
.components-modal__screen-overlay.is-dptbfw .dptbfw-icon-modal__search {
	width: 100%;
	max-width: 100%;
	margin: 0 0 12px;
}
.components-modal__screen-overlay.is-dptbfw .dptbfw-icon-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
	gap: 8px;
}
.components-modal__screen-overlay.is-dptbfw .dptbfw-icon-item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 44px;
	border: 1px solid #ccd0d4;
	background: #fff;
	border-radius: 4px;
	cursor: pointer;
}
.components-modal__screen-overlay.is-dptbfw .dptbfw-icon-item:hover,
.components-modal__screen-overlay.is-dptbfw .dptbfw-icon-item:focus {
	background: #f0f0f1;
	border-color: #949aa0;
}

@media (prefers-color-scheme: dark) {
	.components-modal__screen-overlay.is-dptbfw .components-modal__frame {
	background: #1e1e1e;
	border-color: #3c434a;
	color: #f0f0f1;
	}
	.components-modal__screen-overlay.is-dptbfw .components-modal__header {
	background: #2c3338;
	border-bottom-color: #3c434a;
	}
}

/* Hide raw icon inputs and helper text (use picker instead) */
input.dptbfw-icon-input {
	display: none !important;
}
input.dptbfw-icon-input + br,
input.dptbfw-icon-input + br + small {
	display: none !important;
}

/* Dark scheme tweaks */
@media (prefers-color-scheme: dark) {
	.dptbfw-tab-item {
	background: #1e1e1e;
	border-color: #3c434a;
	}
	.dptbfw-tab-item__header {
	background: #2c3338;
	border-bottom-color: #3c434a;
	}
	#dptbfw-default-tabs-order .dptbfw-sortable-item,
	#dptbfw-global-tabs-order .dptbfw-sortable-item,
	#dptbfw-all-tabs-order .dptbfw-sortable-item {
	background: #1e1e1e;
	border-color: #3c434a;
	}
	.dptbfw-sort-placeholder {
	background: #2c3338;
	border-color: #3c434a;
	}
	/* Text colors for dark mode to ensure contrast */
	.dptbfw-tab-item,
	.dptbfw-tab-item__header,
	#dptbfw-default-tabs-order .dptbfw-sortable-item,
	#dptbfw-global-tabs-order .dptbfw-sortable-item,
	#dptbfw-all-tabs-order .dptbfw-sortable-item {
	color: #f0f0f1;
	}
	.dptbfw-sort-handle,
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .dptbfw-sort-handle {
	color: #a7aaad;
	}
}

/* Per-tab settings: WordPress Components-like card/table */
.dptbfw-per-tab-card .components-card__body.dptbfw-per-tab-card__body {
	padding: 0; /* flush edges to match components card tables */
	overflow-x: auto; /* allow horizontal scroll on very small screens */
	-webkit-overflow-scrolling: touch;
}

.dptbfw-per-tab-card .dptbfw-per-tab-table {
	border-radius: 0;    /* flush to card edges */
	width: 100%;
	min-width: 820px;
	max-width: 1080px;
}

.dptbfw-per-tab-card .dptbfw-pt-row--head {
	background: #f6f7f7;
	font-weight: 600;
}

.dptbfw-per-tab-card .dptbfw-pt-col {
	padding: 8px 12px; /* components table-like spacing */
}

.dptbfw-per-tab-card .dptbfw-pt-col--tab {
	font-weight: 600;
}

/* Custom checkbox for clearer, thicker checkmark (scoped to our card) */
.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"] {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	width: 20px;
	height: 20px;
	margin: 0;
	display: inline-block;
	vertical-align: middle;
	border: 1px solid #8c8f94; /* WP neutral gray */
	border-radius: 3px;
	background: #fff;
	position: relative;
}
.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"]:hover {
	border-color: #2271b1;
}
.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"]:focus-visible {
	outline: 2px solid #72aee6;
	outline-offset: 2px;
}
.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"]:checked {
	background-color: #135e96; /* darker WP blue for stronger contrast */
	border-color: #135e96;
}
.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"]:checked::after {
	content: '';
	position: absolute;
	left: 5px;
	top: 0px;
	width: 6px;
	height: 12px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(45deg);
}
@media (prefers-color-scheme: dark) {
	.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"] {
	background: #fff;
	border: 1px solid #8c8f94;
	}
	.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"]:checked {
	background-color: #72aee6;
	border-color: #72aee6;
	}
	.dptbfw-per-tab-card .dptbfw-pt-col--hidden input[type="checkbox"]:checked::after {
	border-color: #1e1e1e; /* higher contrast tick on light blue */
	}
}

.dptbfw-per-tab-card .dptbfw-pt-body .dptbfw-pt-row {
	border-top: 1px solid #dcdcde;
}

.dptbfw-per-tab-card .dptbfw-pt-body .dptbfw-pt-row:nth-child(even) {
	background: #fcfcfc; /* subtle zebra striping like components tables */
}

.dptbfw-per-tab-card .dptbfw-pt-body .dptbfw-pt-row:hover {
	background: #f9f9f9;
}

.dptbfw-per-tab-card .dptbfw-pt-body .dptbfw-pt-row.is-active {
	outline: 2px solid #2271b1;
	outline-offset: -2px;
	background: #eef6ff;
}

/* Hide icon picker actions entirely when a row is marked hidden */
.dptbfw-pt-row.dptbfw-is-hidden .dptbfw-icon-picker-actions {
	display: none !important;
}

@media (prefers-color-scheme: dark) {
	.dptbfw-per-tab-card .components-card__body.dptbfw-per-tab-card__body {
	background: #1e1e1e;
	}
	.dptbfw-per-tab-card .dptbfw-pt-row--head {
	background: #2c3338;
	border-bottom-color: #3c434a;
	}
	.dptbfw-per-tab-card .dptbfw-pt-body .dptbfw-pt-row {
	background: #1e1e1e;
	border-top-color: #3c434a;
	}
	.dptbfw-per-tab-card .dptbfw-pt-body .dptbfw-pt-row.is-active {
	background: #23384d;
	outline-color: #72aee6;
	}
	/* Ensure high-contrast text in dark mode */
	.dptbfw-per-tab-card .dptbfw-pt-row--head,
	.dptbfw-per-tab-card .dptbfw-pt-col,
	.dptbfw-per-tab-card .dptbfw-pt-col label,
	.dptbfw-per-tab-card .dptbfw-pt-icon-preview {
	color: #f0f0f1;
	}
	.dptbfw-per-tab-card .dptbfw-pt-col .description {
	color: #c3c4c7;
	}
}

/* Per-tab settings: table-like layout */
.dptbfw-per-tab-table {
	margin: 8px 0 16px;
	border: 1px solid #ccd0d4;
	background: #fff;
	border-radius: 4px;
	overflow: hidden;
	box-sizing: border-box;
	width: 100%;
	max-width: 100%;
}
.dptbfw-per-tab-table [role="row"] {
	display: grid;
	grid-template-columns: 1.2fr 120px 1.5fr 1.3fr;
	align-items: center;
}
.dptbfw-pt-row--head {
	background: #f6f7f7;
	font-weight: 600;
}
.dptbfw-pt-body .dptbfw-pt-row {
	border-top: 1px solid #edf0f1;
	background: #fff;
}
.dptbfw-pt-col {
	padding: 10px 12px;
}
.dptbfw-pt-col--hidden {
	text-align: center;
}
.dptbfw-pt-col--hidden label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.dptbfw-pt-col--label input.regular-text,
.dptbfw-pt-col--icon input.regular-text {
	width: 100%;
	max-width: 100%;
}
.dptbfw-per-tab-table .dptbfw-icon-picker-actions {
	margin-top: 0;
	gap: 6px;
	float: right;
	visibility: hidden;
}

.dptbfw-per-tab-table .dptbfw-pt-row:hover .dptbfw-icon-picker-actions,
.dptbfw-per-tab-table .dptbfw-pt-row:focus-within .dptbfw-icon-picker-actions,
.dptbfw-per-tab-table .dptbfw-pt-row.is-active .dptbfw-icon-picker-actions {
	visibility: visible;
}

/* Ensure actions are visible on touch devices that don't support hover */
@media (hover: none) {
	.dptbfw-per-tab-table .dptbfw-icon-picker-actions {
	visibility: visible;
	}
}
/* Avoid duplicate icon previews in per-tab table (we use a custom preview span there) */
.dptbfw-per-tab-table .dptbfw-icon-preview {
	display: none;
}
.dptbfw-pt-icon-preview {
	margin-left: 8px;
	margin-top: 5px;
	color: #646970;
	opacity: 0.9;
	float: left;
}
.dptbfw-pt-body .dptbfw-pt-row:hover {
	background: #f8f9fa;
}
.dptbfw-pt-body .dptbfw-pt-row.is-active {
	outline: 2px solid #2271b1;
	outline-offset: -2px;
	background: #eef6ff;
}

/* Legacy in-place per-tab table (when WP table remains and rows are enhanced dynamically) */
table.form-table.dptbfw-per-tab-table--legacy {
	border: 1px solid #ccd0d4;
	background: #fff;
	border-radius: 4px;
	overflow: hidden;
}
.dptbfw-per-tab-table--legacy tr > th { display: none; }
.dptbfw-per-tab-table--legacy tr > td { padding: 0; }
.dptbfw-per-tab-table--legacy .dptbfw-legacy-row {
	display: grid;
	grid-template-columns: 1.2fr 120px 1.5fr 1.3fr;
	align-items: center;
	padding: 10px 12px;
	border-top: 1px solid #edf0f1;
	background: #fff;
}
.dptbfw-per-tab-table--legacy .dptbfw-legacy-row:first-child {
	border-top: 0;
}
.dptbfw-per-tab-table--legacy .dptbfw-pt-col--hidden { text-align: center; }
.dptbfw-per-tab-table--legacy .dptbfw-pt-col--label input.regular-text,
.dptbfw-per-tab-table--legacy .dptbfw-pt-col--icon input.regular-text { width: 100%; max-width: 100%; }
.dptbfw-per-tab-table--legacy .dptbfw-legacy-row:hover { background: #f8f9fa; }
.dptbfw-per-tab-table--legacy .dptbfw-legacy-row.is-active { outline: 2px solid #2271b1; outline-offset: -2px; background: #eef6ff; }
@media (max-width: 900px) {
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row { grid-template-columns: 1fr 90px 1fr 1fr; }
	.dptbfw-per-tab-card .dptbfw-per-tab-table {
	border-radius: 0;    /* flush to card edges */
	width: 100%;
	min-width: auto;
	max-width: 100%;
}
}
@media (max-width: 600px) {
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row { grid-template-columns: 1fr; }
	.dptbfw-per-tab-table--legacy .dptbfw-pt-col { border-top: 1px dashed #e2e4e7; }
	.dptbfw-per-tab-table--legacy .dptbfw-pt-col:first-child { border-top: 0; }
	.dptbfw-per-tab-table--legacy .dptbfw-pt-col--hidden { text-align: left; }
}
@media (prefers-color-scheme: dark) {
	table.form-table.dptbfw-per-tab-table--legacy { background: #1e1e1e; border-color: #3c434a; }
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row { background: #1e1e1e; border-top-color: #3c434a; }
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row:hover { background: #2c3338; }
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row.is-active { background: #23384d; outline-color: #72aee6; }
}
/* Responsive tweaks */
@media (max-width: 900px) {
	.dptbfw-per-tab-table [role="row"] {
	grid-template-columns: 1fr 90px 1fr 1fr;
	}
}
@media (max-width: 600px) {
	.dptbfw-per-tab-table [role="row"] {
	grid-template-columns: 1fr;
	}
	.dptbfw-pt-row--head { display: none; }
	.dptbfw-pt-col { border-top: 1px dashed #e2e4e7; }
	.dptbfw-pt-col:first-child { border-top: 0; }
	.dptbfw-pt-col--hidden { text-align: left; }
	/* Ensure action elements stack on small screens */
	.dptbfw-per-tab-table .dptbfw-icon-picker-actions { float: none; justify-content: flex-start; visibility: visible; }
	.dptbfw-pt-icon-preview { float: none; margin-left: 0; }
}

/* Dark scheme tweaks for per-tab table */
@media (prefers-color-scheme: dark) {
	.dptbfw-per-tab-table {
	background: #1e1e1e;
	border-color: #3c434a;
	}
	.dptbfw-pt-row--head {
	background: #2c3338;
	border-bottom-color: #3c434a;
	}
	.dptbfw-pt-body .dptbfw-pt-row {
	background: #1e1e1e;
	border-top-color: #3c434a;
	}
	.dptbfw-pt-body .dptbfw-pt-row:hover {
	background: #2c3338;
	}
	.dptbfw-pt-body .dptbfw-pt-row.is-active {
	background: #23384d;
	outline-color: #72aee6;
	}
	/* Ensure table text remains readable in dark mode */
	.dptbfw-per-tab-table,
	.dptbfw-pt-row--head,
	.dptbfw-pt-col,
	.dptbfw-pt-col label,
	.dptbfw-pt-icon-preview {
	color: #f0f0f1;
	}
	.dptbfw-per-tab-table,
	.dptbfw-pt-row--head,
	.dptbfw-pt-col,
	.dptbfw-pt-col label,
	.dptbfw-pt-icon-preview {
	color: #f0f0f1;
	}
}

/* Admin Product Data: Accordion for multiple overrides */
#dptbfw_product_data .options_group dptbfw-override-fields {
	padding: 10px;
}
.dptbfw-override-fields {
	padding: 5px;
}
.dptbfw-accordion {
	background: #fff;
	overflow: hidden;
	margin: 10px;
}
.dptbfw-accordion__item {
	border-top: 0;
	border: 1px solid #ccd0d4;
	margin-bottom: 20px;
}
.dptbfw-accordion__header {
	width: 100%;
	display: flex;
	align-items: center;
	gap: 12px;
	justify-content: flex-start;
	flex-wrap: wrap;
	row-gap: 6px;
	background: transparent;
	color: #1e1e1e;
	border: 0;
	padding: 10px 12px;
	cursor: pointer;
	text-align: left;
}
.dptbfw-accordion__header[aria-expanded="true"] {
	background-color: #fcfcfc;
}
.dptbfw-accordion__title {
	font-weight: 600;
	flex: 0 1 auto; /* do not grow; allow right controls to push fully right */
	min-width: 160px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.dptbfw-accordion__enable label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 400;
	color: #3c434a;
}
.dptbfw-accordion__enable,
.dptbfw-accordion__hide {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	white-space: nowrap;
	flex: 0 0 240px; /* give each control its own column width */
	width: 240px;
}
.dptbfw-accordion__enable { margin-left: auto; }
.dptbfw-accordion__hide { margin-left: 0; }
.dptbfw-accordion__hide label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: 400;
	color: #3c434a;
}
.dptbfw-accordion__toggle.dashicons {
	transition: transform 0.15s ease-in-out, opacity 0.15s ease-in-out;
	opacity: 0.85;
	margin-left: 8px; /* arrow sits immediately after the controls; title flex pushes group to the right */
}
.dptbfw-accordion__header[aria-expanded="true"] .dptbfw-accordion__toggle {
	transform: rotate(-180deg);
}
.dptbfw-accordion__body {
	padding: 12px 12px 20px;
	background: #fcfcfc;
}
.dptbfw-accordion__body .wp-editor-wrap {
	margin-top: 4px; /* space under enable row */
}
.dptbfw-accordion__body .description {
	margin-top: 8px;
}

/* Right-align controls and pin arrow to the far right */
.dptbfw-accordion__header {
	position: relative;
	padding-right: 36px; /* leave space for the arrow on the right */
}
.dptbfw-accordion__enable {
	margin-left: auto; /* push the control group to the right */
}
.dptbfw-accordion__toggle.dashicons {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%); /* center vertically */
	margin-left: 0; /* remove any left margin so it sits flush to the edge */
}
.dptbfw-accordion__header[aria-expanded="true"] .dptbfw-accordion__toggle {
	transform: translateY(-50%) rotate(-180deg);
}

/* Wide screens: force right-aligned controls using CSS Grid (more robust than flex) */
@media (min-width: 960px) {
	.dptbfw-accordion__header {
	/* Use grid to lock columns: Title | Enable | Hide | Arrow */
	display: grid !important;
	grid-template-columns: 1fr 140px 90px 0px;
	align-items: center;
	gap: 12px;
	/* No need to reserve right padding for absolute arrow; keep natural spacing */
	padding-right: 12px;
	position: relative; /* default; not used for absolute arrow anymore on wide */
	}
	.dptbfw-accordion__title {
	min-width: 0; /* allow shrinking */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	}
	.dptbfw-accordion__enable,
	.dptbfw-accordion__hide {
	margin-left: 0;   /* grid places them explicitly; no auto margins */
	width: auto;      /* fill the 240px track as contents need */
	justify-self: end; /* align content to the right edge of each grid cell */
	}
	.dptbfw-accordion__toggle.dashicons {
	/* put arrow in the last, narrow column and align right */
	position: static;
	margin-left: 0;
	justify-self: end;
	transform: none;
	}
	.dptbfw-accordion__header[aria-expanded="true"] .dptbfw-accordion__toggle {
	transform: rotate(-180deg);
	}
}

/* Responsive behavior for header controls to avoid overlap */
@media (max-width: 900px) {
	.dptbfw-accordion__enable,
	.dptbfw-accordion__hide {
	flex: 1 1 260px;
	width: auto;
	max-width: 100%;
	}
}
@media (max-width: 600px) {
	.dptbfw-accordion__enable,
	.dptbfw-accordion__hide {
	flex: 1 1 100%;
	width: auto;
	}
}

@media (prefers-color-scheme: dark) {
	.dptbfw-accordion {
	background: #1e1e1e;
	border-color: #3c434a;
	}
	.dptbfw-accordion__item {
	border-top-color: #3c434a;
	}
	.dptbfw-accordion__header {
	background: #2c3338;
	color: #f0f0f1;
	}
	.dptbfw-accordion__enable label,
	.dptbfw-accordion__hide label {
	color: #c3c4c7;
	}
	.dptbfw-accordion__body {
	background: #1e1e1e;
	}
}

/* Force light palette for plugin UI even when OS/browser prefers dark */
@media (prefers-color-scheme: dark) {
	/* Header */
	.woocommerce-product-tabs-layout__header { background: #fff; border-color: #ccd0d4; }
	.woocommerce-product-tabs-layout__header-heading { color: #1e1e1e; }
	.woocommerce-product-tabs-layout__header .links-area p { color: #3c434a; }

	/* Sortable/Reorder (All Tabs) */
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item { background: #fff; border-color: #ccd0d4; color: #1e1e1e; }
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item:hover { background: #f9f9f9; border-color: #c7cfd8; }
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .dptbfw-sort-handle { color: #646970; }
	#dptbfw-all-tabs-order.components-item-group .dptbfw-reorder-item .components-text { color: #1e1e1e; }

	/* Tab items and basic sortable lists */
	.dptbfw-tab-item { background: #fff; border-color: #ccd0d4; color: #1e1e1e; }
	.dptbfw-tab-item__header { background: #f6f7f7; border-bottom-color: #ccd0d4; color: #1e1e1e; }
	#dptbfw-default-tabs-order .dptbfw-sortable-item,
	#dptbfw-global-tabs-order .dptbfw-sortable-item,
	#dptbfw-all-tabs-order .dptbfw-sortable-item { background: #fff; border-color: #ccd0d4; color: #1e1e1e; }
	.dptbfw-sort-placeholder { background: #f0f0f1; border-color: #b3b9bf; }
	.dptbfw-sort-handle { color: #646970; }

	/* Per-tab card/table (components-like) */
	.dptbfw-per-tab-card .components-card__body.dptbfw-per-tab-card__body { background: initial }
	.dptbfw-per-tab-card .dptbfw-pt-row--head { background: #f6f7f7; border-bottom-color: #ccd0d4; color: #1e1e1e; }
	.dptbfw-per-tab-card .dptbfw-pt-body .dptbfw-pt-row { background: #fff; border-top-color: #edf0f1; color: #1e1e1e; }
	.dptbfw-per-tab-card .dptbfw-pt-col,
	.dptbfw-per-tab-card .dptbfw-pt-col label { color: #1e1e1e; }
	.dptbfw-per-tab-card .dptbfw-pt-col .description { color: #646970; }
	.dptbfw-pt-icon-preview { color: #646970; }

	/* Per-tab table (generic) */
	.dptbfw-per-tab-table { background: #fff; border-color: #ccd0d4; color: #1e1e1e; }
	.dptbfw-pt-row--head,
	.dptbfw-pt-col,
	.dptbfw-pt-col label { color: #1e1e1e; }

	/* Legacy table */
	table.form-table.dptbfw-per-tab-table--legacy { background: #fff; border-color: #ccd0d4; color: #1e1e1e; }
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row { background: #fff; border-top-color: #edf0f1; }
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row:hover { background: #f8f9fa; }
	.dptbfw-per-tab-table--legacy .dptbfw-legacy-row.is-active { background: #eef6ff; outline-color: #2271b1; }

	/* Accordion */
	.dptbfw-accordion { background: #fff; border-color: #ccd0d4; }
	.dptbfw-accordion__item { border-top-color: #ccd0d4; }
	.dptbfw-accordion__header { background: transparent; color: #1e1e1e; }
	.dptbfw-accordion__enable label,
	.dptbfw-accordion__hide label { color: #3c434a; }
	.dptbfw-accordion__body { background: #fcfcfc; }

	/* Meta box descriptions */
	#dptbfw-product-tabs-metabox .description { color: #646970; }

	/* Icon Picker modal */
	.components-modal__screen-overlay.is-dptbfw .components-modal__frame { background: #fff; border-color: #ccd0d4; color: #1e1e1e; }
	.components-modal__screen-overlay.is-dptbfw .components-modal__header { background: #f6f7f7; border-bottom-color: #ccd0d4; }
}
