/* obsidian.css - Authentic Obsidian Dark Theme & Styling */

:root {
    --bg-ribbon: #090e12;
    --bg-sidebar: #0e151b;
    --bg-primary: #121a21;
    --bg-secondary: #17222b;
    --bg-hover: #1e2c36;
    --bg-active: #243542;
    --bg-input: #0a1014;
    
    --border-color: #1e2e38;
    --border-subtle: #16222b;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-faint: #475569;
    
    --accent: #cfa83b;
    --accent-hover: #e5be4e;
    --accent-active: #b58d24;
    --accent-subtle: rgba(207, 168, 59, 0.16);
    --accent-glow: rgba(207, 168, 59, 0.35);

    --teal-accent: #235663;
    --teal-hover: #2e6d7d;
    --teal-subtle: rgba(35, 86, 99, 0.22);
    --teal-border: #1a424c;
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    
    --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', Menlo, Monaco, Consolas, monospace;
    
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-full: 9999px;
    
    --transition-fast: 0.15s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==========================================================================
   APP LAYOUT (Ribbon + Sidebar + Main Workspace)
   ========================================================================== */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--bg-primary);
}

/* 1. LEFT RIBBON */
.ribbon {
    width: 44px;
    min-width: 44px;
    background-color: var(--bg-ribbon);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    z-index: 30;
    user-select: none;
}

.ribbon-top, .ribbon-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.ribbon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.ribbon-btn svg {
    width: 18px;
    height: 18px;
}

.ribbon-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.ribbon-btn.active {
    background-color: var(--accent-subtle);
    color: var(--accent-hover);
}

.ribbon-logo svg {
    display: block;
}

/* 2. SIDEBAR (FILE EXPLORER) */
.sidebar {
    width: 280px;
    min-width: 220px;
    max-width: 450px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden;
    border-right: none;
}

.sidebar-header {
    padding: 12px 14px 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.vault-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn svg {
    width: 15px;
    height: 15px;
}

.sidebar-search-box {
    padding: 8px 12px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper svg {
    position: absolute;
    left: 8px;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 6px 10px 6px 28px;
    font-size: 12px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.search-input:focus {
    border-color: var(--accent);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 6px 4px;
}

/* File Tree Styling */
.tree-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 6px 10px 2px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tree-folder {
    margin-bottom: 2px;
}

.tree-folder-header {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    gap: 6px;
    font-size: 13px;
    transition: background var(--transition-fast);
}

.tree-folder-header:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.tree-folder-arrow {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.tree-folder-arrow svg {
    width: 12px;
    height: 12px;
}

.tree-folder.open > .tree-folder-header .tree-folder-arrow {
    transform: rotate(90deg);
}

.tree-folder-children {
    display: none;
    padding-left: 14px;
    border-left: 1px solid var(--border-subtle);
    margin-left: 10px;
}

.tree-folder.open > .tree-folder-children {
    display: block;
}

.tree-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    gap: 7px;
    font-size: 13px;
    transition: background var(--transition-fast);
    position: relative;
}

.tree-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.tree-item.active {
    background-color: var(--accent-subtle);
    color: var(--text-primary);
    font-weight: 500;
}

.tree-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 3px;
    background-color: var(--accent);
    border-radius: 2px;
}

.tree-item svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.tree-item.active svg {
    color: var(--accent-hover);
}

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

.tree-folder-header .tree-item-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-item-actions {
    display: none;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}

.tree-item:hover .tree-item-actions,
.tree-folder-header:hover .tree-item-actions {
    display: inline-flex;
}

.tree-item-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 3px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.tree-item-actions button:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.tree-item-actions button[title*="Delete"]:hover,
.tree-item-actions button[title*="delete"]:hover {
    color: var(--danger);
    background-color: rgba(239, 68, 68, 0.15);
}

/* Tags Section in Sidebar */
.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 10px;
}

.tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: 11px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tag-badge:hover, .tag-badge.active {
    background-color: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.tag-delete-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 1px;
    margin-left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.tag-badge:hover .tag-delete-btn {
    display: inline-flex;
}

.tag-delete-btn:hover {
    color: #ffffff;
    background-color: var(--danger);
}

/* Global Context Menu */
.app-context-menu {
    position: fixed;
    z-index: 10000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    min-width: 160px;
    padding: 4px;
    font-size: 13px;
    color: var(--text-primary);
    backdrop-filter: blur(8px);
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    user-select: none;
}

.context-menu-item i {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.context-menu-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.context-menu-item:hover i {
    color: var(--accent);
}

.context-menu-item.danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

.context-menu-item.danger:hover i {
    color: var(--danger);
}

.context-menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}

/* 3. MAIN WORKSPACE */
.main-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--bg-primary);
    overflow: hidden;
}

/* Tabs Bar */
.tabs-bar {
    height: 38px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px;
    user-select: none;
}

.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 30px;
    max-width: 180px;
    min-width: 90px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    background: transparent;
    border-right: 1px solid var(--border-subtle);
    position: relative;
    transition: all var(--transition-fast);
}

