/* ==========================================================================
   JOTTEE APP — MODERN STYLES & DESIGN SYSTEM
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties / Color Tokens
   -------------------------------------------------------------------------- */
:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fira Code', monospace;

    /* Theme - Dark Mode (Default) */
    --bg-primary: #0b0f19;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-glass: rgba(17, 24, 39, 0.75);
    --bg-card: rgba(31, 41, 55, 0.65);
    --bg-card-hover: rgba(55, 65, 81, 0.75);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --border-active: rgba(99, 102, 241, 0.5);

    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Brand & Accent Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    
    --accent-purple: #a855f7;
    --accent-blue: #3b82f6;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    /* Functional Colors */
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #f59e0b;
    
    /* Shadows & Effects */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
    
    --blur-glass: blur(16px);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    --sidebar-width: 280px;
}

/* Light Theme Override */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.15);
    --border-active: rgba(99, 102, 241, 0.6);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* --------------------------------------------------------------------------
   2. Reset & Base Styles
   -------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

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

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
    user-select: none;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* --------------------------------------------------------------------------
   3. Main Layout Structure
   -------------------------------------------------------------------------- */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    position: relative;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   4. Sidebar Component
   -------------------------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform var(--transition-normal);
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-beta {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 99px;
    border: 1px solid rgba(99, 102, 241, 0.3);
    text-transform: uppercase;
}

.close-sidebar-btn {
    display: none;
}

.sidebar-action {
    padding: 0 20px 16px 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-hover);
}

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

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-block {
    width: 100%;
}

kbd {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    margin-left: auto;
    opacity: 0.8;
}

/* Icon Buttons */
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.icon-btn.active {
    background: var(--primary-light);
    color: var(--primary);
}

.icon-btn-xs {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.icon-btn-xs:hover {
    color: var(--text-primary);
    background: var(--border-color);
}

/* Navigation List */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nav-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-right: 8px;
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 6px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
    text-align: left;
    width: 100%;
}

.nav-item i {
    width: 18px;
    height: 18px;
}

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

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-count {
    margin-left: auto;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}

.nav-item.active .nav-count {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

/* Dynamic Tags */
.tags-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tag-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.88rem;
    transition: all var(--transition-fast);
    cursor: pointer;
}

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

.tag-item.active {
    background: var(--bg-tertiary);
    color: var(--primary);
    font-weight: 600;
}

.tag-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tag-badge-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary);
}

/* Color Filters */
.color-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
}

.color-filter-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--dot-color);
    border: 2px solid transparent;
    transition: transform var(--transition-bounce), border-color var(--transition-fast);
}

.color-filter-dot:hover {
    transform: scale(1.2);
}

.color-filter-dot.active {
    border-color: var(--text-primary);
    transform: scale(1.15);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.storage-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.storage-bar {
    width: 100%;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 99px;
    overflow: hidden;
}

.storage-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    border-radius: 99px;
    transition: width 0.3s ease;
}

.storage-text {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.footer-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --------------------------------------------------------------------------
   5. Main Content & Navbar
   -------------------------------------------------------------------------- */
.main-content {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Top Navbar */
.top-navbar {
    height: 70px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: var(--blur-glass);
    z-index: 10;
}

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

.toggle-sidebar-btn {
    display: flex;
}

.current-view-info {
    display: flex;
    flex-direction: column;
}

.view-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.view-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Search Bar */
.navbar-search {
    flex: 1;
    max-width: 480px;
}

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

.search-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    padding: 10px 38px 10px 42px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    transition: all var(--transition-fast);
}

#searchInput:focus {
    border-color: var(--border-active);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: var(--bg-secondary);
}

.clear-search-btn {
    position: absolute;
    right: 10px;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.custom-select {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
}

.custom-select:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.view-mode-toggle {
    display: flex;
    align-items: center;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 2px;
    border: 1px solid var(--border-color);
}

.header-new-btn {
    display: none;
}

/* Active Filter Banner */
.active-filter-banner {
    padding: 12px 24px 0 24px;
}

.filter-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary);
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   6. Notes Grid & List Container
   -------------------------------------------------------------------------- */
.notes-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: grid;
    gap: 20px;
    align-content: start;
}

/* Grid Layout */
.notes-container.grid-view {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* List Layout */
.notes-container.list-view {
    grid-template-columns: 1fr;
}

/* Note Card Component */
.note-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    position: relative;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    backdrop-filter: blur(8px);
    overflow: hidden;
}

.note-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--card-color, transparent);
    opacity: 0.8;
}

.note-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}

.note-card.pinned {
    border-color: rgba(99, 102, 241, 0.35);
}

