/* ========================================
   File Explorer - VS Code Inspired Design
   ======================================== */

/* CSS Variables for theming */
:root {
	--fe-bg-primary: #ffffff;
	--fe-bg-secondary: #f7f7f7;
	--fe-bg-tertiary: #efefef;
	--fe-border-color: #e0e0e0;
	--fe-border-focus: #0077CF;
	--fe-accent-blue: #0077CF;
	--fe-accent-blue-hover: #005fa3;
	--fe-accent-blue-light: #e6f3ff;
	--fe-text-primary: #333333;
	--fe-text-secondary: #666666;
	--fe-text-muted: #999999;
	--fe-danger-red: #dc3545;
	--fe-warning-orange: #ffc107;
	--fe-file-cs: #68217a;
	--fe-file-vb: #00539c;
	--fe-file-fs: #378bba;
	--fe-file-json: #cbcb41;
	--fe-file-md: #519aba;
	--fe-folder-color: #dcb67a;
	--fe-transition-fast: 0.15s ease;
}

/* Editor and File Container */
#editor-file-container {
	display: flex;
	flex-direction: row;
	height: 100%;
	width: 100%;
	overflow: hidden;
}

/* Code Editor Pane */
.code-editor-pane {
	position: relative;
	height: 100%;
	flex: 1;
	min-width: 200px;
	display: flex;
	flex-direction: column;
	order: 1;
}

.code-editor-pane textarea {
	flex: 1;
}

/* ========================================
   File Explorer Panel
   ======================================== */
.file-explorer {
	width: 240px;
	background: var(--fe-bg-primary);
	border-left: 1px solid var(--fe-border-color);
	display: none;
	flex-direction: column;
	position: relative;
	flex-shrink: 0;
	order: 2;
}

.file-explorer.visible {
	display: flex;
}

/* Explorer Header */
.explorer-header {
	padding: 10px 12px;
	background: var(--fe-bg-secondary);
	border-bottom: 1px solid var(--fe-border-color);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}

.explorer-title {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--fe-text-secondary);
	letter-spacing: 0.8px;
}

/* Explorer Toolbar */
.explorer-toolbar {
	display: flex;
	gap: 2px;
}

.toolbar-btn {
	width: 24px;
	height: 24px;
	border: none;
	background: transparent;
	border-radius: 4px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--fe-text-muted);
	transition: all var(--fe-transition-fast);
	padding: 0;
}

.toolbar-btn:hover {
	background: var(--fe-bg-tertiary);
	color: var(--fe-text-primary);
}

.toolbar-btn:focus {
	outline: none;
}

.toolbar-btn svg {
	width: 14px;
	height: 14px;
}

/* Tooltip for toolbar buttons */
.toolbar-btn[data-tooltip] {
	position: relative;
}

.toolbar-btn[data-tooltip]::after {
	content: attr(data-tooltip);
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	padding: 6px 10px;
	background: #1e1e1e;
	color: #fff;
	font-size: 11px;
	border-radius: 4px;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--fe-transition-fast);
	z-index: 1000;
}

.toolbar-btn[data-tooltip]:hover::after {
	opacity: 1;
}

/* File Tree Container */
.file-tree-container {
	flex: 1;
	overflow-y: auto;
	padding: 8px 0;
	background: var(--fe-bg-primary);
}

#file-tree {
	font-size: 13px;
}

/* jsTree Overrides */
#file-tree .jstree-anchor {
	line-height: 26px;
	height: 26px;
	padding-left: 4px;
}

#file-tree .jstree-wholerow-hovered {
	background: var(--fe-bg-tertiary);
}

#file-tree .jstree-wholerow-clicked {
	background: var(--fe-accent-blue-light);
}

/* Font Awesome icons for jsTree */
#file-tree .jstree-icon {
	font: normal normal normal 14px/1 FontAwesome;
	text-rendering: auto;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	vertical-align: baseline;
}

#file-tree .jstree-icon:empty {
	display: inline-block;
	text-decoration: inherit;
	width: 1em;
	margin-right: .2em;
	text-align: center;
	font-variant: normal;
	text-transform: none;
	line-height: 1em;
	margin-left: .2em;
	vertical-align: baseline;
}

/* Folder icons */
#file-tree .jstree-closed > .jstree-anchor > .jstree-icon.fa-folder:before,
#file-tree .fa-folder:before {
	content: "\f07b";
	color: var(--fe-folder-color);
}

#file-tree .jstree-open > .jstree-anchor > .jstree-icon.fa-folder-open:before,
#file-tree .fa-folder-open:before {
	content: "\f07c";
	color: var(--fe-folder-color);
}

