/* Source Code & Files Styles */

/* Folder List */
.folder-list-container {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.folder-list-header {
    display: grid;
    grid-template-columns: 20% 45% 15% 20%;
    padding: 15px;
    background-color: #f7f9fc;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #4a5568;
}

.folder-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.folder-item {
    display: grid;
    grid-template-columns: 20% 45% 15% 20%;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
    transition: background-color 0.2s;
    align-items: center;
}

.folder-item:hover {
    background-color: #f8fafc;
}

.folder-item:last-child {
    border-bottom: none;
}

.folder-name {
    font-weight: 500;
    color: #2d3748;
}

.folder-path {
    color: #718096;
    font-family: monospace;
    font-size: 0.9em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 15px;
}

.folder-type {
    color: #4a5568;
}

.folder-actions {
    display: flex;
    justify-content: flex-end;
}

.folder-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    color: #555;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 4px;
    text-decoration: none;
}

.folder-action:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #333;
}

.folder-action.edit-folder:hover {
    color: #3b82f6;
    background-color: #eff6ff;
}

.folder-action.delete-folder:hover {
    color: #ef4444;
    background-color: #fef2f2;
}

.folder-action.viz-link:hover {
    color: #6366f1;
    background-color: #eef2ff;
}

/* Files Browser */
.files-browser-section {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #f7f9fc;
    border-bottom: 1px solid #e2e8f0;
}

.files-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.files-breadcrumb {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #4a5568;
    flex-wrap: wrap;
    flex: 1;
    margin: 0 20px;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    gap: 6px;
}

.breadcrumb-item.clickable {
    cursor: pointer;
}

.breadcrumb-item.clickable:hover {
    background-color: #eef2ff;
    color: #6366f1;
}

.breadcrumb-separator {
    margin: 0 5px;
    color: #cbd5e1;
}

.folder-selector {
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background-color: white;
    font-size: 14px;
    margin-right: 10px;
    cursor: pointer;
    outline: none;
}

.folder-selector:focus {
    border-color: #6366f1;
}

.files-actions {
    display: flex;
    gap: 10px;
}
 

.files-list-header {
    display: grid;
    grid-template-columns: 35% 15% 15% 20% 15%;
    padding: 12px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    color: #64748b;
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.files-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.file-item {
    display: grid;
    grid-template-columns: 35% 15% 15% 20% 15%;
    padding: 10px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s;
    align-items: center;
    font-size: 14px;
}

.file-item:hover {
    background-color: #f8fafc;
}

.file-item:last-child {
    border-bottom: none;
}

.file-name {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    color: #334155;
}

.file-name i {
    flex-shrink: 0;
    width: 20px;
    text-align: center;
    color: #94a3b8;
}

.file-name.clickable {
    cursor: pointer;
    color: #334155;
    font-weight: 500;
}

.file-name.clickable:hover {
    color: #6366f1;
}

.file-name.clickable:hover i {
    color: #6366f1;
}

.file-type, .file-size, .file-modified {
    color: #718096;
    font-size: 13px;
}

.file-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.file-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-action:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.file-action.open-folder:hover {
    color: #6366f1;
    background-color: #eef2ff;
}

.file-action.view-file:hover {
    color: #10b981;
    background-color: #ecfdf5;
}

.file-action.edit-file:hover {
    color: #3b82f6;
    background-color: #eff6ff;
}

.file-action.download-item:hover {
    color: #8b5cf6;
    background-color: #f5f3ff;
}

.file-action.delete-item:hover {
    color: #ef4444;
    background-color: #fef2f2;
}

.no-files {
    padding: 40px;
    text-align: center;
    color: #94a3b8;
    font-style: italic;
}

/* File Icons Colors */
#page-container .fa-file-code { color: #3b82f6 !important; }
#page-container .fa-file-alt { color: #10b981 !important; }
#page-container .fa-file-pdf { color: #ef4444 !important; }
#page-container .fa-file-word { color: #3b82f6 !important; }
#page-container .fa-file-excel { color: #10b981 !important; }
#page-container .fa-file-powerpoint { color: #f59e0b !important; }
#page-container .fa-file-image { color: #8b5cf6 !important; }
#page-container .fa-file-audio { color: #ec4899 !important; }
#page-container .fa-file-video { color: #ef4444 !important; }
#page-container .fa-file-archive { color: #6366f1 !important; }
.layer-toolbar .fa-database { color: #0ea5e9 !important; }
#page-container .fa-folder { color: #f59e0b !important; }

/* ============================================= */
/* File Editor Overlay (Full Screen Code Editor) */
/* ============================================= */
.file-editor-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #1e1e2e;
    z-index: 10000;
    flex-direction: column;
    animation: editorFadeIn 0.25s ease;
}

.file-editor-overlay.open {
    display: flex;
}

@keyframes editorFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.file-editor-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

/* Editor Header */
.file-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    min-height: 48px;
    background: #252536;
    border-bottom: 1px solid #3a3a52;
    flex-shrink: 0;
}

.file-editor-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.file-editor-icon {
    color: #7c8aff;
    font-size: 16px;
    flex-shrink: 0;
}

.file-editor-filename {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-editor-path {
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
}

.file-editor-unsaved {
    color: #f59e0b;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    animation: unsavedPulse 2s ease-in-out infinite;
}

.file-editor-view-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #1e3a5f;
    color: #93c5fd;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    flex-shrink: 0;
    letter-spacing: 0.3px;
}