.tab:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.tab.active {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-weight: 500;
    border-bottom: 2px solid var(--accent);
}

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

.tab-close {
    width: 14px;
    height: 14px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.tab-close:hover {
    opacity: 1;
    background-color: var(--bg-hover);
}

.tab-close svg {
    width: 10px;
    height: 10px;
}

/* Workspace Top Bar (Breadcrumbs & Actions) */
.workspace-topbar {
    height: 44px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background-color: var(--bg-primary);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.breadcrumbs span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.note-title-input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
    outline: none;
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    min-width: 120px;
    flex: 1;
    max-width: 400px;
}

.note-title-input:hover, .note-title-input:focus {
    background-color: var(--bg-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mode-toggle {
    display: flex;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2px;
}

.mode-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.mode-btn svg {
    width: 13px;
    height: 13px;
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background-color: var(--accent);
    color: #ffffff;
}

.save-status-badge {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

/* Editor & Preview Workspace Container */
.editor-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Markdown Toolbar */
.markdown-toolbar {
    height: 34px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 4px;
    overflow-x: auto;
}

.toolbar-btn {
    width: 26px;
    height: 26px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-btn svg {
    width: 14px;
    height: 14px;
}

.toolbar-divider {
    width: 1px;
    height: 16px;
    background-color: var(--border-color);
    margin: 0 4px;
}

/* Editor Pane */
.editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-primary);
}

.editor-textarea {
    flex: 1;
    width: 100%;
    background-color: transparent;
    color: var(--text-primary);
    border: none;
    padding: 24px 32px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.7;
    resize: none;
    outline: none;
    overflow-y: auto;
}

/* Preview Pane */
.preview-pane {
    flex: 1;
    overflow-y: auto;
    padding: 24px 40px;
    background-color: var(--bg-primary);
    border-left: 1px solid var(--border-color);
}

.editor-layout.mode-edit .preview-pane {
    display: none;
}
.editor-layout.mode-edit .editor-pane {
    flex: 1;
}

.editor-layout.mode-preview .editor-pane {
    display: none;
}
.editor-layout.mode-preview .preview-pane {
    display: block;
    flex: 1;
    border-left: none;
}

.editor-layout.mode-split .editor-pane,
.editor-layout.mode-split .preview-pane {
    display: flex;
    flex: 1;
}

/* Right Backlinks Sidebar */
.backlinks-panel {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.backlinks-panel.collapsed {
    width: 0;
    border-left: none;
}

.backlinks-header {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.backlinks-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.backlink-card {
    padding: 8px 10px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.backlink-card:hover {
    border-color: var(--accent);
    background-color: var(--accent-subtle);
}

.backlink-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.backlink-date {
    font-size: 10px;
    color: var(--text-muted);
}

/* ==========================================================================
   MARKDOWN STYLING (True Obsidian Look)
   ========================================================================== */
.markdown-preview {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 15px;
    max-width: 820px;
    margin: 0 auto;
}

.markdown-preview h1, 
.markdown-preview h2, 
.markdown-preview h3, 
.markdown-preview h4 {
    color: #f8fafc;
    margin-top: 1.4em;
    margin-bottom: 0.6em;
    font-weight: 600;
    line-height: 1.3;
}

.markdown-preview h1 {
    font-size: 2em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--border-color);
}

.markdown-preview h2 {
    font-size: 1.5em;
    padding-bottom: 0.2em;
    border-bottom: 1px solid var(--border-subtle);
}

.markdown-preview h3 {
    font-size: 1.25em;
}

.markdown-preview p {
    margin-bottom: 1em;
}

.markdown-preview ul, 
.markdown-preview ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.markdown-preview li {
    margin-bottom: 0.25em;
}

.markdown-preview blockquote {
    border-left: 3px solid var(--accent);
    padding: 6px 16px;
    color: var(--text-secondary);
    background: var(--accent-subtle);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 1em 0;
}

.markdown-preview code:not(pre code) {
    background-color: var(--bg-secondary);
    color: #f43f5e;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.markdown-preview pre {
    background-color: #121215 !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    overflow-x: auto;
    margin: 1em 0;
}

.markdown-preview pre code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
}

.markdown-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.2em 0;
}

.markdown-preview th, 
.markdown-preview td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}

.markdown-preview th {
    background-color: var(--bg-secondary);
    font-weight: 600;
}

.markdown-preview tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

.markdown-preview hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 2em 0;
}

/* Obsidian Bi-directional Wiki-links */
.internal-link {
    color: #e5be4e;
    text-decoration: none;
    background-color: rgba(207, 168, 59, 0.12);
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
    border-bottom: 1px solid rgba(207, 168, 59, 0.45);
}

.internal-link:hover {
    background-color: rgba(207, 168, 59, 0.25);
    color: #fce789;
    border-bottom-color: #fce789;
}

.internal-link-bracket {
    opacity: 0.5;
    font-size: 0.85em;
}

/* Obsidian Callouts */
.callout {
    border-left: 4px solid var(--accent);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin: 1.2em 0;
}
.callout-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--accent-hover);
    font-size: 14px;
}
.callout-title svg {
    width: 16px;
    height: 16px;
}
.callout-tip {
    border-left-color: #10b981;
}
.callout-tip .callout-title {
    color: #10b981;
}
.callout-warning {
    border-left-color: #f59e0b;
}
.callout-warning .callout-title {
    color: #f59e0b;
}
.callout-important, .callout-caution {
    border-left-color: #ef4444;
}
.callout-important .callout-title, .callout-caution .callout-title {
    color: #ef4444;
}