/* Card Header */
.note-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.note-card-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card-badges {
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge-pin {
    color: var(--primary);
}

.badge-fav {
    color: var(--accent-amber);
}

/* Card Snippet Body */
.note-card-snippet {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.notes-container.list-view .note-card-snippet {
    -webkit-line-clamp: 2;
}

/* Card Footer */
.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.note-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.note-card-tag {
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 99px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
}

.note-card-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.note-card-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.note-card:hover .note-card-actions {
    opacity: 1;
}

/* Empty State */
.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

.empty-state-icon {
    width: 72px;
    height: 72px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.empty-state-icon i {
    width: 36px;
    height: 36px;
}

.empty-state-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state-desc {
    color: var(--text-secondary);
    max-width: 360px;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   7. Editor Drawer / Slide-Over Modal
   -------------------------------------------------------------------------- */
.editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.editor-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.editor-drawer {
    width: 100%;
    max-width: 800px;
    height: 100%;
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
    transform: translateX(100%);
    transition: transform var(--transition-bounce);
}

.editor-overlay.open .editor-drawer {
    transform: translateX(0);
}

/* Editor Header */
.editor-header {
    height: 64px;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.editor-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.save-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.save-status.saving {
    color: var(--accent-amber);
}

.save-status.saved {
    color: var(--accent-emerald);
}

.editor-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Color Picker */
.editor-color-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.color-picker-btn {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: transform var(--transition-fast);
}

.color-picker-btn:hover {
    transform: scale(1.2);
}

.color-picker-btn.active {
    border-color: var(--text-primary);
    transform: scale(1.15);
}

/* Formatting Toolbar */
.editor-toolbar {
    padding: 8px 24px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.toolbar-btn i {
    width: 16px;
    height: 16px;
}

.tb-text {
    font-weight: 700;
    font-size: 0.8rem;
}

.tb-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 4px;
}

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

/* Tags Bar */
.editor-tags-bar {
    padding: 10px 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.1);
}

.tag-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.editor-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.editor-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 99px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
    font-size: 0.78rem;
    font-weight: 600;
}

.editor-tag-chip button {
    color: var(--primary);
    display: flex;
}

#tagInput {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-primary);
}

/* Editor Main Body */
.editor-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-pane {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 24px;
    overflow-y: auto;
}

.note-title-input {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    width: 100%;
}

.note-title-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.note-content-input {
    flex: 1;
    width: 100%;
    height: 100%;
    resize: none;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.note-content-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

/* Preview Pane Styling */
.preview-pane {
    border-left: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.preview-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    margin-bottom: 16px;
}

.preview-content {
    line-height: 1.7;
    color: var(--text-primary);
}

.preview-content h1, .preview-content h2, .preview-content h3 {
    margin-top: 1.2em;
    margin-bottom: 0.6em;
    font-family: var(--font-heading);
}

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

.preview-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 1em 0;
}

.preview-content code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.88rem;
}

.preview-content pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: 1em 0;
}

.preview-content ul, .preview-content ol {
    margin-left: 24px;
    margin-bottom: 1em;
}

/* Editor Footer */
.editor-footer {
    height: 48px;
    padding: 0 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}

.editor-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Dropdown Menu */
.dropdown-wrapper {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 120;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

.dropdown-wrapper.open .dropdown-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 100%;
    text-align: left;
    transition: all var(--transition-fast);
}

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

.dropdown-item.danger {
    color: var(--danger);
}

.dropdown-item.danger:hover {
    background: rgba(239, 68, 68, 0.15);
}

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

/* --------------------------------------------------------------------------
   8. Modals & Toast Notifications
   -------------------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: scale(0.92);
    transition: transform var(--transition-bounce);
}

.modal-overlay.open .modal-card {
    transform: scale(1);
}

.modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.modal-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.modal-message {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

.modal-actions .btn {
    flex: 1;
}

/* Toast System */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 300;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    font-weight: 500;
    transform: translateY(20px);
    opacity: 0;
    transition: all var(--transition-bounce);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-icon.success { color: var(--success); }
.toast-icon.info { color: var(--primary); }
.toast-icon.warning { color: var(--warning); }
.toast-icon.error { color: var(--danger); }

/* --------------------------------------------------------------------------
   9. Responsive Design & Media Queries
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .close-sidebar-btn {
        display: flex;
    }

    .top-navbar {
        padding: 0 16px;
    }

    .navbar-search {
        max-width: 260px;
    }
}

@media (max-width: 600px) {
    .navbar-search {
        display: none;
    }

    .view-title {
        font-size: 1.1rem;
    }

    .header-new-btn {
        display: inline-flex;
    }

    .notes-container {
        padding: 16px;
        gap: 12px;
    }

    .editor-drawer {
        max-width: 100%;
    }
}
