/**
 * Media Folder Manager - Admin Styles
 *
 * @package MediaFolderManager
 */

/* Root Container  */
#mfm-root {
	display: flex !important;
	flex-direction: row !important;
	height: calc(100vh - 72px) !important;
	width: 100% !important;
}

/* Sidebar Container */
#mfm-sidebar-container {
	width: 300px !important;
	flex-shrink: 0 !important;
	background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%) !important;
	border-right: 1px solid #e1e5e9 !important;
	box-shadow: 2px 0 8px rgba(0, 0, 0, 0.04) !important;
	overflow-y: auto !important;
	overflow-x: hidden !important;
	display: flex !important;
	flex-direction: column !important;
	visibility: visible !important;
	opacity: 1 !important;
	min-height: 200px !important;
	position: relative !important;
	/* z-index removed to prevent menu display issues */
	pointer-events: auto !important;
}

/* Ensure sidebar content is visible */
#mfm-sidebar-container .mfm-sidebar {
	min-height: 100% !important;
}

#mfm-sidebar-container .mfm-sidebar-content {
	min-height: 100px !important;
}

@media screen and (max-width: 782px) {
	#mfm-sidebar-container {
		top: 46px;
		height: calc(100vh - 46px);
		left: 0 !important;
		width: 100% !important;
		position: relative !important;
	}
}

/* Main Content Adjustment - wpbody-content is now inside flex container */
#mfm-root #wpbody-content {
	flex: 1 !important;
	overflow-y: auto !important;
	margin-left: 0 !important;
	padding-left: 0 !important;
}

/* Remove old margin adjustments since we're using flexbox now */
.mfm-has-sidebar.wrap,
.mfm-has-sidebar .wrap {
	margin-left: 0 !important;
	padding-left: 0 !important;
}

.mfm-has-sidebar.media-frame {
	margin-left: 0 !important;
}

/* Prevent drag overlays from covering the sidebar */
#mfm-sidebar-container {
	pointer-events: auto !important;
	/* Removed z-index to prevent menu display issues */
}

/* Allow pointer events on sidebar children but don't force z-index */
#mfm-sidebar-container * {
	pointer-events: auto !important;
	/* Removed z-index to prevent menu display issues */
}

/* Ensure sidebar is always visible during drag operations */
body.mfm-dragging-media #mfm-sidebar-container,
body.drag-over #mfm-sidebar-container,
body.dragging #mfm-sidebar-container {
	z-index: 1001 !important;
	pointer-events: auto !important;
	visibility: visible !important;
	opacity: 1 !important;
}

/* During internal media drag, suppress WP upload overlay only. */
body.mfm-dragging-media .media-frame .uploader-inline,
body.mfm-dragging-media .media-frame .uploader-dropzone,
body.mfm-dragging-media .media-frame .uploader-inline-content,
body.mfm-dragging-media .media-frame-content .uploader-inline,
body.mfm-dragging-media .media-frame-content .uploader-dropzone,
body.mfm-dragging-media .media-frame-content.drag-over .uploader-inline,
body.mfm-dragging-media .media-frame-content.drag-over .uploader-dropzone {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

/* Keep sidebar above any transient drag overlay layer. */
body.mfm-dragging-media #mfm-sidebar-container {
	position: relative !important;
	z-index: 100000 !important;
}

/* Keep WordPress uploader behavior untouched. */

/* Ensure sidebar is never covered by drag overlay */
#mfm-sidebar-container {
	position: relative !important;
	/* z-index removed to prevent menu display issues */
}

/* Keep uploader elements untouched to avoid blocking uploads. */

/* Ensure sidebar is visible on upload.php */
body.upload-php #mfm-sidebar-container {
	display: block !important;
}

@media screen and (max-width: 782px) {
	.mfm-has-sidebar .wrap {
		margin-left: 0;
		padding-left: 0;
	}
	#mfm-sidebar-container {
		display: none;
	}
}

/* Sidebar */
.mfm-sidebar {
	display: flex;
	flex-direction: column;
	height: 100%;
	background: transparent;
}

