/**
 * Tiro WYSIWYG HTML Editor Styles
 * Clean, minimal interface focused on functionality
 */

/* CSS Variables for Light/Dark Mode */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --toolbar-bg: #ffffff;
    --sidebar-bg: #f8f9fa;
    --button-bg: #f8f9fa;
    --button-hover: #e9ecef;
    --shadow: rgba(0,0,0,0.08);
}

/* Dark Mode - Adwaita GNOME style */
body.dark-mode {
    --bg-primary: #242424;
    --bg-secondary: #303030;
    --bg-tertiary: #383838;
    --text-primary: #ffffff;
    --text-secondary: #c0c0c0;
    --border-color: #3d3d3d;
    --toolbar-bg: #303030;
    --sidebar-bg: #242424;
    --button-bg: #3a3a3a;
    --button-hover: #454545;
    --shadow: rgba(0,0,0,0.3);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-secondary);
    overflow: hidden; /* Prevent page scrolling */
}

/* Fixed Toolbar */
.toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 24px;
    box-shadow: 0 1px 2px var(--shadow);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.toolbar-section {
    display: flex;
    align-items: center;
    gap: 8px;
}

.toolbar-button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.toolbar-button:hover {
    background: var(--bg-tertiary);
    border-color: #adb5bd;
}

.toolbar-button.active {
    background: #007bff;
    color: var(--bg-primary);
    border-color: #007bff;
    box-shadow: 0 2px 6px rgba(0,123,255,0.3);
}

.toolbar-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-primary);
    background: var(--bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    transition: border-color 0.15s ease;
}

.toolbar-select:hover {
    border-color: #007bff;
}

.toolbar-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.editor-mode-selector {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    transition: border-color 0.15s ease;
    cursor: pointer;
}

.editor-mode-selector:hover {
    border-color: #007bff;
}

.editor-mode-selector:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.context-indicator {
    font-weight: 600;
    color: #007bff;
    background: #e7f3ff;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    border: 1px solid rgba(0,123,255,0.1);
}

.template-context {
    background: #fff3cd;
    color: #856404;
    border: 1px solid rgba(133,100,4,0.1);
}

.document-context {
    background: #d4edda;
    color: #155724;
    border: 1px solid rgba(21,87,36,0.1);
}

.trash-context {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid rgba(114,28,36,0.1);
}

/* Main Content Area */
.main-content {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 28px;
    display: flex;
    overflow: hidden;
    z-index: 1;
    transition: right 0.3s ease;
}

.main-content.flyout-open {
    right: 400px;
}

@media (max-width: 768px) {
    .main-content.flyout-open {
        right: 0;
    }
}

/* File Browser Panel */
.file-browser {
    width: 280px;
    background: var(--bg-primary);
    border-right: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    box-shadow: 1px 0 2px rgba(0,0,0,0.05);
}

.file-browser.collapsed {
    /* margin-left set dynamically by JS based on actual width */
}

.panel-header {
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.toggle-button {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: background-color 0.15s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.toggle-button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* File Tree */
.file-tree {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.folder-section {
    margin-bottom: 24px;
}

.folder-title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px 20px;
    cursor: pointer;
    user-select: none;
    background: var(--bg-secondary);
    border-left: 4px solid #007bff;
    transition: background-color 0.15s ease;
    margin: 0 8px;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.folder-title:hover {
    background: var(--bg-tertiary);
}

.folder-title[data-folder="trash"] {
    border-left: 4px solid #dc3545;
    background: #f8f4f4;
}

.folder-title[data-folder="trash"]:hover {
    background: #f2dede;
}

.folder-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

/* folder-icon now styled as CSS chevron in file-browser-new.css */

.file-list {
    list-style: none;
    margin-left: 20px;
    margin-top: 8px;
    display: block;
    max-height: 10000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.file-list.collapsed {
    max-height: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.file-item {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    padding: 10px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-primary);
    transition: background-color 0.15s ease;
    border-left: 3px solid transparent;
    margin: 2px 8px;
    border-radius: 0 4px 4px 0;
}

.file-item:hover {
    background: #f0f4f8;
    border-left: 3px solid var(--text-secondary);
}

.file-item.selected {
    background: #e7f3ff;
    color: #0056b3;
    font-weight: 500;
    border-left: 3px solid #007bff;
}

/* file-icon removed - no more emoji icons */

.file-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    letter-spacing: 0.3px;
}

/* Resize Handle */
.resize-handle {
    width: 4px;
    background: var(--bg-tertiary);
    cursor: col-resize;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.resize-handle:hover {
    background: #007bff;
}

.resize-handle:active {
    background: #0056b3;
}

/* Editor Area */
.editor-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    box-shadow: none;
}

.editor-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.editor-mode {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    overflow: hidden;
}

.editor-mode.active {
    display: flex;
    flex-direction: column;
}

#quill-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    min-height: 0;
    overflow: hidden;
}

.quill-content .ql-toolbar {
    border: none;
    border-bottom: 1px solid #ddd;
    background: #ffffff !important;
    padding: 10px;
    flex-shrink: 0;
}

#quill-content .ql-container {
    flex: 1;
    min-height: 0;
    position: relative !important;
    overflow: hidden !important;
    border: none !important;
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    height: auto !important;
}

#quill-content .ql-editor {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 20px;
    padding-bottom: 30px;
    background: #f8f9fa;
    overflow-y: auto !important;
}

