.wpps-media-folders-sidebar,
.wpps-modal {
	--wpps-cf-accent: var(--wpps-accent, var(--wp-admin-theme-color, #2271b1));
	--wpps-cf-accent-hover: var(--wpps-accent-hover, var(--wp-admin-theme-color-darker-10, #135e96));
	--wpps-cf-accent-bg: color-mix(in srgb, var(--wpps-cf-accent) 12%, #fff);
	--wpps-cf-accent-soft: color-mix(in srgb, var(--wpps-cf-accent) 20%, transparent);
}

.wpps-media-folders-sidebar {
	position: fixed;
	top: 32px;
	left: 160px;
	right: auto;
	bottom: 0;
	width: 280px;
	direction: ltr;
	background: #f0f0f1;
	border-right: 1px solid #c3c4c7;
	z-index: 8;
	display: flex;
	flex-direction: column;
	transition: transform 0.2s ease, width 0.2s ease;
}

.wpps-media-folders-sidebar.wpps-sidebar-hidden {
	transform: translateX(-100%);
}

.wpps-media-folders-sidebar.wpps-sidebar-hidden .wpps-sidebar-show-tab {
	left: auto;
	right: 0;
	transform: translateX(100%) translateY(-50%);
	border-left: 1px solid #c3c4c7;
	border-right: none;
	border-radius: 0 4px 4px 0;
	box-shadow: 2px 0 4px rgba(0,0,0,0.06);
}

.wpps-sidebar-show-tab {
	position: absolute;
	top: 50%;
	left: 0;
	transform: translateX(-100%) translateY(-50%);
	width: 32px;
	height: 80px;
	padding: 8px 4px;
	background: #f0f0f1;
	border: 1px solid #c3c4c7;
	border-right: none;
	border-radius: 4px 0 0 4px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	color: #50575e;
	box-shadow: -2px 0 4px rgba(0,0,0,0.06);
	z-index: 1;
}

.wpps-sidebar-show-tab:hover {
	background: #e0e0e0;
	color: #1d2327;
}

.wpps-sidebar-show-tab .dashicons {
	font-size: 20px;
	width: 20px;
	height: 20px;
}

.wpps-sidebar-show-tab-label {
	font-size: 10px;
	line-height: 1.2;
	writing-mode: vertical-rl;
	text-orientation: mixed;
	letter-spacing: 0.5px;
}

.wpps-media-folders-sidebar:not(.wpps-sidebar-hidden) .wpps-sidebar-show-tab {
	display: none;
}

.wpps-sidebar-inner {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-height: 0;
	overflow: hidden;
}

.wpps-sidebar-header {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 12px 10px;
	border-bottom: 1px solid #c3c4c7;
	background: #fff;
	flex-shrink: 0;
}

.wpps-sidebar-title {
	flex: 1;
	font-weight: 600;
	font-size: 14px;
}

.wpps-sidebar-toggle,
.wpps-sidebar-settings {
	background: none;
	border: none;
	padding: 4px;
	cursor: pointer;
	color: #50575e;
	border-radius: 2px;
}

.wpps-sidebar-toggle:hover,
.wpps-sidebar-settings:hover {
	color: #1d2327;
	background: #f0f0f1;
}

.wpps-sidebar-nav {
	padding: 8px 0;
	border-bottom: 1px solid #c3c4c7;
	flex-shrink: 0;
}

.wpps-nav-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	color: #1d2327;
	text-decoration: none;
	font-size: 13px;
}

.wpps-nav-item:hover {
	background: rgba(0, 0, 0, 0.04);
}

.wpps-nav-item.wpps-nav-active {
	background: var(--wpps-cf-accent);
	color: #fff;
}

.wpps-nav-item .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.wpps-nav-item .wpps-count {
	margin-left: 4px;
	font-size: 12px;
	opacity: 0.9;
}

.wpps-sidebar-folders {
	flex: 1 1 0;
	min-height: 0;
	overflow-y: auto;
	padding: 8px 0 12px 0;
}

.wpps-folders-toolbar {
	display: flex;
	gap: 6px;
	padding: 0 10px 10px;
	border-bottom: 1px solid #c3c4c7;
	margin-bottom: 8px;
}

.wpps-new-folder-input {
	flex: 1;
	padding: 6px 8px;
	font-size: 13px;
	border: 1px solid #8c8f94;
	border-radius: 2px;
}

.wpps-add-folder-btn {
	flex-shrink: 0;
}

.wpps-folder-tree {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpps-folder-tree .wpps-folder-children {
	list-style: none;
	margin: 0;
	padding-left: 16px;
	border-left: 1px solid #c3c4c7;
	margin-left: 8px;
}

.wpps-folder-item > .wpps-folder-children {
	display: none;
}
.wpps-folder-item.wpps-folder-expanded > .wpps-folder-children {
	display: block;
}
.wpps-folder-item.wpps-folder-expanded > .wpps-folder-row > .wpps-folder-toggle {
	transform: rotate(90deg);
}
.wpps-folder-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	padding: 2px 2px 2px 0;
	line-height: 1;
	cursor: pointer;
	color: #646970;
	flex-shrink: 0;
	margin-right: 4px;
}
.wpps-folder-toggle:hover {
	color: var(--wpps-cf-accent);
}
.wpps-folder-toggle.dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.wpps-folder-item {
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	border-radius: 2px;
}

.wpps-folder-row {
	display: flex;
	align-items: center;
	position: relative;
	flex: 1 1 100%;
	width: 100%;
	min-width: 0;
	border-radius: 2px;
}

.wpps-folder-item > .wpps-folder-children {
	flex-basis: 100%;
	width: 100%;
}

.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) {
	background: var(--wpps-cf-accent);
}
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-link {
	background: transparent;
	color: #fff;
}
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-drag-handle,
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-toggle {
	color: #fff;
}
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-drag-handle:hover {
	color: rgba(255, 255, 255, 0.9);
}
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-actions .wpps-add-subfolder,
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-actions .wpps-folder-edit,
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-actions .wpps-folder-delete {
	color: #fff;
}
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-actions .wpps-add-subfolder:hover,
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-actions .wpps-folder-edit:hover,
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-actions .wpps-folder-delete:hover {
	color: rgba(255, 255, 255, 0.85);
}
.wpps-folder-row:has(> .wpps-folder-link.wpps-nav-active) > .wpps-folder-actions {
	opacity: 1;
}

.wpps-folder-drag-handle {
	cursor: move;
	padding: 4px 2px;
	margin-right: 2px;
	color: #646970;
	flex-shrink: 0;
}
.wpps-folder-drag-handle:hover {
	color: var(--wpps-cf-accent);
}
.wpps-folder-drag-handle .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

.wpps-folder-item.ui-sortable-helper {
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	transform: rotate(2deg);
}
.wpps-folder-item.ui-sortable-placeholder {
	background: var(--wpps-cf-accent-bg);
	border: 2px dashed var(--wpps-cf-accent);
	min-height: 32px;
	visibility: visible !important;
	list-style: none;
}

.wpps-folder-link {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 6px 10px;
	padding-right: 6px;
	flex: 0 1 auto;
	min-width: 0;
	color: #1d2327;
	text-decoration: none;
	font-size: 13px;
	border-radius: 2px;
}

.wpps-folder-item:hover:not(:has(.wpps-folder-link.wpps-nav-active)) > .wpps-folder-row {
	background: rgba(0, 0, 0, 0.04);
}
.wpps-folder-item:has(.wpps-folder-item:hover) > .wpps-folder-row:not(:has(> .wpps-folder-link.wpps-nav-active)) {
	background: transparent;
}
.wpps-folder-item:hover > .wpps-folder-row > .wpps-folder-link {
	background: transparent;
}

.wpps-folder-link.wpps-nav-active {
	background: var(--wpps-cf-accent);
	color: #fff;
}

.wpps-folder-link .dashicons {
	font-size: 16px;
	width: 16px;
	height: 16px;
	flex-shrink: 0;
}

.wpps-folder-name-wrap {
	display: inline-flex;
	align-items: baseline;
	flex: 1 1 0;
	min-width: 0;
	gap: 2px;
}

.wpps-folder-name-wrap .wpps-folder-name {
	flex: 0 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wpps-folder-name-wrap .wpps-count {
	flex: 0 0 auto;
	font-size: 12px;
	opacity: 0.85;
	white-space: nowrap;
}

.wpps-folder-actions {
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	opacity: 0;
	transition: opacity 0.15s;
}

.wpps-folder-item:hover > .wpps-folder-row > .wpps-folder-actions {
	opacity: 1;
}
.wpps-folder-item:has(.wpps-folder-item:hover) > .wpps-folder-row > .wpps-folder-actions {
	opacity: 0;
}

.wpps-folder-actions .wpps-folder-action-btn {
	background: none;
	border: none;
	padding: 2px 4px;
	cursor: pointer;
	line-height: 1;
	vertical-align: middle;
}

.wpps-folder-actions .wpps-folder-action-btn .dashicons {
	font-size: 18px;
	width: 18px;
	height: 18px;
}

.wpps-folder-actions .wpps-folder-edit {
	color: var(--wpps-cf-accent);
}

.wpps-folder-actions .wpps-folder-edit:hover {
	color: var(--wpps-cf-accent-hover);
}

.wpps-folder-actions .wpps-folder-delete {
	color: #d63638;
}

.wpps-folder-actions .wpps-folder-delete:hover {
	color: #b32d2e;
}

.wpps-folder-actions .wpps-add-subfolder {
	color: #00a32a;
}
.wpps-folder-actions .wpps-add-subfolder:hover {
	color: #008a20;
}

.wpps-add-subfolder-form {
	list-style: none;
	margin: 0;
	padding: 4px 10px 6px 10px;
}
.wpps-add-subfolder-input-wrap {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-wrap: wrap;
}
.wpps-add-subfolder-input {
	flex: 1;
	min-width: 80px;
	padding: 4px 8px;
	font-size: 12px;
}
.wpps-add-subfolder-form .button {
	flex-shrink: 0;
}

.wpps-sidebar-resize-handle {
	position: absolute;
	top: 0;
	right: 0;
	width: 4px;
	height: 100%;
	cursor: col-resize;
}

.wpps-sidebar-resize-handle:hover {
	background: var(--wpps-cf-accent-soft);
}

.wpps-media-folders-sidebar.wpps-sidebar-hidden .wpps-sidebar-resize-handle {
	visibility: hidden;
	pointer-events: none;
}

.wpps-modal {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 100002;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpps-modal-backdrop {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: rgba(0, 0, 0, 0.6);
}

.wpps-modal-content {
	position: relative;
	background: #fff;
	border: 1px solid #c3c4c7;
	box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
	border-radius: 4px;
	min-width: 360px;
	max-width: 90%;
	max-height: 90vh;
	overflow: auto;
}

.wpps-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 16px 20px;
	border-bottom: 1px solid #c3c4c7;
}

.wpps-modal-header h3 {
	margin: 0;
	font-size: 18px;
}

.wpps-modal-close {
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: #50575e;
	padding: 0;
}

.wpps-modal-close:hover {
	color: #1d2327;
}

.wpps-modal-body {
	padding: 20px;
}

.wpps-modal-body .wpps-field {
	margin-bottom: 16px;
}

.wpps-modal-body .wpps-field:last-child {
	margin-bottom: 0;
}

.wpps-modal-body label {
	display: block;
	margin-bottom: 6px;
	font-weight: 600;
	font-size: 13px;
}

.wpps-modal-body input[type="number"],
.wpps-modal-body input[type="text"],
.wpps-modal-body select {
	width: 100%;
	max-width: 280px;
}

.wpps-modal-footer {
	padding: 16px 20px;
	border-top: 1px solid #c3c4c7;
	text-align: right;
}

.wpps-modal-footer .button {
	margin-left: 8px;
}

.wp-list-table .wpps-folder-assign-select {
	max-width: 160px;
	font-size: 12px;
	padding: 2px 6px;
}

.wp-list-table .column-wpps_folder {
	width: 140px;
}

.wpps-notice {
	padding: 8px 12px;
	margin: 10px 0;
	border-left: 4px solid #00a32a;
	background: #f0f6fc;
	font-size: 13px;
}

.wpps-notice.wpps-notice-error {
	border-left-color: #d63638;
	background: #fcf0f1;
}

.media-toolbar .wpps-grid-assign-folder {
	margin: 10px 10px 10px 0;
	vertical-align: middle;
	display: inline-flex;
	align-items: center;
	height: 32px;
	line-height: 1;
}