.mfm-sidebar-header {
	padding: 18px 20px;
	border-bottom: 1px solid #e1e5e9;
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mfm-sidebar-header h2 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #ffffff;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
/* Modern Button Styles */
.components-button {
	background: #2271b1;
	border: 1px solid #2271b1;
	color: #ffffff;
	padding: 10px 20px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	box-shadow: 0 2px 4px rgba(34, 113, 177, 0.2);
	position: relative;
	overflow: hidden;
	text-transform: none;
	letter-spacing: 0.3px;
	line-height: 1.5;
	min-height: 38px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.components-button::before {
	content: '';
	position: absolute;
	top: 0;
	left: -100%;
	width: 100%;
	height: 100%;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
	transition: left 0.5s;
}

.components-button:hover::before {
	left: 100%;
}

.components-button:hover {
	background: #135e96;
	border-color: #135e96;
	box-shadow: 0 4px 12px rgba(34, 113, 177, 0.35);
	transform: translateY(-1px);
}

.components-button:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(34, 113, 177, 0.3);
}

.components-button:focus {
	outline: none;
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.3);
}

/* Primary Button (New Folder, Save) - Purple Gradient */
.components-button.is-primary {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border: 1px solid transparent;
	color: #ffffff;
	box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
	position: relative;
}

.components-button.is-primary::after {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
	border-radius: 8px;
	pointer-events: none;
}

.components-button.is-primary:hover {
	background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
	box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
	transform: translateY(-2px);
}

.components-button.is-primary:active {
	transform: translateY(0);
	box-shadow: 0 3px 10px rgba(102, 126, 234, 0.4);
}

.components-button.is-primary:focus {
	box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.4), 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Secondary Button (Cancel) */
.components-button:not(.is-primary):not(.is-destructive) {
	background: #ffffff;
	border: 1px solid #c3c4c7;
	color: #2271b1;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.components-button:not(.is-primary):not(.is-destructive):hover {
	background: #f6f7f7;
	border-color: #2271b1;
	color: #135e96;
	box-shadow: 0 2px 6px rgba(34, 113, 177, 0.15);
	transform: translateY(-1px);
}

.components-button:not(.is-primary):not(.is-destructive):active {
	transform: translateY(0);
	box-shadow: 0 1px 3px rgba(34, 113, 177, 0.1);
}

.components-button:not(.is-primary):not(.is-destructive):focus {
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.2);
}

/* Destructive Button */
.components-button.is-destructive {
	background: #dc3232;
	border-color: #dc3232;
	color: #ffffff;
	box-shadow: 0 2px 4px rgba(220, 50, 50, 0.2);
}

.components-button.is-destructive:hover {
	background: #b52727;
	border-color: #b52727;
	box-shadow: 0 4px 12px rgba(220, 50, 50, 0.35);
	transform: translateY(-1px);
}

.components-button.is-destructive:active {
	transform: translateY(0);
	box-shadow: 0 2px 6px rgba(220, 50, 50, 0.3);
}

.components-button.is-destructive:focus {
	box-shadow: 0 0 0 3px rgba(220, 50, 50, 0.3);
}

/* Small Button Variant */
.components-button.is-small {
	padding: 8px 16px;
	font-size: 12px;
	min-height: 32px;
	border-radius: 6px;
}

/* Disabled State */
.components-button:disabled,
.components-button[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
	pointer-events: none;
	transform: none !important;
	box-shadow: none !important;
}
/* Toolbar*/
.mfm-toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin: 0 16px;
	padding: 11px 10px;
	border: 1px solid #ccd0d4;
	background: #fff;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
	gap: 5px;
}

.mfm-toolbar .components-button {
	margin: 0;
	font-size: 13px;
	height: 30px;
	min-height: 30px;
	padding: 0 8px;
}

.mfm-toolbar .components-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.mfm-sidebar-content {
	flex: 1;
	padding: 8px;
	overflow-y: auto;
	min-height: 200px;
}

.mfm-sidebar-content:empty::before {
	content: 'Loading...';
	display: block;
	padding: 20px;
	text-align: center;
	color: #666;
}

/* Create Folder Form - Inline in sidebar */
.mfm-create-folder-form {
	padding: 16px;
	border-bottom: 1px solid #c3c4c7;
	background: #fff;
}

