Files
MarkLite/renderer/style.css
T

1043 lines
18 KiB
CSS

/* ===== Reset & Base ===== */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary: #1a73e8;
--primary-light: #e8f0fe;
--primary-dark: #1557b0;
--bg: #ffffff;
--bg-secondary: #f8f9fa;
--bg-tertiary: #f1f3f4;
--text: #333333;
--text-secondary: #5f6368;
--text-tertiary: #9aa0a6;
--border: #e1e4e8;
--border-light: #f0f0f0;
--code-bg: #f6f8fa;
--shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
--shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
--radius: 6px;
--toolbar-height: 44px;
--statusbar-height: 28px;
--sidebar-width: 240px;
--sidebar-bg: var(--bg-secondary);
--sidebar-border: var(--border);
--sidebar-hover: var(--bg-tertiary);
--sidebar-active: var(--primary-light);
--search-bg: var(--bg-secondary);
--search-border: var(--border);
--font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-mono: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace;
}
/* ===== Dark Theme ===== */
:root.dark {
--primary: #8ab4f8;
--primary-light: #1a3a5c;
--primary-dark: #aecbfa;
--bg: #1e1e1e;
--bg-secondary: #252526;
--bg-tertiary: #2d2d2d;
--text: #d4d4d4;
--text-secondary: #9e9e9e;
--text-tertiary: #6e6e6e;
--border: #3e3e3e;
--border-light: #333333;
--code-bg: #2d2d2d;
--shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
--shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
}
html, body {
height: 100%;
font-family: var(--font-ui);
font-size: 14px;
color: var(--text);
background: var(--bg);
overflow: hidden;
user-select: none;
}
#app {
display: flex;
flex-direction: column;
height: 100vh;
}
/* ===== Toolbar ===== */
#toolbar {
height: var(--toolbar-height);
background: var(--bg);
border-bottom: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 8px;
flex-shrink: 0;
z-index: 10;
}
.toolbar-left,
.toolbar-right {
display: flex;
align-items: center;
gap: 2px;
}
.toolbar-btn {
display: flex;
align-items: center;
gap: 5px;
padding: 6px 12px;
border: none;
background: transparent;
color: var(--text-secondary);
font-size: 13px;
font-family: var(--font-ui);
border-radius: var(--radius);
cursor: pointer;
transition: all 0.15s ease;
white-space: nowrap;
}
.toolbar-btn:hover {
background: var(--bg-tertiary);
color: var(--text);
}
.toolbar-btn.active {
background: var(--primary-light);
color: var(--primary);
}
.toolbar-btn svg {
flex-shrink: 0;
}
.toolbar-divider {
width: 1px;
height: 24px;
background: var(--border);
margin: 0 6px;
}
/* ===== Modified Banner ===== */
#modified-banner {
display: flex;
align-items: center;
gap: 12px;
padding: 6px 12px;
background: #fff3cd;
border-bottom: 1px solid #ffc107;
font-size: 13px;
color: #856404;
flex-shrink: 0;
}
:root.dark #modified-banner {
background: #3a3000;
border-bottom-color: #665500;
color: #ffd54f;
}
#modified-banner.hidden {
display: none;
}
.banner-btn {
padding: 2px 10px;
border: 1px solid #ffc107;
border-radius: 4px;
background: transparent;
color: #856404;
font-size: 12px;
cursor: pointer;
font-family: var(--font-ui);
}
:root.dark .banner-btn {
border-color: #665500;
color: #ffd54f;
}
.banner-btn:hover {
background: #ffc107;
color: #000;
}
:root.dark .banner-btn:hover {
background: #665500;
color: #fff;
}
/* ===== Tab Bar ===== */
#tab-bar {
height: 36px;
background: var(--bg-secondary);
border-bottom: 1px solid var(--border);
display: flex;
align-items: flex-end;
padding: 0 4px;
flex-shrink: 0;
overflow-x: auto;
overflow-y: hidden;
}
#tab-bar::-webkit-scrollbar {
height: 0;
}
#tab-list {
display: flex;
align-items: flex-end;
gap: 1px;
flex: 1;
min-width: 0;
overflow-x: auto;
overflow-y: hidden;
}
#tab-list::-webkit-scrollbar {
height: 0;
}
.tab-item {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 12px;
background: transparent;
border: none;
border-bottom: 2px solid transparent;
color: var(--text-secondary);
font-size: 12px;
font-family: var(--font-ui);
cursor: pointer;
white-space: nowrap;
max-width: 180px;
min-width: 60px;
flex-shrink: 0;
transition: all 0.15s ease;
position: relative;
}
.tab-item:hover {
color: var(--text);
background: var(--bg-tertiary);
}
.tab-item.active {
color: var(--text);
background: var(--bg);
border-bottom-color: var(--primary);
}
.tab-item.modified .tab-name::after {
content: ' •';
color: var(--primary);
}
.tab-name {
overflow: hidden;
text-overflow: ellipsis;
pointer-events: none;
}
.tab-close {
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
border: none;
background: transparent;
color: var(--text-tertiary);
border-radius: 3px;
cursor: pointer;
flex-shrink: 0;
padding: 0;
opacity: 0;
transition: all 0.1s ease;
}
.tab-item:hover .tab-close,
.tab-item.active .tab-close {
opacity: 1;
}
.tab-close:hover {
background: var(--border);
color: var(--text);
}
.tab-add-btn {
display: flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
border: none;
background: transparent;
color: var(--text-secondary);
border-radius: var(--radius);
cursor: pointer;
margin-left: 2px;
margin-bottom: 4px;
flex-shrink: 0;
transition: all 0.15s ease;
}
.tab-add-btn:hover {
background: var(--bg-tertiary);
color: var(--text);
}
/* ===== Main Content ===== */
#workspace {
flex: 1;
display: flex;
flex-direction: row;
overflow: hidden;
min-height: 0;
}
#main-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
position: relative;
min-width: 0;
}
#content-wrapper {
flex: 1;
display: flex;
flex-direction: row;
overflow: hidden;
min-height: 0;
}
/* ===== Editor Panel ===== */
#editor-panel {
flex: 1;
display: flex;
flex-direction: column;
min-width: 0;
border-right: 1px solid var(--border);
}
#editor-wrapper {
flex: 1;
display: flex;
overflow: hidden;
position: relative;
}
#line-numbers {
width: 50px;
background: var(--bg-secondary);
border-right: 1px solid var(--border-light);
padding: 12px 0;
text-align: right;
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.6;
color: var(--text-tertiary);
overflow: hidden;
user-select: none;
flex-shrink: 0;
}
#line-numbers .line-num {
padding-right: 12px;
height: 20.8px;
}
#editor {
flex: 1;
width: 100%;
padding: 12px 16px;
border: none;
outline: none;
resize: none;
font-family: var(--font-mono);
font-size: 13px;
line-height: 1.6;
color: var(--text);
background: var(--bg);
tab-size: 4;
overflow-y: auto;
user-select: text;
}
#editor::placeholder {
color: var(--text-tertiary);
}
/* ===== Resizer ===== */
#resizer {
width: 4px;
background: var(--border);
cursor: col-resize;
transition: background 0.15s ease;
flex-shrink: 0;
}
#resizer:hover,
#resizer.active {
background: var(--primary);
}
/* ===== Preview Panel ===== */
#preview-panel {
flex: 1;
overflow-y: auto;
min-width: 0;
background: var(--bg);
}
#preview {
padding: 24px 32px;
max-width: 900px;
margin: 0 auto;
user-select: text;
cursor: text;
}
/* ===== Markdown Body Styles ===== */
.markdown-body {
font-family: var(--font-ui);
font-size: 15px;
line-height: 1.7;
color: var(--text);
word-wrap: break-word;
}
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
margin-top: 24px;
margin-bottom: 16px;
font-weight: 600;
line-height: 1.25;
color: var(--text);
}
.markdown-body h1 {
font-size: 2em;
padding-bottom: 0.3em;
border-bottom: 1px solid var(--border);
}
.markdown-body h2 {
font-size: 1.5em;
padding-bottom: 0.3em;
border-bottom: 1px solid var(--border-light);
}
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: var(--text-secondary); }
.markdown-body p {
margin-top: 0;
margin-bottom: 16px;
}
.markdown-body a {
color: var(--primary);
text-decoration: none;
cursor: pointer;
}
.markdown-body a:hover {
text-decoration: underline;
}
.markdown-body strong { font-weight: 600; }
.markdown-body img {
max-width: 100%;
height: auto;
border-radius: var(--radius);
margin: 8px 0;
}
.markdown-body hr {
height: 2px;
background: var(--border);
border: none;
margin: 24px 0;
border-radius: 1px;
}
.markdown-body blockquote {
margin: 0 0 16px 0;
padding: 4px 16px;
border-left: 4px solid var(--primary);
color: var(--text-secondary);
background: var(--bg-secondary);
border-radius: 0 var(--radius) var(--radius) 0;
}
.markdown-body blockquote p:last-child {
margin-bottom: 0;
}
.markdown-body ul,
.markdown-body ol {
margin-top: 0;
margin-bottom: 16px;
padding-left: 2em;
}
.markdown-body li {
margin-top: 4px;
}
.markdown-body li + li {
margin-top: 4px;
}
.markdown-body code {
font-family: var(--font-mono);
font-size: 0.9em;
background: var(--code-bg);
padding: 2px 6px;
border-radius: 4px;
color: #e83e8c;
}
:root.dark .markdown-body code {
color: #f48fb1;
}
.markdown-body pre {
margin-top: 0;
margin-bottom: 16px;
padding: 16px;
background: var(--code-bg);
border-radius: var(--radius);
overflow-x: auto;
border: 1px solid var(--border-light);
}
.markdown-body pre code {
padding: 0;
background: transparent;
color: inherit;
font-size: 13px;
line-height: 1.5;
}
.markdown-body table {
border-collapse: collapse;
width: 100%;
margin-bottom: 16px;
overflow-x: auto;
display: block;
}
.markdown-body table th,
.markdown-body table td {
padding: 8px 16px;
border: 1px solid var(--border);
text-align: left;
}
.markdown-body table th {
font-weight: 600;
background: var(--bg-secondary);
}
.markdown-body table tr:nth-child(even) {
background: var(--bg-secondary);
}
.markdown-body input[type="checkbox"] {
margin-right: 6px;
accent-color: var(--primary);
}
/* ===== Status Bar ===== */
#statusbar {
height: var(--statusbar-height);
background: var(--bg-secondary);
border-top: 1px solid var(--border);
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
font-size: 12px;
color: var(--text-secondary);
flex-shrink: 0;
}
.status-left,
.status-right {
display: flex;
align-items: center;
gap: 8px;
}
.status-divider {
color: var(--border);
}
.status-size-divider {
display: none;
}
.status-size-divider.visible {
display: inline;
}
/* ===== Drop Overlay ===== */
#drop-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(26, 115, 232, 0.1);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
border: 3px dashed var(--primary);
margin: 8px;
border-radius: 12px;
}
#drop-overlay.hidden {
display: none;
}
.drop-content {
text-align: center;
color: var(--primary);
}
.drop-content svg {
margin-bottom: 12px;
opacity: 0.7;
}
.drop-content p {
font-size: 18px;
font-weight: 500;
}
/* ===== Welcome Screen ===== */
#welcome-screen {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
background: var(--bg);
z-index: 5;
}
#welcome-screen.hidden {
display: none;
}
.welcome-content {
text-align: center;
max-width: 480px;
padding: 40px;
}
.welcome-icon {
margin-bottom: 24px;
}
.welcome-content h1 {
font-size: 28px;
font-weight: 600;
color: var(--text);
margin-bottom: 8px;
}
.welcome-content > p {
font-size: 16px;
color: var(--text-secondary);
margin-bottom: 32px;
}
.welcome-actions {
display: flex;
gap: 12px;
justify-content: center;
margin-bottom: 32px;
}
.welcome-btn {
display: flex;
align-items: center;
gap: 8px;
padding: 10px 24px;
border: none;
border-radius: var(--radius);
font-size: 14px;
font-family: var(--font-ui);
font-weight: 500;
cursor: pointer;
transition: all 0.15s ease;
}
.welcome-btn.primary {
background: var(--primary);
color: white;
}
.welcome-btn.primary:hover {
background: var(--primary-dark);
box-shadow: var(--shadow-lg);
}
.welcome-btn.secondary {
background: var(--bg-secondary);
color: var(--text);
border: 1px solid var(--border);
}
.welcome-btn.secondary:hover {
background: var(--bg-tertiary);
}
.welcome-tips {
text-align: left;
background: var(--bg-secondary);
border-radius: var(--radius);
padding: 16px 20px;
border: 1px solid var(--border-light);
}
.welcome-tips p {
font-size: 13px;
color: var(--text-secondary);
margin-bottom: 6px;
}
.welcome-tips p:last-child {
margin-bottom: 0;
}
/* ===== Sidebar ===== */
#sidebar {
width: var(--sidebar-width);
min-width: 180px;
max-width: 500px;
background: var(--sidebar-bg);
border-right: 1px solid var(--sidebar-border);
display: flex;
flex-direction: column;
flex-shrink: 0;
overflow: hidden;
user-select: none;
}
#sidebar.collapsed {
display: none;
}
#sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
border-bottom: 1px solid var(--sidebar-border);
flex-shrink: 0;
}
#sidebar-title {
font-size: 12px;
font-weight: 600;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.sidebar-header-btn {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border: none;
background: transparent;
color: var(--text-secondary);
border-radius: 4px;
cursor: pointer;
transition: all 0.15s ease;
}
.sidebar-header-btn:hover {
background: var(--sidebar-hover);
color: var(--text);
}
#sidebar-tree {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 4px 0;
}
.tree-item {
display: flex;
align-items: center;
padding: 3px 8px 3px 0;
cursor: pointer;
font-size: 13px;
color: var(--text);
white-space: nowrap;
transition: background 0.1s ease;
border-radius: 0;
}
.tree-item:hover {
background: var(--sidebar-hover);
}
.tree-item.active {
background: var(--sidebar-active);
color: var(--primary);
font-weight: 500;
}
.tree-indent {
flex-shrink: 0;
}
.tree-arrow {
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
flex-shrink: 0;
color: var(--text-tertiary);
transition: transform 0.15s ease;
}
.tree-arrow.expanded {
transform: rotate(90deg);
}
.tree-icon {
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
flex-shrink: 0;
margin-right: 4px;
}
.tree-icon svg {
width: 14px;
height: 14px;
}
.tree-name {
overflow: hidden;
text-overflow: ellipsis;
}
/* ===== Search & Replace Bar ===== */
#search-bar {
background: var(--search-bg);
border-bottom: 1px solid var(--search-border);
padding: 6px 10px;
flex-shrink: 0;
}
#search-bar.hidden {
display: none;
}
.search-row,
#replace-row {
display: flex;
align-items: center;
gap: 4px;
}
#replace-row {
margin-top: 4px;
}
#replace-row.hidden {
display: none;
}
#search-input,
#replace-input {
flex: 1;
min-width: 0;
height: 26px;
padding: 0 8px;
border: 1px solid var(--border);
border-radius: 4px;
background: var(--bg);
color: var(--text);
font-size: 13px;
font-family: var(--font-ui);
outline: none;
transition: border-color 0.15s ease;
}
#search-input:focus,
#replace-input:focus {
border-color: var(--primary);
}
#search-count {
font-size: 11px;
color: var(--text-tertiary);
white-space: nowrap;
min-width: 40px;
text-align: center;
}
.search-opt-btn {
display: flex;
align-items: center;
justify-content: center;
min-width: 26px;
height: 26px;
padding: 0 4px;
border: 1px solid var(--border);
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
font-size: 11px;
font-weight: 600;
font-family: var(--font-mono);
cursor: pointer;
transition: all 0.15s ease;
}
.search-opt-btn:hover {
background: var(--bg-tertiary);
}
.search-opt-btn.active {
background: var(--primary-light);
color: var(--primary);
border-color: var(--primary);
}
.search-nav-btn {
display: flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border: none;
background: transparent;
color: var(--text-secondary);
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: all 0.15s ease;
}
.search-nav-btn:hover {
background: var(--bg-tertiary);
color: var(--text);
}
.replace-btn {
height: 26px;
padding: 0 10px;
border: 1px solid var(--border);
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
font-size: 12px;
font-family: var(--font-ui);
cursor: pointer;
white-space: nowrap;
transition: all 0.15s ease;
}
.replace-btn:hover {
background: var(--bg-tertiary);
color: var(--text);
}
/* ===== Search Highlight Overlays ===== */
.search-hl {
background: rgba(255, 220, 0, 0.35);
border-radius: 2px;
}
.search-hl.current {
background: rgba(255, 150, 0, 0.55);
}
:root.dark .search-hl {
background: rgba(255, 220, 0, 0.25);
}
:root.dark .search-hl.current {
background: rgba(255, 150, 0, 0.4);
}
/* ===== View Modes ===== */
#app.mode-editor #preview-panel,
#app.mode-editor #resizer {
display: none;
}
#app.mode-preview #editor-panel,
#app.mode-preview #resizer {
display: none;
}
/* ===== Scrollbar ===== */
::-webkit-scrollbar {
width: 8px;
height: 8px;
}
::-webkit-scrollbar-track {
background: transparent;
}
::-webkit-scrollbar-thumb {
background: var(--border);
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--text-tertiary);
}
/* ===== Animations ===== */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(8px); }
to { opacity: 1; transform: translateY(0); }
}
.welcome-content {
animation: fadeIn 0.3s ease;
}