:root {
    --primary-color-start: #6a11cb;
    --primary-color-end: #2575fc;
    --rgb-primary-end: 37, 117, 252;
    --secondary-color-start: #8e9eab;
    --secondary-color-end: #eef2f3;
    --success-color-start: #11998e;
    --success-color-end: #38ef7d;
    --danger-color-start: #cb2d3e;
    --danger-color-end: #ef473a;
    --sync-color: #38ef7d;
    --bg-dark: #1e1e2f;
    --bg-light: #2a2a4a;
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-hover-bg: rgba(255, 255, 255, 0.1);
    --sidebar-width: 240px; /* Default width */
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', 'Roboto', sans-serif; }

body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at top left, var(--bg-light) 0%, var(--bg-dark) 100%);
    color: var(--text-color); overflow: hidden; height: 100vh; width: 100vw;
}

/* Minimal White Scrollbar Styles */
.folder-nav, .file-area, .code-editor, .modal-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.5) var(--bg-dark);
}
.folder-nav::-webkit-scrollbar,
.file-area::-webkit-scrollbar,
.code-editor::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 6px; height: 6px;
}
.folder-nav::-webkit-scrollbar-track,
.file-area::-webkit-scrollbar-track,
.code-editor::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.folder-nav::-webkit-scrollbar-thumb,
.file-area::-webkit-scrollbar-thumb,
.code-editor::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.4); border-radius: 10px;
}
.folder-nav::-webkit-scrollbar-thumb:hover,
.file-area::-webkit-scrollbar-thumb:hover,
.code-editor::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.7);
}


