/* =====================================
   Project: Mooncloud - File Manager
   File:    file-manager.css
   ===================================== */

:root {
    --bg-dark: #121212;
    --bg-panel: #1e1e1e;
    --fg-light: #f8f9fa;
    --accent: rgba(255,255,255,0.15);
    --accent-hover: rgba(255,255,255,0.25);
}

body {
    background: var(--bg-dark);
    color: var(--fg-light);
    margin: 0;
    font-family: system-ui, sans-serif;
}

/* === SPLIT CONTAINER === */
#split-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* === SIDEBAR === */
#sidebar {
    width: 280px;
    min-width: 150px;
    max-width: 600px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border-right: 1px solid var(--accent);
}

#resizer {
    width: 6px;
    cursor: ew-resize;
    background: #444;
}

/* === PLACES (Sidebar Navigation) === */
#places {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
}

#places .nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 6px;
    user-select: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

#places .nav-item:hover {
    background: var(--accent);
}

#places .nav-item.active {
    background: var(--accent-hover);
    font-weight: 600;
}

/* === MAIN PANEL === */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    overflow-y: auto;
    padding: 1rem;
}

/* === TOOLBAR + BREADCRUMB === */
#breadcrumb {
    font-size: 0.9rem;
    margin-bottom: 10px;
    user-select: none;
}

#breadcrumb .crumb {
    cursor: pointer;
    color: var(--fg-light);
    opacity: 0.8;
    transition: opacity 0.2s;
}

#breadcrumb .crumb:hover {
    opacity: 1;
}

.controls .btn {
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--fg-light);
    cursor: pointer;
    transition: background 0.2s ease;
}

.controls .btn:hover {
    background: var(--accent);
}

/* === TREEVIEW PANEL === */
.treeview {
    font-size: 0.95rem;
}

/* Root container for the tree */
#fileTree {
    display: block;               /* block layout instead of flex */
    padding: 4px 0;
}

/* Individual tree node (folder or file) */
.tree-node {
    position: relative;
    display: block;               /* block allows vertical stacking */
    padding: 6px 10px 6px 28px;   /* left padding for icons/toggles */
    margin: 2px 0;
    border-radius: 6px;
    user-select: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.2s ease, color 0.2s ease;
}

/* Hover/active styles */
.tree-node:hover {
    background: var(--accent);
}

.tree-node.active {
    background: var(--accent-hover);
    font-weight: 600;
}

/* Toggle triangle (▶ ▼) */
.tree-node .toggle {
    position: absolute;
    left: 8px;
    top: 6px;
    width: 16px;
    text-align: center;
    cursor: pointer;
    color: var(--fg-light);
    opacity: 0.7;
}

/* Folder/File icon */
.tree-node .tree-icon {
    margin-right: 6px;
    color: #ffca6a;
    font-size: 14px;
}

/* Children container for nested folders */
.tree-node .children {
    margin-left: 18px;
    padding-left: 10px;
    border-left: 1px solid rgba(255,255,255,0.08);
    display: none;
}

/* Show when folder is expanded */
.tree-node.expanded > .children {
    display: block;
}

/* === Context Menu === */
.context-menu {
  background: #222;
  color: #eee;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.context-menu ul { list-style: none; margin: 0; padding: 0; }
.context-menu li {
  padding: 6px 12px;
  cursor: pointer;
}

.context-menu li.separator {
  border-top: 1px solid #444;
  margin: 4px 0;
  padding: 0;
  pointer-events: none; /* not clickable */
}

.context-menu li:hover {
  background: #333;
}

/* === MOBILE === */
@media (max-width: 768px) {
    #split-container {
        flex-direction: column;
        height: auto;
    }

    #sidebar {
        width: 100%;
        height: auto;
    }

    #resizer {
        display: none;
    }
}