.quill-content .ql-editor:focus {
    background: #ffffff;
}

/* Force white background in dark mode for editor content */
body.dark-mode .quill-content .ql-editor {
    background: #f8f9fa;
    color: #2c3e50;
}

body.dark-mode .quill-content .ql-editor:focus {
    background: #ffffff;
}

/* Force white background for Quill toolbar in dark mode */
body.dark-mode #quill-content {
    background: #ffffff !important;
}

body.dark-mode #visual-editor {
    background: #ffffff !important;
}

body.dark-mode .ql-toolbar,
body.dark-mode .ql-toolbar.ql-snow,
body.dark-mode .quill-content .ql-toolbar {
    background: #ffffff !important;
    background-color: #ffffff !important;
    border-bottom: 1px solid #ddd !important;
    color: #000 !important;
}

body.dark-mode .ql-container,
body.dark-mode .ql-container.ql-snow {
    background: #ffffff !important;
}

body.dark-mode .ql-toolbar .ql-stroke {
    stroke: #444 !important;
}

body.dark-mode .ql-toolbar .ql-fill {
    fill: #444 !important;
}

body.dark-mode .ql-toolbar .ql-picker-label {
    color: #444 !important;
}

body.dark-mode .ql-toolbar .ql-picker-label::before {
    color: #444 !important;
}

body.dark-mode .ql-toolbar button {
    color: #444 !important;
}

body.dark-mode .ql-toolbar button:hover,
body.dark-mode .ql-toolbar button:focus,
body.dark-mode .ql-toolbar button.ql-active {
    background: #f0f0f0 !important;
}

body.dark-mode .ql-toolbar button:hover .ql-stroke,
body.dark-mode .ql-toolbar button.ql-active .ql-stroke {
    stroke: #06c !important;
}

body.dark-mode .ql-toolbar button:hover .ql-fill,
body.dark-mode .ql-toolbar button.ql-active .ql-fill {
    fill: #06c !important;
}

/* Quill dropdown menus in dark mode */
body.dark-mode .ql-picker-options {
    background: #ffffff !important;
    border: 1px solid #ddd !important;
}

body.dark-mode .ql-picker-item {
    color: #444 !important;
}

body.dark-mode .ql-picker-item:hover {
    background: #f0f0f0 !important;
    color: #000 !important;
}

/* Quill color picker in dark mode */
body.dark-mode .ql-color-picker .ql-picker-options {
    background: #ffffff !important;
}

/* Quill tooltip in dark mode */
body.dark-mode .ql-tooltip {
    background: #ffffff !important;
    border: 1px solid #ddd !important;
    color: #444 !important;
}

body.dark-mode .ql-tooltip input[type=text] {
    background: #ffffff !important;
    color: #444 !important;
    border: 1px solid #ddd !important;
}

body.dark-mode .ql-tooltip .ql-action,
body.dark-mode .ql-tooltip .ql-remove {
    color: #06c !important;
}

/* Quill Better Table styles in dark mode */
body.dark-mode .quill-better-table-wrapper {
    background: #ffffff !important;
}

body.dark-mode .qlbt-col-tool,
body.dark-mode .qlbt-operation-menu {
    background: #ffffff !important;
    border: 1px solid #ddd !important;
    color: #444 !important;
}

body.dark-mode .qlbt-operation-menu-item {
    color: #444 !important;
}

body.dark-mode .qlbt-operation-menu-item:hover {
    background: #f0f0f0 !important;
    color: #000 !important;
}

/* Summernote dark mode - keep editor content area light */
body.dark-mode #visual-editor {
    background: #ffffff !important;
}

body.dark-mode .note-editor {
    background: #ffffff !important;
}

body.dark-mode .note-toolbar {
    background: #ffffff !important;
    border-bottom: 1px solid #ddd !important;
}

body.dark-mode .note-toolbar .note-btn {
    background: #ffffff !important;
    color: #444 !important;
    border-color: #ddd !important;
}