.main-container { display: flex; height: 100vh; }

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width); min-width: 200px; max-width: 500px;
    background: rgba(0, 0, 0, 0.1); backdrop-filter: blur(15px);
    border-right: 1px solid var(--border-color); display: flex; flex-direction: column;
    transition: width 0.3s ease, min-width 0.3s ease; white-space: nowrap;
}
.sidebar-header {
    padding: 20px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.logo {
    font-size: 1.8rem; font-weight: 700;
    background: linear-gradient(45deg, var(--primary-color-start), var(--primary-color-end));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    display: flex; align-items: center;
}
.logo i { margin-right: 10px; }
.sidebar-actions { padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.btn {
    width: 100%; padding: 12px 20px; border: none; border-radius: 8px; font-size: 1rem;
    font-weight: 600; cursor: pointer; transition: all 0.3s ease; display: flex;
    align-items: center; justify-content: center; gap: 10px; color: white;
}
.btn-primary { background: linear-gradient(45deg, var(--primary-color-start), var(--primary-color-end)); }
.btn-secondary { background: linear-gradient(45deg, var(--secondary-color-start), var(--secondary-color-end)); color: #333; }
.btn-success { background: linear-gradient(45deg, var(--success-color-start), var(--success-color-end)); }
.btn-danger { background: linear-gradient(45deg, var(--danger-color-start), var(--danger-color-end)); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); }
.btn:disabled { background: var(--bg-light); color: var(--text-muted); cursor: not-allowed; transform: none; box-shadow: none; }

/* Folder Selection Controls with Icon Button */
.folder-selection-controls { border-top: 1px solid var(--border-color); padding-top: 15px; display: flex; justify-content: space-between; align-items: center; }
.select-all-container { display: flex; align-items: center; gap: 10px; padding: 0 5px; cursor: pointer; }
.select-all-container label { cursor: pointer; }
.icon-btn {
    background: none; border: none; color: var(--text-muted); font-size: 1.2rem;
    width: 36px; height: 36px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: all 0.2s ease;
}
.icon-btn:not(:disabled):hover { background-color: var(--danger-color-start); color: white; }
.icon-btn:disabled { color: #555; cursor: not-allowed; }

.folder-item {
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; transition: background-color 0.2s ease; border-left: 3px solid transparent;
    padding-top: 15px;
    padding-bottom: 15px;
    padding-right: 20px;
}
.folder-item:hover { background-color: var(--card-bg); }
.folder-item.active { background-color: var(--card-hover-bg); border-left-color: var(--primary-color-end); }
.folder-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; display: flex; align-items: center; gap: 10px; }
.folder-name i { color: var(--primary-color-end); }
.folder-name .sync-icon { color: var(--sync-color); font-size: 0.8em; }
.folder-options-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 5px;
    border-radius: 50%; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.folder-options-btn:hover { background-color: rgba(255, 255, 255, 0.1); color: white; }

.folder-nav { flex-grow: 1; overflow-y: auto; overflow-x: hidden; }
#folder-list { list-style: none; }

/* Sidebar Toggle and Collapsed State */
.sidebar-toggle {
    background: none; border: 1px solid transparent; color: var(--text-muted);
    width: 30px; height: 30px; border-radius: 6px; cursor: pointer;
    transition: all 0.2s ease;
}
.sidebar-toggle:hover { background-color: var(--card-hover-bg); color: white; border-color: var(--border-color); }
.sidebar.collapsed { width: 70px; min-width: 70px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .folder-name span,
.sidebar.collapsed .sidebar-actions span,
.sidebar.collapsed .folder-selection-controls { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }
.sidebar.collapsed .folder-item { justify-content: center; padding-left: 20px !important; }
.sidebar.collapsed .folder-options-btn { display: none; }

/* Resizer */
.resizer { width: 5px; cursor: ew-resize; background: var(--bg-dark); z-index: 10; transition: background-color 0.2s ease; }
.resizer:hover { background: var(--primary-color-end); }

/* Main Content Styles */
.main-content { flex-grow: 1; display: flex; flex-direction: column; height: 100vh; }
.content-header {
    display: flex; justify-content: space-between; align-items: center; padding: 20px 30px;
    border-bottom: 1px solid var(--border-color); background: rgba(0, 0, 0, 0.1);
}
#current-folder-name { font-size: 1.5rem; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 15px; }
.header-actions .btn { width: auto; }

/* Run Mode Toggle Switch */
.run-mode-toggle-container { display: flex; align-items: center; gap: 10px; }
#edit-server-url-btn {
    font-size: 1.5rem; color: #777BB4; cursor: pointer; transition: color 0.2s ease, transform 0.2s ease;
}
#edit-server-url-btn:hover { color: #9a9de0; transform: scale(1.1); }
.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #555; transition: .4s; border-radius: 26px;
}
.slider:before {
    position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px;
    background-color: white; transition: .4s; border-radius: 50%;
}
input:checked + .slider { background-color: var(--primary-color-end); }
input:checked + .slider:before { transform: translateX(24px); }

.file-area { flex-grow: 1; padding: 30px; overflow-y: auto; position: relative; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 25px; }
.file-card {
    position: relative; background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border-color);
    overflow: hidden; transition: all 0.3s ease; display: flex; flex-direction: column;
}
.file-card:hover { transform: translateY(-5px); background: var(--card-hover-bg); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.file-header { padding: 15px; font-weight: 600; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.file-name-container { display: flex; align-items: center; gap: 10px; flex-grow: 1; overflow: hidden; }
.file-name-text { cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-header i { font-size: 1.2em; }
.fa-html5 { color: #e34f26; } .fa-css3-alt { color: #1572b6; } .fa-js { color: #f7df1e; } .fa-php { color: #777BB4; } .fa-file-code { color: #a0a0a0; }
.file-content { flex-grow: 1; padding: 15px; }
.code-editor {
    width: 100%; height: 150px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-color);
    border-radius: 8px; color: var(--text-color); font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 14px; padding: 10px; resize: vertical;
}
.code-editor:focus { outline: none; border-color: var(--primary-color-end); }
.file-actions { display: flex; justify-content: space-around; padding: 10px; background: rgba(0, 0, 0, 0.2); }
.file-action-btn {
    background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem;
    padding: 8px; border-radius: 50%; width: 40px; height: 40px; transition: all 0.2s ease;
}
.file-action-btn:hover { background-color: var(--card-hover-bg); color: white; }
.delete-file-btn {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 1rem; padding: 5px; border-radius: 50%; width: 30px; height: 30px;
    transition: all 0.2s ease;
}
.delete-file-btn:hover { background-color: var(--danger-color-start); color: white; }
.file-card-top-actions { position: absolute; top: 10px; right: 10px; z-index: 5; }

/* Add File Card */
.add-file-card {
    background: transparent;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 288px; /* Match file-card height roughly */
    color: var(--text-muted);
}
.add-file-card:hover {
    border-color: var(--primary-color-end);
    background: var(--card-bg);
    color: var(--text-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.add-file-card i {
    font-size: 3rem;
    margin-bottom: 15px;
}
.add-file-card span {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Attractive Empty View Styles */
.empty-view { display: none; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; color: var(--text-muted); }
.empty-view.active { display: flex; }
.empty-view i { font-size: 5rem; margin-bottom: 20px; opacity: 0.5; }
.empty-view p { font-size: 1.2rem; margin-bottom: 30px; }
.btn-call-to-action { width: auto; padding: 15px 30px; font-size: 1.1rem; }
/* Container for buttons in empty view */
.empty-view-actions {
    display: flex;
    gap: 20px;
}

/* FAB Styles */
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--rgb-primary-end), 0.7); } 70% { box-shadow: 0 0 0 10px rgba(var(--rgb-primary-end), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--rgb-primary-end), 0); } }
.fab-container { position: fixed; bottom: 30px; right: 30px; display: flex; flex-direction: column; align-items: flex-end; z-index: 100; visibility: hidden; }
.fab-container.visible { visibility: visible; }
.fab {
    width: 60px; height: 60px; border-radius: 50%; font-size: 1.8rem; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    background: linear-gradient(45deg, var(--primary-color-start), var(--primary-color-end)); color: white;
    border: none; transition: transform 0.3s ease; animation: pulse 2.5s infinite; margin-top: 20px;
}
.fab-container.active .fab { transform: rotate(45deg); animation: none; }
.fab-options { display: flex; flex-direction: column; gap: 15px; transition: all 0.3s ease; transform: translateY(20px); opacity: 0; pointer-events: none; }
.fab-container.active .fab-options { transform: translateY(0); opacity: 1; pointer-events: auto; }
.fab-option {
    padding: 10px 20px; background: var(--bg-light); color: white; border: 1px solid var(--border-color);
    border-radius: 30px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 10px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); transition: transform 0.2s ease;
}
.fab-option:hover { transform: scale(1.05); background: var(--card-hover-bg); }
.fab-option:disabled { opacity: 0.5; cursor: not-allowed; transform: none; background: var(--bg-light); }
.fab-option i { font-size: 1.2rem; }