.mfm-create-folder-input-wrapper {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
}

.mfm-create-folder-input-wrapper .mfm-folder-icon {
	font-size: 16px;
	flex-shrink: 0;
}

.mfm-create-folder-input {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid #2271b1;
	border-radius: 4px;
	font-size: 13px;
	line-height: 1.5;
}

.mfm-create-folder-input:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

.mfm-create-folder-actions {
	display: flex;
	gap: 10px;
	justify-content: flex-end;
	margin-top: 4px;
}

.mfm-create-folder-actions .components-button {
	margin: 0;
	min-width: 90px;
	flex: 0 0 auto;
}

/* Sidebar Header Button (New Folder) */
.mfm-sidebar-header .components-button {
	margin-top: 8px;
	width: 100%;
	justify-content: center;
}

.mfm-loading {
	display: flex;
	justify-content: center;
	align-items: center;
	padding: 40px;
}

/* Folder Tree */
.mfm-folder-tree {
	margin-top: 8px;
}

.mfm-folder-item {
	margin: 2px 0;
}

.mfm-folder-row {
	display: flex;
	align-items: center;
	padding: 10px 0px;
	border-radius: 6px;
	cursor: pointer;
	transition: all 0.2s ease;
	width: 100%;
	border: none;
	background: transparent;
	text-align: left;
	font-size: 13px;
	margin: 2px 0;
}

.mfm-folder-row:hover {
	background: linear-gradient(90deg, #f0f4ff 0%, #e8f0fe 100%);
	transform: translateX(2px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mfm-folder-row.mfm-selected {
	background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
	color: #fff;
	box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mfm-folder-row.mfm-selected .mfm-folder-label,
.mfm-folder-row.mfm-selected .mfm-folder-count {
	color: #fff;
}

.mfm-all-files {
	font-weight: 600;
	margin-bottom: 8px;
}

.mfm-folder-toggle {
	width: 20px;
	height: 20px;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	margin-right: 4px;
	font-size: 10px;
	color: #787c82;
}

.mfm-folder-spacer {
	width: 20px;
	display: inline-block;
}

.mfm-folder-name {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	font-size: 13px;
	color: inherit;
	justify-content: flex-start;
	text-align: left;
}

.mfm-folder-icon {
	font-size: 16px;
	transition: color 0.2s ease, filter 0.2s ease, text-shadow 0.2s ease;
	display: inline-block;
	line-height: 1;
	position: relative;
}

/* Apply color styling to colored folder icons */
.mfm-folder-icon-colored,
.mfm-folder-icon[data-folder-color]:not([data-folder-color=""]) {
	color: var(--folder-color, inherit);
	/* Use text-shadow to create a colored glow effect */
	text-shadow: 0 0 2px var(--folder-color, currentColor);
	/* Add a subtle filter for better visibility */
	filter: drop-shadow(0 0 1px var(--folder-color, currentColor));
}

.mfm-folder-label {
	flex: 1;
	text-overflow: ellipsis;
	overflow: hidden;
	white-space: nowrap;
	text-align: left;
}

.mfm-folder-count {
	font-size: 11px;
	color: #787c82;
	margin-left: 4px;
}

.mfm-folder-actions {
	display: flex;
	gap: 4px;
	opacity: 0;
	transition: opacity 0.15s;
	align-items: center;
}

.mfm-folder-row:hover .mfm-folder-actions {
	opacity: 1;
}

/* Ensure three-dot menu is always visible when actions are shown */
.mfm-folder-menu-wrapper {
	display: inline-block;
	opacity: 1 !important;
}

.mfm-folder-action {
	width: 20px;
	height: 20px;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	font-size: 12px;
	opacity: 0.7;
	transition: opacity 0.15s;
}

.mfm-folder-action:hover {
	opacity: 1;
}

.mfm-folder-level-1 {
	margin-left: 16px;
}

.mfm-folder-level-2 {
	margin-left: 32px;
}

.mfm-folder-level-3 {
	margin-left: 48px;
}

.mfm-folder-level-4 {
	margin-left: 64px;
}

.mfm-folder-children {
	margin-left: 0;
}

/* Folder Rename */
.mfm-folder-rename {
	flex: 1;
}

.mfm-folder-rename-input {
	width: 100%;
	padding: 4px 8px;
	border: 1px solid #2271b1;
	border-radius: 4px;
	font-size: 13px;
}

/* Modal */
.mfm-create-folder-modal {
	z-index: 100000 !important;
}

.mfm-parent-selector {
	margin-top: 16px;
}

.mfm-parent-selector label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
}

.mfm-parent-selector select {
	width: 100%;
	padding: 8px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
}

.mfm-modal-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	margin-top: 20px;
}

/* Folder Column */
.column-mfoldman_folder {
	width: 15%;
}

.mfm-no-folder {
	color: #999;
	font-style: italic;
}

/* Attachment Details Integration */
.attachment-details .mfm-folder-select {
	width: 100%;
	padding: 6px 8px;
	border: 1px solid #8c8f94;
	border-radius: 4px;
}

/* Responsive */
@media screen and (max-width: 1200px) {
	#mfm-sidebar-container {
		width: 240px;
	}
	.mfm-has-sidebar .wrap {
		margin-left: 240px;
	}
}

@media screen and (max-width: 782px) {
	#mfm-sidebar-container {
		position: relative;
		width: 100%;
		height: auto;
		border-right: none;
		border-bottom: 1px solid #c3c4c7;
	}
	.mfm-has-sidebar .wrap {
		margin-left: 0;
		padding-left: 0;
	}
}