/* ==========================================================================
   GRAPH VIEW & MIND MAP FULLSCREEN OVERLAY
   ========================================================================== */
.graph-modal-overlay,
.mindmap-modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(10, 10, 14, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: flex;
    flex-direction: column;
}

.graph-header,
.mindmap-header {
    height: 52px;
    background-color: var(--bg-ribbon);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.graph-title,
.mindmap-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.graph-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.graph-container,
.mindmap-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, #1b1b22 0%, #111115 100%);
}

#graph-canvas, #mindmap-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Floating Graph Control Panel */
.graph-floating-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(24, 24, 28, 0.92);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    width: 250px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 12px;
}

.control-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-row label {
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.control-row input[type="range"] {
    accent-color: var(--accent);
}

/* ==========================================================================
   MODAL DIALOGS (Native <dialog> standard)
   ========================================================================== */
dialog:modal {
    overscroll-behavior: contain;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    padding: 24px;
    max-width: 500px;
    width: 90vw;
    margin: auto;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

dialog::backdrop {
    overflow: hidden;
    overscroll-behavior: contain;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.dialog-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.dialog-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* Share Link Box */
.share-link-box {
    display: flex;
    gap: 6px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 6px;
}

.share-link-box input {
    background: transparent;
    border: none;
    color: var(--accent-hover);
    flex: 1;
    font-size: 12px;
    font-family: var(--font-mono);
    outline: none;
}

/* Vault Members & Invite Rows */
.member-list, .invite-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.member-row, .invite-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.member-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.member-name {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.member-email {
    font-size: 11px;
    color: var(--text-muted);
}

.shares-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
}

.share-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    background-color: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

/* ==========================================================================
   BUTTONS & INPUTS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #dfb743 0%, #c4992b 100%);
    color: #080d11;
    font-weight: 600;
    border: 1px solid #eed06d;
    box-shadow: 0 4px 14px rgba(207, 168, 59, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #eed06d 0%, #dfb743 100%);
    box-shadow: 0 6px 18px rgba(207, 168, 59, 0.4);
    color: #000000;
}

.btn-ghost {
    background-color: transparent;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-ghost:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-subtle {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
}

.btn-subtle:hover, .btn-subtle.active {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background-color: #ef4444;
    color: #ffffff;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.input-field {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-field:focus {
    border-color: var(--accent);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.badge-subtle {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
}

/* ==========================================================================
   AUTH PAGE SPECIFIC STYLES
   ========================================================================== */
.auth-page {
    background: radial-gradient(circle at 50% 25%, #172a35 0%, #0a0f13 85%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-logo {
    display: inline-flex;
    margin-bottom: 12px;
    filter: drop-shadow(0 0 20px rgba(124, 58, 237, 0.4));
}

.auth-brand h1 {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.auth-tagline {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.auth-card {
    width: 100%;
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.auth-tabs {
    display: flex;
    background-color: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.auth-tab.active {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.auth-alert {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 16px;
}

.auth-alert-error {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.input-icon-wrapper input {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 9px 12px 9px 36px;
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast);
}

.input-icon-wrapper input:focus {
    border-color: var(--accent);
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
}

.auth-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   SHARED NOTE VIEWER STYLES
   ========================================================================== */
.shared-view-body {
    background-color: var(--bg-primary);
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

.shared-header {
    height: 52px;
    background-color: var(--bg-ribbon);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.shared-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.shared-title-bar {
    font-size: 13px;
    color: var(--text-secondary);
}

.shared-title-bar strong {
    color: var(--accent-hover);
}

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

.author-badge {
    font-size: 12px;
    color: var(--text-muted);
}

.shared-container {
    max-width: 860px;
    margin: 40px auto;
    padding: 0 24px;
}

.shared-note-wrapper {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.shared-note-meta {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 16px;
}

.shared-note-meta h1 {
    font-size: 2.2em;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.meta-row {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.meta-date {
    display: flex;
    align-items: center;
    gap: 4px;
}

.save-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--success);
}

.shared-editor-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shared-tabs-toggle {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 8px;
}

.shared-edit-area textarea {
    width: 100%;
    height: 480px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    border-radius: var(--radius-md);
    outline: none;
    resize: vertical;
}

.shared-edit-area textarea:focus {
    border-color: var(--accent);
}

/* Animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}