@keyframes unsavedPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.file-editor-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.file-editor-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.15s ease;
    background: #3b82f6;
    color: #fff;
}

.file-editor-btn:hover {
    background: #2563eb;
}

.file-editor-btn-secondary {
    background: #3a3a52;
    color: #cbd5e1;
}

.file-editor-btn-secondary:hover {
    background: #4a4a66;
    color: #e2e8f0;
}

.file-editor-btn-close {
    background: transparent;
    color: #94a3b8;
    padding: 6px 10px;
    font-size: 18px;
}

.file-editor-btn-close:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Editor Body - CodeMirror container */
.file-editor-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.file-editor-body .CodeMirror {
    height: 100%;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    background: #1e1e2e;
    color: #cdd6f4;
}

.file-editor-body .CodeMirror-gutters {
    background: #1e1e2e;
    border-right: 1px solid #313244;
    color: #585b70;
}

.file-editor-body .CodeMirror-linenumber {
    color: #585b70;
    padding: 0 8px;
}

.file-editor-body .CodeMirror-cursor {
    border-left: 2px solid #f5e0dc;
}

.file-editor-body .CodeMirror-selected {
    background: #45475a !important;
}

.file-editor-body .CodeMirror-focused .CodeMirror-selected {
    background: #45475a !important;
}

.file-editor-body .CodeMirror-activeline-background {
    background: rgba(69, 71, 90, 0.3);
}

.file-editor-body .CodeMirror-matchingbracket {
    color: #a6e3a1 !important;
    text-decoration: underline;
}

/* Catppuccin-inspired syntax highlighting */
.file-editor-body .cm-s-default .cm-keyword { color: #cba6f7; }
.file-editor-body .cm-s-default .cm-atom { color: #fab387; }
.file-editor-body .cm-s-default .cm-number { color: #fab387; }
.file-editor-body .cm-s-default .cm-def { color: #89b4fa; }
.file-editor-body .cm-s-default .cm-variable { color: #cdd6f4; }
.file-editor-body .cm-s-default .cm-variable-2 { color: #89dceb; }
.file-editor-body .cm-s-default .cm-variable-3,
.file-editor-body .cm-s-default .cm-type { color: #f9e2af; }
.file-editor-body .cm-s-default .cm-comment { color: #6c7086; font-style: italic; }
.file-editor-body .cm-s-default .cm-string { color: #a6e3a1; }
.file-editor-body .cm-s-default .cm-string-2 { color: #a6e3a1; }
.file-editor-body .cm-s-default .cm-meta { color: #f38ba8; }
.file-editor-body .cm-s-default .cm-qualifier { color: #f9e2af; }
.file-editor-body .cm-s-default .cm-builtin { color: #89b4fa; }
.file-editor-body .cm-s-default .cm-bracket { color: #9399b2; }
.file-editor-body .cm-s-default .cm-tag { color: #f38ba8; }
.file-editor-body .cm-s-default .cm-attribute { color: #f9e2af; }
.file-editor-body .cm-s-default .cm-hr { color: #585b70; }
.file-editor-body .cm-s-default .cm-link { color: #89b4fa; }
.file-editor-body .cm-s-default .cm-error { color: #f38ba8; }
.file-editor-body .cm-s-default .cm-property { color: #89dceb; }
.file-editor-body .cm-s-default .cm-operator { color: #94e2d5; }

/* Scrollbar styling for editor */
.file-editor-body .CodeMirror-vscrollbar,
.file-editor-body .CodeMirror-hscrollbar {
    outline: none;
}

.file-editor-body .CodeMirror-scroll::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.file-editor-body .CodeMirror-scroll::-webkit-scrollbar-track {
    background: #1e1e2e;
}

.file-editor-body .CodeMirror-scroll::-webkit-scrollbar-thumb {
    background: #45475a;
    border-radius: 5px;
}

.file-editor-body .CodeMirror-scroll::-webkit-scrollbar-thumb:hover {
    background: #585b70;
}

/* Editor Status Bar */
.file-editor-statusbar {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 0 16px;
    height: 28px;
    min-height: 28px;
    background: #181825;
    border-top: 1px solid #313244;
    color: #6c7086;
    font-size: 12px;
    font-family: monospace;
    flex-shrink: 0;
}

.file-editor-statusbar span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
    .folder-list-header, .folder-item {
        grid-template-columns: 30% 30% 20% 20%;
    }
    
    .files-list-header, .file-item {
        grid-template-columns: 40% 20% 20% 20%;
    }
    
    .file-modified { display: none; }
    .files-list-header div:nth-child(4) { display: none; }
}

@media (max-width: 768px) {
    .folder-list-header { display: none; }
    .folder-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .folder-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 10px;
        border-top: 1px solid #f1f5f9;
        padding-top: 10px;
    }
    
    .files-list-header { display: none; }
    .file-item {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .file-type, .file-size, .file-modified { font-size: 12px; }
    .file-actions {
        width: 100%;
        justify-content: flex-start;
        margin-top: 10px;
        border-top: 1px solid #f1f5f9;
        padding-top: 10px;
    }
    
    .file-editor-header {
        padding: 0 10px;
    }
    
    .file-editor-path {
        display: none;
    }
}