:root {
    --bg-main: #1e1e1e;
    --bg-sidebar: #202020;
    --bg-input: #2a2a2a;
    --border: #333;
    --accent: #7d5fff;
    --accent-hover: #6c4df0;
    --text-main: #dcddde;
    --text-muted: #8e9297;
    --selection: rgba(125, 95, 255, 0.3);
    --font-ui: 'Inter', sans-serif;
    --font-editor: 'JetBrains Mono', monospace;
}

body {
    margin: 0;
    background: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-ui);
    height: 100vh;
    overflow: hidden;
}

/* --- Auth Screen --- */
#auth-overlay {
    position: fixed;
    inset: 0;
    background: #111;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    width: 320px;
    text-align: center;
}

.logo-icon {
    width: 48px;
    height: 48px;
    color: var(--accent);
    margin-bottom: 1rem;
}

.auth-box h1 {
    margin: 0 0 1.5rem 0;
    font-weight: 600;
    font-size: 1.5rem;
}

.auth-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg-input);
    border: 1px solid #333;
    color: white;
    border-radius: 6px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.auth-box input:focus {
    border-color: var(--accent);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.subtext {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 1rem;
    line-height: 1.4;
}

/* --- Layout --- */
#app-container {
    display: flex;
    height: 100vh;
}

#sidebar {
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.vault-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.sidebar-header button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.sidebar-header button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

#file-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

.file-item {
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-left: 2px solid transparent;
}

.file-item:hover {
    background: #2a2d2e;
    color: var(--text-main);
}

.file-item.active {
    background: #373c3e;
    color: white;
    border-left-color: var(--accent);
}

.file-item i {
    width: 16px;
    height: 16px;
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
}

.sidebar-footer button {
    background: none;
    border: 1px solid var(--border);
    width: 100%;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
}

.sidebar-footer button:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}

/* --- Split Gutter --- */
.gutter {
    background-color: var(--bg-main);
    cursor: col-resize;
    transition: background 0.2s;
}

.gutter:hover {
    background-color: var(--accent);
}

/* --- Editor --- */
#main-pane {
    display: flex;
    flex-direction: column;
    background: var(--bg-main);
}

.editor-header {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#note-title {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    width: 100%;
    outline: none;
    font-family: var(--font-ui);
}

.editor-actions {
    display: flex;
    gap: 10px;
}

.editor-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
}

.editor-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* EasyMDE Overrides */
.EasyMDEContainer {
    border: none !important;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.editor-toolbar {
    display: none !important;
}

.CodeMirror {
    flex: 1;
    background: var(--bg-main) !important;
    color: var(--text-main) !important;
    border: none !important;
    font-family: var(--font-editor) !important;
    font-size: 15px;
    line-height: 1.6;
    padding: 0 10px;
}

.CodeMirror-cursor {
    border-left: 2px solid var(--accent) !important;
}

.editor-preview {
    background: var(--bg-main) !important;
    padding: 20px;
}

/* --- Toasts --- */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--accent);
    animation: slideIn 0.3s ease-out;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.note-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.note-date {
    font-size: 0.75rem;
    color: #888;
    margin-top: 2px;
}

/* --- Filters --- */
.filter-box {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
}

.filter-box input[type="text"] {
    width: 100%;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: white;
    border-radius: 4px;
    margin-bottom: 8px;
    box-sizing: border-box;
    font-family: var(--font-ui);
}

.date-filters {
    display: flex;
    gap: 5px;
}

.date-filters input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: white;
    padding: 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: var(--font-ui);
}

/* --- History Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-main);
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-sidebar);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 500;
}

.modal-header button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 5px;
}

.modal-header button:hover {
    opacity: 0.7;
}

.modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.history-list {
    width: 300px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: var(--bg-sidebar);
}

.diff-view {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-family: var(--font-editor);
    white-space: pre-wrap;
    line-height: 1.6;
    color: var(--text-main);
}

.diff-added {
    background: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
}

.diff-removed {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    text-decoration: line-through;
    opacity: 0.7;
}

.history-item {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.2s;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.history-item.active {
    background: rgba(125, 95, 255, 0.1);
    border-left: 3px solid var(--accent);
}

.history-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
}

.history-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    background: #333;
    margin-bottom: 4px;
}

.history-badge.current {
    background: var(--accent);
    color: white;
}