body.dark-mode .note-toolbar .note-btn:hover,
body.dark-mode .note-toolbar .note-btn.active {
    background: #f0f0f0 !important;
    color: #000 !important;
}

body.dark-mode .note-toolbar .note-current-fontname,
body.dark-mode .note-toolbar .note-recent-color {
    color: #444 !important;
}

body.dark-mode .note-editing-area {
    background: #ffffff !important;
}

body.dark-mode .note-editable {
    background: #f8f9fa !important;
    color: #2c3e50 !important;
}

body.dark-mode .note-editable:focus {
    background: #ffffff !important;
}

body.dark-mode .note-popover .popover-content,
body.dark-mode .note-popover {
    background: #ffffff !important;
    border: 1px solid #ddd !important;
    color: #444 !important;
}

body.dark-mode .note-popover .note-btn {
    background: #ffffff !important;
    color: #444 !important;
}

body.dark-mode .note-popover .note-btn:hover {
    background: #f0f0f0 !important;
}

body.dark-mode .note-modal .modal-content {
    background: #ffffff !important;
    color: #444 !important;
}

body.dark-mode .note-dropdown-menu {
    background: #ffffff !important;
    border: 1px solid #ddd !important;
}

body.dark-mode .note-dropdown-item {
    color: #444 !important;
}

body.dark-mode .note-dropdown-item:hover {
    background: #f0f0f0 !important;
}

/* Hidden editor toggle */
.editor-hidden {
    display: none !important;
}

/* Summernote Editor Layout */
#summernote-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#visual-editor .note-editor {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    border: none !important;
}

#visual-editor .note-toolbar-wrapper {
    flex-shrink: 0;
}

#visual-editor .note-toolbar {
    border-bottom: 1px solid #ddd;
    background: #ffffff !important;
    padding: 8px 10px;
}

#visual-editor .note-editing-area {
    flex: 1;
    display: flex !important;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

#visual-editor .note-editable {
    flex: 1;
    overflow-y: auto !important;
    padding: 20px;
    padding-bottom: 30px;
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
    background: #f8f9fa;
}

#visual-editor .note-editable:focus {
    background: #ffffff;
}

#visual-editor .note-statusbar {
    display: none;
}

/* Code Editor */
.code-textarea {
    width: 100%;
    height: 100%;
    border: none;
    padding: 20px;
    padding-bottom: 30px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Source Code Pro', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #f8f9fa;
    color: #2c3e50;
    resize: none;
    outline: none;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

/* Force white/light background in dark mode */
body.dark-mode .code-textarea {
    background: #f8f9fa;
    color: #2c3e50;
}

/* Preview Frame */
.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: var(--bg-primary);
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: #343a40;
    color: var(--bg-primary);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 12px;
    gap: 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.1);
}

.status-modified {
    color: #ffc107;
    font-weight: bold;
}

#status-lastsaved {
    color: #adb5bd;
    font-size: 11px;
}

/* Responsive Adjustments */
.editor-area.browser-collapsed {
    margin-left: 0;
}

.main-content.browser-collapsed .file-browser {
    /* margin-left set dynamically by JS based on actual width */
}

.main-content.browser-collapsed .editor-area {
    margin-left: 0;
}

