/* Main pane */
.main-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header above editor */
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ccc;
    padding: 8px 10px;
    background: #fafafa;
    font-size: 13px;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

#currentFileName {
    direction: ltr;
    color: #333;
    max-width: 380px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge {
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    background: #eee;
    color: #444;
}

.editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

#saveBtn {
    padding: 6px 12px;
    border: 1px solid #0077ff;
    background: #0077ff;
    color: #fff;
    cursor: pointer;
    font-size: 13px;
    border-radius: 3px;
}

#saveBtn:disabled {
    opacity: 0.5;
    cursor: default;
}

.unsaved {
    font-size: 11px;
    color: #d9534f;
}

.hidden {
    display: none !important;
}

/* Tabs bar */
.tabs-bar {
    display: flex;
    align-items: stretch;
    gap: 2px;
    border-bottom: 1px solid #ccc;
    background: #f3f3f3;
    padding: 2px 4px;
    min-height: 26px;
    overflow-x: auto;
}

/* Single tab */
.tab {
    display: flex;
    align-items: center;
    max-width: 180px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px 3px 0 0;
    border: 1px solid transparent;
    border-bottom: none;
    background: transparent;
    color: #555;
    white-space: nowrap;
}

.tab.active {
    background: #ffffff;
    border-color: #ccc;
    color: #222;
}

.tab-title {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    margin-left: 6px;
    font-size: 12px;
    cursor: pointer;
    color: #888;
    flex-shrink: 0;
}

.tab-close:hover {
    color: #333;
}

/* Red dot for dirty tabs */
.tab.dirty .tab-title::after {
    content: "●";
    color: #d9534f;
    margin-left: 4px;
    font-size: 10px;
}

/* Content area: editor + preview */
.content-area {
    flex: 1;
    display: flex;
    min-height: 0;
}

#editorContainer {
    flex: 2;
    min-width: 0;
    height: 100%;
}

/* Monaco full height */
#editorContainer>.monaco-editor {
    height: 100% !important;
}

/* Preview panel */
.preview {
    flex: 1;
    border-left: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

.preview-header {
    padding: 6px 8px;
    font-size: 12px;
    border-bottom: 1px solid #ccc;
}

.preview-body {
    flex: 1;
    overflow: auto;
    padding: 0;
    /* قبلاً 6px بود؛ برای تمام‌صفحه صفر می‌کنیم */
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Status bar */
.status-bar {
    font-size: 12px;
    color: #555;
    padding: 4px 10px;
    background: #f5f5f5;
    border-top: 1px solid #ddd;
    min-height: 20px;
}

/* Custom context menu */
.context-menu {
    position: fixed;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #ccc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    display: none;
    font-size: 12px;
}

.context-menu-item {
    padding: 6px 10px;
    cursor: pointer;
    white-space: nowrap;
}

.context-menu-item:hover {
    background: #f0f0f0;
}

.context-menu-item.disabled {
    opacity: 0.5;
    pointer-events: none;
}




/* Tree icons by type */

.tree .dir-label::before,
.tree .file-label::before {
    display: inline-block;
    width: 1.3em;
    margin-right: 4px;
}

/* default icons */
.tree .dir-label::before {
    content: "📁";
}

.tree .file-label::before {
    content: "📄";
}

/* HTML */
.tree .file-label.ext-html::before,
.tree .file-label.ext-htm::before {
    content: "</>";
    font-weight: bold;
}

/* CSS */
.tree .file-label.ext-css::before {
    content: "🎨";
}

/* JS + JSB */
.tree .file-label.ext-js::before,
.tree .file-label.ext-jsb::before {
    content: "JS";
    font-weight: bold;
}

/* JSON */
.tree .file-label.ext-json::before {
    content: "{}";
}

/* Images */
.tree .file-label.ext-png::before,
.tree .file-label.ext-jpg::before,
.tree .file-label.ext-jpeg::before,
.tree .file-label.ext-gif::before,
.tree .file-label.ext-svg::before,
.tree .file-label.ext-webp::before {
    content: "🖼️";
}

/* Video */
.tree .file-label.ext-mp4::before,
.tree .file-label.ext-webm::before,
.tree .file-label.ext-mov::before {
    content: "🎥";
}


/* Layout کلی برنامه */
.app {
    display: flex;
    height: 100vh;
}

/* ستون چپ (سایدبار) */
.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #ddd;
    background: #f7f7f7;
}

/* پنل وسط/راست: ادیتور */
.editor-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* هدر سایدبار */
.sidebar-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid #e0e0e0;
    background: #f0f0f0;
}

/* دکمه‌ها */
#newProjectBtn,
#openFolderBtn,
#exportProjectBtn {
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    width: 48%;
    overflow: hidden;
    height: 30px;
    word-break: normal;
}

/* نمایش مسیر پروژه */
#folderPath {
    margin-left: 8px;
    font-size: 12px;
    color: #555;
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* درخت فایل */
.tree {
    flex: 1 1 auto;
    overflow: auto;
    padding: 8px;
    font-size: 13px;
    background: #fff;
}