/* Context Menus */
.context-menu {
    position: absolute; z-index: 1000; background: var(--bg-light);
    border: 1px solid var(--border-color); border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); padding: 8px;
    display: none; backdrop-filter: blur(5px); min-width: 180px;
}
.context-menu ul { list-style: none; }
.context-menu li {
    padding: 10px 15px; cursor: pointer; display: flex;
    align-items: center; gap: 12px; border-radius: 6px;
    transition: all 0.2s ease; color: var(--text-color);
}
.context-menu li:hover {
    background: linear-gradient(45deg, var(--primary-color-start), var(--primary-color-end));
    color: white; transform: translateX(5px);
}
.context-menu li i { width: 20px; text-align: center; }
.context-menu li.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    background: none;
    transform: none;
}
.context-menu li.disabled:hover {
    background: var(--card-bg);
}


/* Modal */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center;
    z-index: 2000; opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--bg-light); padding: 30px; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); width: 90%; max-width: 500px;
    border: 1px solid var(--border-color); transform: scale(0.9); transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex; flex-direction: column; gap: 20px;
}
.modal-overlay.visible .modal-content { transform: scale(1); }
.modal-content h3 { margin: 0; font-size: 1.4rem; text-align: center; flex-shrink: 0; }
#modal-input {
    width: 100%; padding: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-color);
    border-radius: 8px; color: var(--text-color); font-size: 1rem;
}
#modal-input:focus { outline: none; border-color: var(--primary-color-end); }
.modal-actions { display: flex; gap: 15px; flex-shrink: 0; }
.modal-actions .btn { flex: 1; }

#confirmation-modal-body {
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
    margin: 0;
}

/* Settings Modal */
.settings-form { display: flex; flex-direction: column; gap: 10px; }
.settings-form label { font-weight: 600; color: var(--text-muted); }
.settings-form input {
    width: 100%; padding: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-color);
    border-radius: 8px; color: var(--text-color); font-size: 1rem;
}
.settings-form input:focus { outline: none; border-color: var(--primary-color-end); }
.settings-help { font-size: 0.9rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }

/* Move Folder Modal Styles */
.modal-body {
    margin-bottom: 20px;
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}
.move-folder-list { list-style: none; }
.move-folder-list li {
    padding: 12px 15px; cursor: pointer; border-radius: 6px;
    transition: background-color 0.2s ease; display: flex;
    align-items: center; gap: 10px;
}
.move-folder-list li:hover { background-color: var(--card-hover-bg); }
.move-folder-list li i { color: var(--primary-color-end); }


/* Professional Full-screen Code Editor Styles */
.code-editor-content {
    width: 95%; height: 95%; background: var(--bg-dark);
    border-radius: 12px; border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex; flex-direction: column;
    transform: scale(0.9); transition: transform 0.3s ease;
}
.modal-overlay.visible .code-editor-content { transform: scale(1); }
.code-editor-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 25px; border-bottom: 1px solid var(--border-color); flex-shrink: 0;
}
.code-editor-header h3 { font-size: 1.2rem; }
.code-editor-header .btn { width: auto; }
.code-editor-body { flex-grow: 1; overflow: hidden; position: relative; }

/* CodeMirror Theme Integration */
.code-editor-body .CodeMirror {
    height: 100%; font-size: 16px; line-height: 1.6; font-family: 'Fira Code', monospace;
}
.cm-s-okaidia.CodeMirror { background-color: var(--bg-dark); }
.cm-s-okaidia .CodeMirror-gutters { background-color: var(--bg-dark); border-right: 1px solid var(--border-color); }
.cm-s-okaidia .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.07); }
.cm-s-okaidia.CodeMirror { color: #f8f8f2; }
.cm-s-okaidia .CodeMirror-cursor { border-left-color: white !important; }

/* Status Bar Styles */
.code-editor-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 25px; border-top: 1px solid var(--border-color);
    background: var(--bg-light); font-size: 0.9rem; color: var(--text-muted);
    flex-shrink: 0;
}

/* Toast Notification */
.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translate(-50%, 200%); padding: 15px 25px;
    border-radius: 8px; color: white; font-weight: 600; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.5s ease-in-out; z-index: 3000;
}
.toast.show { transform: translate(-50%, 0); }
.toast.success { background: linear-gradient(45deg, var(--success-color-start), var(--success-color-end)); }
.toast.error { background: linear-gradient(45deg, var(--danger-color-start), var(--danger-color-end)); }