/* Loading States */
.mfm-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

/* Notice Styles */
.mfm-sidebar .components-notice {
	margin: 16px;
}

/* Folder Search and Sort Controls */
.mfm-folder-controls {
	padding: 16px;
	border-bottom: 1px solid #e1e5e9;
	background: #ffffff;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
	position: relative;
	z-index: 10;
	overflow: visible;
}

.mfm-search-wrapper {
	margin-bottom: 10px;
}

.mfm-folder-search {
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #8c8f94;
	border-radius: 3px;
	font-size: 13px;
	background: #fff;
	box-sizing: border-box;
}

.mfm-folder-search:focus {
	border-color: #2271b1;
	outline: none;
	box-shadow: 0 0 0 1px #2271b1;
}

.mfm-sort-wrapper {
	display: flex;
	gap: 6px;
	align-items: center;
	position: relative;
	z-index: 1;
	overflow: visible;
}

.mfm-sort-btn {
	padding: 8px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #ffffff;
	color: #374151;
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	line-height: 1.2;
}

.mfm-sort-icon {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	font-size: 10px;
	line-height: 1;
}

.mfm-sort-btn:hover {
	background: #f9fafb;
	border-color: #9ca3af;
	transform: translateY(-1px);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mfm-sort-btn:hover {
	background: #f0f0f1;
	border-color: #50575e;
}

.mfm-sort-btn.active {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-color: #667eea;
	color: #fff;
	box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.mfm-sort-btn.active:hover {
	background: linear-gradient(135deg, #5568d3 0%, #6a3f8f 100%);
	border-color: #5568d3;
	transform: translateY(-1px);
	box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4);
}

.mfm-no-folders {
	padding: 20px;
	text-align: center;
	color: #646970;
	font-size: 13px;
}

/* Settings Gear Icon Button */
.mfm-settings-btn {
	padding: 8px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	background: #ffffff;
	color: #374151;
	font-size: 16px;
	cursor: pointer;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mfm-settings-btn:hover {
	background: #f9fafb;
	border-color: #9ca3af;
	transform: translateY(-1px) rotate(15deg);
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mfm-settings-btn:active {
	transform: translateY(0) rotate(0deg);
}

.mfm-settings-btn.active {
	background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
	border-color: #667eea;
	color: #fff;
	box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.mfm-sort-wrapper {
	display: flex;
	gap: 5px;
	align-items: center;
}

/* Settings Modal */
.mfm-settings-modal {
	z-index: 100000 !important;
}

#mfm-settings-modal-debug {
	z-index: 100001 !important;
}

.mfm-settings-modal .components-modal__content {
	padding: 24px;
}

.mfm-settings-modal .components-modal__header {
	border-bottom: 1px solid #e1e5e9;
	padding-bottom: 16px;
	margin-bottom: 20px;
}

.mfm-settings-modal .components-modal__header h1 {
	font-size: 20px;
	font-weight: 600;
	color: #1d2327;
	margin: 0;
}

.mfm-settings-field {
	margin-bottom: 20px;
}

.mfm-settings-field label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
	color: #1d2327;
	font-size: 14px;
}

.mfm-settings-field select {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid #d1d5db;
	border-radius: 6px;
	font-size: 14px;
	background: #ffffff;
	color: #374151;
	transition: all 0.2s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.mfm-settings-field select:focus {
	outline: none;
	border-color: #667eea;
	box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.mfm-settings-field .description {
	margin-top: 6px;
	font-size: 12px;
	color: #6b7280;
	font-style: italic;
}

/* Accessibility */
.mfm-folder-row:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.mfm-folder-action:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Three-dot menu button */
.mfm-folder-menu-wrapper {
	position: relative;
	display: inline-block;
}

.mfm-folder-menu-trigger {
	width: 20px;
	height: 20px;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
	font-size: 16px;
	line-height: 1;
	opacity: 0.7;
	transition: opacity 0.15s;
	color: #50575e;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mfm-folder-menu-trigger:hover {
	opacity: 1;
}

.mfm-folder-menu-trigger:focus {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

/* Dropdown menu */
.mfm-folder-dropdown-menu {
	position: absolute;
	top: 100%;
	right: 0;
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	min-width: 180px;
	z-index: 1000;
	margin-top: 4px;
	padding: 4px 0;
}

.mfm-folder-dropdown-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	cursor: pointer;
	transition: background-color 0.15s;
	font-size: 13px;
	color: #1d2327;
}

.mfm-folder-dropdown-item:hover {
	background-color: #f0f0f1;
}

.mfm-folder-dropdown-item-danger {
	color: #b32d2e;
}

.mfm-folder-dropdown-item-danger:hover {
	background-color: #fcf0f1;
}

.mfm-dropdown-icon {
	font-size: 14px;
	width: 16px;
	text-align: center;
}

.mfm-dropdown-text {
	flex: 1;
}

.mfm-folder-dropdown-divider {
	height: 1px;
	background: #c3c4c7;
	margin: 4px 0;
}

.mfm-folder-dropdown-item-has-submenu {
	position: relative;
}

.mfm-dropdown-arrow {
	margin-left: auto;
	font-size: 10px;
	color: #787c82;
}

/* Color picker in dropdown */
.mfm-color-picker-dropdown {
	position: absolute;
	left: 100%;
	top: 0;
	margin-left: 4px;
	z-index: 1001;
}

/* Media Loading Indicator */
.mfm-media-loader {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-left: 12px;
	padding: 6px 12px;
	color: #2271b1;
	font-size: 13px;
	font-weight: 500;
	transition: opacity 0.3s ease;
}

.mfm-media-loader .mfm-spinner {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid #e1e5e9;
	border-top-color: #2271b1;
	border-radius: 50%;
	animation: mfm-spin 0.8s linear infinite;
}

.mfm-media-loader .mfm-loader-text {
	color: #646970;
	font-size: 13px;
}

@keyframes mfm-spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

/* Hide loader by default */
.mfm-media-loader[style*="display: none"],
.mfm-media-loader[style*="visibility: hidden"] {
	display: none !important;
	visibility: hidden !important;
	opacity: 0 !important;
}

/* Context Menu */
.mfm-context-menu {
	background: #ffffff !important;
	border: 1px solid #c3c4c7 !important;
	border-radius: 4px !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
	min-width: 180px !important;
	padding: 4px 0 !important;
	z-index: 1000000 !important;
	position: fixed !important;
	display: block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.mfm-context-menu-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 16px;
	cursor: pointer;
	font-size: 13px;
	color: #1d2327;
	transition: background-color 0.15s;
	position: relative;
}

.mfm-context-menu-item:hover {
	background-color: #f0f0f1;
}

.mfm-context-menu-item-danger {
	color: #d63638;
}

.mfm-context-menu-item-danger:hover {
	background-color: #fcf0f1;
}

.mfm-context-menu-has-submenu {
	position: relative;
}

.mfm-context-menu-arrow {
	margin-left: auto;
	font-size: 10px;
	color: #787c82;
}

.mfm-context-menu-divider {
	height: 1px;
	background: #c3c4c7;
	margin: 4px 0;
}

/* Color Picker */
.mfm-color-picker {
	position: absolute;
	left: 100%;
	top: 0;
	background: #ffffff;
	border: 1px solid #c3c4c7;
	border-radius: 4px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	padding: 12px;
	min-width: 200px;
	margin-left: 4px;
	z-index: 100001;
}

.mfm-color-picker-grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 6px;
	margin-bottom: 10px;
}

.mfm-color-picker-item {
	width: 32px;
	height: 32px;
	border-radius: 4px;
	cursor: pointer;
	border: 2px solid transparent;
	transition: all 0.2s;
	position: relative;
	background: #f0f0f1;
}

.mfm-color-picker-item:hover {
	transform: scale(1.1);
	border-color: #2271b1;
}

.mfm-color-picker-item.mfm-color-selected {
	border-color: #2271b1;
	box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.mfm-color-picker-item.mfm-color-selected::after {
	content: '✓';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: #fff;
	font-size: 14px;
	font-weight: bold;
	text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.mfm-color-picker-hex {
	margin-top: 8px;
	padding-top: 8px;
	border-top: 1px solid #c3c4c7;
}

.mfm-color-hex-input {
	width: 100%;
	padding: 6px 8px;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	font-size: 12px;
	font-family: monospace;
}

.mfm-color-hex-input:focus {
	outline: none;
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

/* Folder Icon with Color */
.mfm-folder-icon {
	display: inline-block;
	transition: color 0.2s;
}

/* Bulk Selection */
.mfm-bulk-action-bar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	background: #fff3cd;
	border-bottom: 1px solid #ffc107;
	margin: 0;
}

.mfm-bulk-action-info {
	font-weight: 600;
	color: #856404;
	font-size: 13px;
}

.mfm-bulk-action-buttons {
	display: flex;
	gap: 8px;
}

.mfm-folder-checkbox {
	margin-right: 8px;
	cursor: pointer;
	width: 18px;
	height: 18px;
}

.mfm-folder-row.mfm-bulk-selected {
	background: #e7f3ff !important;
	border-left: 3px solid #2271b1;
}

.mfm-folder-row.mfm-drag-over {
	background: #fff3cd !important;
	border: 2px dashed #ffc107;
}

/* Make media attachments draggable */
.attachment[draggable="true"] {
	cursor: move !important;
	user-select: none;
	transition: all 0.2s ease;
	position: relative;
}

.attachment[draggable="true"]:hover {
	opacity: 0.9;
}

/* Yellow highlight for dragged item (like in the image) */
.attachment.mfm-dragging {
	opacity: 1 !important;
	box-shadow: 0 0 0 4px #ffd700 !important;
	border-radius: 4px !important;
	transform: scale(1.02);
	z-index: 1000;
}

/* Custom drag tooltip */
.mfm-drag-tooltip {
	position: fixed;
	background: rgba(0, 0, 0, 0.85) !important;
	color: white !important;
	padding: 8px 12px !important;
	border-radius: 4px !important;
	font-size: 13px !important;
	pointer-events: none !important;
	z-index: 1000000 !important;
	white-space: nowrap !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
	font-weight: 500 !important;
}

/* Gear Dropdown */
/* Gear Icon Menu - Pure CSS Hover */
.mfm-gear-menu-wrapper {
	position: relative !important;
	display: inline-block !important;
	margin-left: auto !important;
	z-index: 1000 !important;
	overflow: visible !important;
}

.mfm-gear-menu-wrapper .mfm-side-menu {
	position: absolute !important;
	top: calc(100% + 4px) !important;
	right: 0 !important;
	left: auto !important;
	width: 200px !important;
	min-width: 200px !important;
	max-width: 200px !important;
	background: #ffffff !important;
	border: 1px solid #c3c4c7 !important;
	border-radius: 4px !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
	z-index: 1000001 !important;
	padding: 4px 0 !important;
	margin: 0 !important;
	opacity: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
	transform: scale(0.95) translateY(-5px);
	transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
	display: flex !important;
	flex-direction: column !important;
	white-space: nowrap !important;
	box-sizing: border-box !important;
}

.mfm-gear-menu-wrapper.mfm-menu-open .mfm-side-menu,
.mfm-side-menu.mfm-menu-visible {
	opacity: 1 !important;
	visibility: visible !important;
	pointer-events: auto !important;
	transform: scale(1) translateY(0) !important;
	display: flex !important;
	flex-direction: column !important;
	position: absolute !important;
	top: calc(100% + 4px) !important;
	right: 0 !important;
	left: auto !important;
	z-index: 1000001 !important;
	width: 200px !important;
	min-width: 200px !important;
	max-width: 200px !important;
	background: #ffffff !important;
	border: 1px solid #c3c4c7 !important;
	border-radius: 4px !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
	padding: 4px 0 !important;
	margin: 0 !important;
	box-sizing: border-box !important;
}

/* Ensure menu is visible when open */
.mfm-gear-menu-wrapper.mfm-menu-open .mfm-side-menu.mfm-menu-visible {
	opacity: 1 !important;
	visibility: visible !important;
	display: flex !important;
	flex-direction: column !important;
	position: absolute !important;
	top: calc(100% + 4px) !important;
	right: 0 !important;
	left: auto !important;
}

.mfm-side-menu {
	display: flex !important;
	flex-direction: column !important;
	position: absolute !important;
	background: #ffffff !important;
	border: 1px solid #c3c4c7 !important;
	border-radius: 4px !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
	min-width: 200px;
	width: 200px;
}

.mfm-side-menu-header {
	padding: 20px;
	border-bottom: 1px solid #e1e5e9;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.mfm-side-menu-header h3 {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	color: #1d2327;
}

.mfm-side-menu-close {
	background: none;
	border: none;
	font-size: 24px;
	cursor: pointer;
	color: #50575e;
	padding: 0;
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	transition: color 0.15s;
}

.mfm-side-menu-close:hover {
	color: #1d2327;
}

.mfm-side-menu-item {
	display: flex !important;
	align-items: center !important;
	gap: 10px !important;
	padding: 8px 12px !important;
	cursor: pointer !important;
	font-size: 13px !important;
	color: #1d2327 !important;
	transition: background-color 0.15s !important;
	user-select: none !important;
	-webkit-user-select: none !important;
	-moz-user-select: none !important;
	width: 100% !important;
	box-sizing: border-box !important;
	white-space: nowrap !important;
	min-width: 0 !important;
	-ms-user-select: none;
	border-bottom: none;
}

.mfm-side-menu-item:last-child {
	border-bottom: none;
}

.mfm-side-menu-item:hover {
	background-color: #f0f0f1;
}

.mfm-side-menu-divider {
	height: 1px;
	background: #f0f0f1;
	margin: 4px 0;
}

.mfm-side-menu-icon {
	font-size: 16px;
	width: 20px;
	text-align: center;
	display: inline-block;
	line-height: 1;
}

.mfm-side-menu-text {
	flex: 1;
	font-weight: 500;
}

.mfm-dropdown-item span:first-child {
	font-size: 16px;
}

/* Prevent browser context menu on sidebar */
#mfm-sidebar-container {
	user-select: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
}

#mfm-sidebar-container * {
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

#mfm-sidebar-container input,
#mfm-sidebar-container textarea {
	user-select: text;
	-webkit-user-select: text;
	-moz-user-select: text;
	-ms-user-select: text;
}

/* Print Styles */
@media print {
	#mfm-sidebar-container {
		display: none;
	}
	.mfm-has-sidebar .wrap {
		margin-left: 0;
	}
	.mfm-media-loader {
		display: none !important;
	}
	.mfm-context-menu,
	.mfm-color-picker {
		display: none !important;
	}
}