/* Toggle Button Adjustments */
.file-browser.collapsed .toggle-button {
    position: fixed;
    left: 8px;
    top: 60px;
    z-index: 1001;
    background: var(--bg-primary);
    border: 1px solid var(--bg-tertiary);
    border-radius: 0 6px 6px 0;
    transform: rotate(180deg);
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

/* Loading State */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Error States */
.error {
    color: #dc3545;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 12px 20px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    box-shadow: 0 2px 4px rgba(220,53,69,0.1);
}

/* Success States */
.success {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 12px 16px;
    border-radius: 6px;
    margin: 12px 20px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    box-shadow: 0 2px 4px rgba(21,87,36,0.1);
}

/* TinyMCE Customizations */
.tox-tinymce {
    border: none !important;
}

.tox-editor-header {
    display: none !important; /* Hide TinyMCE toolbar since we have our own */
}

.tox-edit-area {
    padding: 20px !important;
}

/* Scrollbar Styling */
.file-tree::-webkit-scrollbar {
    width: 6px;
}

.file-tree::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.file-tree::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.file-tree::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 9999;
    min-width: 120px;
    padding: 4px 0;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.context-menu-item.destructive:hover {
    background: #ffeaa7;
    color: #d63031;
}

.context-menu-item .icon {
    width: 16px;
    text-align: center;
}

.context-menu-separator {
    height: 1px;
    background: #e0e0e0;
    margin: 4px 0;
}

/* Modal Dialog Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    background: var(--bg-primary);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.modal-content {
    margin-bottom: 24px;
}

.modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.modal-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-button {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-secondary);
}

.modal-button:hover {
    background: var(--bg-tertiary);
}

.modal-button.primary {
    background: #007bff;
    color: var(--bg-primary);
    border-color: #007bff;
}

.modal-button.primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.modal-button.danger {
    background: #dc3545;
    color: var(--bg-primary);
    border-color: #dc3545;
}

.modal-button.danger:hover {
    background: #c82333;
    border-color: #c82333;
}

/* Upload Button */
.upload-button {
    background: #28a745;
    color: var(--bg-primary);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
    padding: 0;
}

.upload-button:hover {
    background: #218838;
}
/* Dark Mode Text Overrides */
body.dark-mode .toolbar-button {
    color: #f0f0f0;
}

body.dark-mode .toolbar-select {
    color: #f0f0f0;
    background: var(--button-bg);
}

body.dark-mode .editor-mode-selector {
    color: #f0f0f0;
    background: var(--button-bg);
}

body.dark-mode .toolbar label {
    color: #f0f0f0;
}

body.dark-mode .folder-header {
    color: #f0f0f0;
    background: var(--bg-tertiary);
    border-left: 3px solid #007bff;
}

body.dark-mode .folder-header:hover {
    background: var(--bg-tertiary);
    border-left: 3px solid #f0f0f0;
}

body.dark-mode .folder-name {
    color: #f0f0f0;
}

body.dark-mode .folder-item {
    color: #f0f0f0;
    background: transparent;
}

body.dark-mode .folder-item:hover {
    background: var(--bg-tertiary);
    border-left: 3px solid #f0f0f0;
}

body.dark-mode .folder-name-inline {
    color: #f0f0f0;
}

body.dark-mode .file-item {
    color: #f0f0f0;
    background: transparent;
}

body.dark-mode .file-item:hover {
    background: var(--bg-tertiary);
    border-left: 3px solid #f0f0f0;
}

body.dark-mode .file-item.selected {
    background: var(--bg-tertiary);
    color: #4fc3f7;
}

body.dark-mode .panel-header h3 {
    color: #f0f0f0;
}

body.dark-mode .file-browser {
    background: var(--sidebar-bg);
}

body.dark-mode .context-menu {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .context-menu-item {
    color: #f0f0f0;
}

body.dark-mode .context-menu-item:hover {
    background: var(--bg-tertiary);
}

body.dark-mode .modal-dialog {
    background: var(--bg-secondary);
}

body.dark-mode .modal-title {
    color: #f0f0f0;
}

body.dark-mode .modal-input {
    background: var(--bg-primary);
    color: #f0f0f0;
    border-color: var(--border-color);
}

/* Status bar text in dark mode */
body.dark-mode .status-bar {
    color: #f0f0f0;
}

/* ============================================================================
   DISTRACTION-FREE WRITING MODE
   ============================================================================ */

body.distraction-free .toolbar {
    display: none;
}

body.distraction-free .file-browser,
body.distraction-free .resize-handle {
    display: none;
}

body.distraction-free .status-bar {
    display: none;
}

body.distraction-free .llm-toggle-tab {
    display: none;
}

body.distraction-free .main-content {
    top: 0;
    bottom: 0;
}

body.distraction-free .editor-area {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Keep Summernote/Quill formatting toolbar visible but subtle */
body.distraction-free .ql-toolbar,
body.distraction-free .note-toolbar {
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

body.distraction-free .ql-toolbar:hover,
body.distraction-free .note-toolbar:hover {
    opacity: 1;
}

/* Exit hint toast */
.distraction-free-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.distraction-free-hint.fade-out {
    opacity: 0;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 40px 16px;
    overflow-y: auto;
    background: var(--bg-secondary);
}
.welcome-screen.hidden { display: none; }
.welcome-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}
.recent-section {
    margin-bottom: 14px;
    width: 100%;
    max-width: 900px;
}
.recent-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.recent-grid {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.recent-card {
    width: 156px;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.15s ease;
}
.recent-card:hover { opacity: 0.8; }
.recent-card-preview {
    width: 156px;
    height: 156px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #fff;
    position: relative;
}
.recent-card-inner {
    width: 800px;
    transform: scale(0.195);
    transform-origin: top left;
    pointer-events: none;
    font-family: 'Times New Roman', Times, serif;
    font-size: 12pt;
}
.recent-card-name {
    font-size: 11px;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.recent-card-time {
    font-size: 10px;
    color: var(--text-secondary);
}
.recent-empty {
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}