/* File icons by extension with language-specific colors */
#file-tree .fa-file-code-o:before {
	content: "\f1c9";
	color: var(--fe-file-cs);
}

#file-tree .fa-file-text-o:before {
	content: "\f0f6";
	color: var(--fe-text-muted);
}

#file-tree .fa-file-o:before {
	content: "\f016";
	color: var(--fe-text-muted);
}

/* File type specific colors via data attribute or class */
#file-tree .file-cs .jstree-icon:before { color: var(--fe-file-cs); }
#file-tree .file-vb .jstree-icon:before { color: var(--fe-file-vb); }
#file-tree .file-fs .jstree-icon:before { color: var(--fe-file-fs); }
#file-tree .file-json .jstree-icon:before { color: var(--fe-file-json); }
#file-tree .file-md .jstree-icon:before { color: var(--fe-file-md); }

/* Hierarchy file tree error indicators */
.jstree-node.has-errors > .jstree-anchor {
	color: var(--fe-danger-red) !important;
}
.jstree-node.has-errors > .jstree-anchor::after {
	content: ' \26A0';
	color: var(--fe-danger-red);
	font-size: 10px;
	margin-left: 4px;
}

/* Hierarchy file tree warning indicators */
.jstree-node.has-warnings > .jstree-anchor {
	color: var(--fe-warning-orange) !important;
}
.jstree-node.has-warnings > .jstree-anchor::after {
	content: ' \26A0';
	color: var(--fe-warning-orange);
	font-size: 10px;
	margin-left: 4px;
}

/* File Explorer Toggle Button - positioned on right edge of editor pane */
.file-explorer-toggle {
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
	width: 20px;
	height: 48px;
	cursor: pointer;
	background-color: #f7f7f7;
	border: 1px solid #e0e0e0;
	border-right: none;
	border-radius: 6px 0 0 6px;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 5;
}

.file-explorer-toggle:hover {
	background-color: #ddd;
}

.file-explorer-toggle .glyphicon {
	color: #444;
}

/* Resize Handle - on left side (visual only, not functional yet) */
.resize-handle {
	position: absolute;
	left: -3px;
	top: 0;
	bottom: 0;
	width: 6px;
	cursor: col-resize;
	z-index: 10;
}

.resize-handle::after {
	content: '';
	position: absolute;
	right: 2px;
	top: 50%;
	transform: translateY(-50%);
	width: 2px;
	height: 24px;
	background: var(--fe-border-color);
	border-radius: 1px;
	opacity: 0;
	transition: opacity var(--fe-transition-fast);
}

.resize-handle:hover::after {
	opacity: 1;
	background: var(--fe-accent-blue);
}

/* Context Menu */
.fe-context-menu {
	position: fixed;
	background: var(--fe-bg-primary);
	border: 1px solid var(--fe-border-color);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0,0,0,0.2);
	min-width: 180px;
	padding: 6px 0;
	z-index: 10000;
	display: none;
}

.fe-context-menu.visible {
	display: block;
}

.fe-context-menu-item {
	padding: 8px 14px;
	display: flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	font-size: 13px;
	color: var(--fe-text-primary);
	transition: background var(--fe-transition-fast);
}

.fe-context-menu-item:hover {
	background: var(--fe-accent-blue);
	color: #fff;
}

.fe-context-menu-item svg {
	width: 14px;
	height: 14px;
	opacity: 0.7;
}

.fe-context-menu-item:hover svg {
	opacity: 1;
}

.fe-context-menu-item .shortcut {
	margin-left: auto;
	font-size: 11px;
	opacity: 0.5;
}

.fe-context-menu-divider {
	height: 1px;
	background: var(--fe-border-color);
	margin: 6px 0;
}

.fe-context-menu-item.danger:hover {
	background: var(--fe-danger-red);
}

/* File tree panel visibility for hierarchy mode */
#file-explorer.auto-hidden {
	display: none !important;
}
#file-explorer.auto-shown {
	display: flex !important;
	flex-direction: column;
}

/* Current file indicator in header */
#current-file-name {
	font-size: 12px;
	color: #666;
	margin-left: 10px;
}

/* Scrollbar styling for file tree */
.file-tree-container::-webkit-scrollbar {
	width: 8px;
}

.file-tree-container::-webkit-scrollbar-track {
	background: transparent;
}

.file-tree-container::-webkit-scrollbar-thumb {
	background: #ccc;
	border-radius: 4px;
}

.file-tree-container::-webkit-scrollbar-thumb:hover {
	background: #999;
}
