/**
 * NOTES WORD STYLE v7.0
 * ProductiveApp — Word-like editor design
 * Overrides the old editor styles with a clean, modern, Word-inspired layout
 */

/* ===== RESET LEGACY CONFLICTING STYLES ===== */
.notes-layout { display: none !important; }

/* ===== MAIN APP CONTAINER ===== */
.notes-app {
    display: flex;
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg-primary, #0d0e1a);
    color: var(--text-primary, #e4e7ec);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ===== SIDEBAR ===== */
.notes-app-sidebar {
    width: 260px;
    min-width: 200px;
    max-width: 380px;
    flex-shrink: 0;
    background: var(--bg-secondary, #111827);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    transition: width 0.25s ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Sidebar Header */
.notes-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.notes-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #e4e7ec);
}

.notes-sidebar-brand svg {
    color: var(--accent, #5865f2);
    opacity: 0.9;
}

.notes-brand-label {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.notes-count-badge {
    background: rgba(88,101,242,0.18);
    color: var(--accent, #5865f2);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
}

.notes-sidebar-header-btns {
    display: flex;
    gap: 4px;
}

.notes-header-icon-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}

.notes-header-icon-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary, #e4e7ec);
}

.notes-header-icon-btn.primary {
    background: var(--accent, #5865f2);
    color: white;
}

.notes-header-icon-btn.primary:hover {
    background: var(--accent-hover, #4752c4);
    transform: scale(1.05);
}

/* Search */
.notes-sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}

.notes-search-icon {
    color: var(--text-muted, #6b7280);
    flex-shrink: 0;
    display: flex;
}

.notes-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #e4e7ec);
    font-size: 13px;
    font-family: inherit;
}

.notes-search-input::placeholder {
    color: var(--text-muted, #6b7280);
}

/* Single scrollable area for sidebar content */
.notes-sidebar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.notes-sidebar-scroll::-webkit-scrollbar { width: 4px; }
.notes-sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.notes-sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.notes-sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* Folders section */
.notes-folders-section {
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.notes-section-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--text-secondary, #9ca3af);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    transition: color 0.15s ease;
    user-select: none;
}

.notes-section-header:hover {
    color: var(--text-primary, #e4e7ec);
}

.notes-section-header svg {
    flex-shrink: 0;
}

.notes-section-toggle {
    margin-left: auto;
}

.notes-folders-tree {
    padding: 0 8px 8px;
}

.notes-folders-tree.collapsed {
    display: none;
}

/* Folder items (from NotesSidebar) */
.sidebar-folder-item { margin: 1px 0; }
.sidebar-folder-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s ease;
    color: var(--text-primary, #e4e7ec);
}
.sidebar-folder-header:hover { background: rgba(255,255,255,0.06); }
.sidebar-folder-name { flex: 1; }
.sidebar-folder-count {
    font-size: 10px;
    color: var(--text-muted, #6b7280);
    background: rgba(255,255,255,0.06);
    padding: 1px 5px;
    border-radius: 8px;
}

/* Notes list section (flat — scrolled by parent .notes-sidebar-scroll) */
.notes-list-section-flat {
    padding-bottom: 12px;
}

.notes-section-header-label {
    padding: 8px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #6b7280);
}

.notes-list {
    padding: 4px 8px;
}

/* Note item */
.note-item {
    border-radius: 7px;
    cursor: pointer;
    margin: 1px 0;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    border: 1px solid transparent;
}

.note-item:hover {
    background: rgba(128,128,128,0.08);
    border-color: rgba(128,128,128,0.06);
}

.note-item.active {
    background: color-mix(in srgb, var(--accent, #5865f2) 15%, transparent);
    border-color: color-mix(in srgb, var(--accent, #5865f2) 30%, transparent);
}

.note-item.pinned { order: -1; }

.note-item-inner {
    padding: 8px 10px;
}

.note-item-title-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
}

.note-item-pin { color: var(--accent, #5865f2); flex-shrink: 0; }

.note-item-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary, #e4e7ec);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.note-item.active .note-item-title { color: var(--accent, #5865f2); font-weight: 600; }

.note-item-preview {
    font-size: 11.5px;
    color: var(--text-muted, #6b7280);
    margin: 0 0 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.note-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.note-item-date {
    font-size: 10.5px;
    color: var(--text-muted, #6b7280);
}

.note-item-folder {
    font-size: 10px;
    background: rgba(255,255,255,0.06);
    color: var(--text-secondary, #9ca3af);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Empty notes list */
.notes-list-empty {
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
}
.notes-list-empty-btn {
    margin-top: 8px;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.notes-list-empty-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary, #e4e7ec); }

/* New folder bar (inside folder tree) */
.sidebar-new-folder-bar {
    padding: 4px 8px 6px;
}

.sidebar-btn-sm {
    padding: 4px 10px !important;
    font-size: 11.5px !important;
    gap: 4px !important;
}

/* ===== RESIZE HANDLE ===== */
.notes-sidebar-resizer {
    width: 4px;
    background: transparent;
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    transition: background 0.2s;
}

.notes-sidebar-resizer:hover,
.notes-sidebar-resizer.dragging {
    background: var(--accent, #5865f2);
}

.notes-sidebar-resizer::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: -3px; right: -3px;
}

/* ===== EDITOR AREA ===== */
.notes-app-editor {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary, #0a0e1a);
    overflow: hidden;
}

/* ===== EMPTY STATE ===== */
.notes-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted, #6b7280);
    padding: 40px;
    text-align: center;
}

.notes-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.notes-empty-icon svg {
    width: 32px;
    height: 32px;
    opacity: 0.4;
}

.notes-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary, #9ca3af);
    margin: 0;
}

.notes-empty-sub {
    font-size: 13px;
    color: var(--text-muted, #6b7280);
    max-width: 280px;
    line-height: 1.5;
    margin: 0;
}

.notes-empty-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 20px;
    background: var(--accent, #5865f2);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s ease-out, background 0.2s ease-out, border-color 0.2s ease-out, color 0.2s ease-out, opacity 0.2s ease-out;
    margin-top: 8px;
}

.notes-empty-btn:hover {
    background: var(--accent-hover, #4752c4);
    transform: translateY(-1px);
}

/* ===== DOCUMENT WRAPPER ===== */
.notes-document-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Sticky toolbar */
.notes-toolbar-sticky {
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: var(--bg-secondary, #111827);
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 44px;
}

/* Scrollable document area */
.notes-document-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-primary, #0d0e1a);
    padding: 40px 32px 60px;
    display: flex;
    justify-content: center;
}

.notes-document-scroll::-webkit-scrollbar { width: 7px; }
.notes-document-scroll::-webkit-scrollbar-track { background: transparent; }
.notes-document-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 4px; }
.notes-document-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Document page (Word-like — elevated card effect) */
.notes-document-page {
    width: 100%;
    max-width: 820px;
    min-height: calc(100vh - 220px);
    background: var(--doc-bg, #1a1f35);
    border-radius: 10px;
    padding: 52px 64px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.06);
    transition: box-shadow 0.3s ease, background 0.3s ease;
}

.notes-document-page:focus-within {
    box-shadow: 0 12px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(88,101,242,0.2);
}

@media (max-width: 900px) {
    .notes-document-scroll { padding: 24px 16px; }
    .notes-document-page { padding: 32px 28px; border-radius: 8px; }
}

@media (max-width: 600px) {
    .notes-document-page { padding: 24px 18px; border-radius: 0; }
}

/* Document header: title + meta */
.notes-doc-header {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.notes-doc-title-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

/* Title (auto-resize textarea) */
.note-title-h1 {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 30px;
    font-weight: 800;
    color: var(--text-primary, #f0f2f5);
    font-family: 'Inter', -apple-system, sans-serif;
    line-height: 1.25;
    letter-spacing: -0.03em;
    resize: none;
    overflow: hidden;
    min-height: 44px;
    padding: 4px 0;
}

.note-title-h1::placeholder {
    color: rgba(255,255,255,0.18);
    font-weight: 400;
}

.notes-doc-header-actions {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-shrink: 0;
    padding-top: 4px;
}

.note-action-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.04);
    color: var(--text-secondary, #9ca3af);
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    white-space: nowrap;
}

.note-action-pill:hover { background: rgba(255,255,255,0.08); color: var(--text-primary, #e4e7ec); }
.note-action-pill.public { color: #34d399; border-color: rgba(52,211,153,0.2); }
.note-action-pill.public:hover { background: rgba(52,211,153,0.08); }
.note-action-pill.danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; border-color: rgba(239,68,68,0.2); }

/* Meta row */
.notes-doc-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
}

.notes-doc-date { }
.notes-doc-sep { opacity: 0.4; }

/* Content area */
.notes-doc-content {
    position: relative;
}

.note-content-area {
    width: 100%;
    min-height: 500px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #dde2ef);
    font-family: 'Inter', 'Georgia', serif;
    font-size: 15.5px;
    line-height: 1.85;
    resize: none;
    overflow: hidden;
    letter-spacing: 0.01em;
    display: block;
    caret-color: var(--accent, #5865f2);
}

.note-content-area::placeholder {
    color: rgba(255,255,255,0.15);
    font-style: italic;
    font-family: inherit;
}

/* ===== DOCUMENT FOOTER (stats bar like GIRI Word) ===== */
.notes-document-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 28px;
    border-top: 1px solid rgba(255,255,255,0.06);
    background: color-mix(in srgb, var(--bg-primary, #0d0e1a) 90%, black);
    font-size: 11px;
    color: var(--text-muted, #475569);
    flex-shrink: 0;
}

.save-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    transition: color 0.3s ease;
}

.save-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.save-indicator.saved { color: #34d399; }
.save-indicator.saved .save-dot { background: #34d399; }
.save-indicator.saving { color: #f59e0b; animation: pulse 1s infinite; }
.save-indicator.saving .save-dot { background: #f59e0b; animation: pulse 1s infinite; }
.save-indicator.unsaved { color: #f87171; }
.save-indicator.unsaved .save-dot { background: #f87171; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.notes-footer-center {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--text-muted, #6b7280);
}

.notes-footer-right {}

.notes-footer-btn {
    padding: 4px 12px;
    border: 1px solid rgba(88,101,242,0.3);
    border-radius: 5px;
    background: transparent;
    color: rgba(165,173,255,0.8);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}

.notes-footer-btn:hover {
    background: rgba(88,101,242,0.12);
    color: #a5adff;
}

/* ===== TOOLBAR (GIRI Word style) ===== */
.notes-toolbar {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    gap: 1px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    min-height: 40px;
}

.notes-toolbar::-webkit-scrollbar { display: none; }

.toolbar-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, #94a3b8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    flex-shrink: 0;
    padding: 0;
    position: relative;
}

.toolbar-btn:hover {
    background: rgba(128,128,128,0.12);
    color: var(--text-primary, #e4e7ec);
}

.toolbar-btn.active {
    background: color-mix(in srgb, var(--accent, #5865f2) 20%, transparent);
    color: var(--accent-light, #818cf8);
}

.toolbar-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.08);
    margin: 0 6px;
    flex-shrink: 0;
}

.toolbar-spacer { flex: 1; }

/* AI toolbar button */
.toolbar-btn-ai {
    background: linear-gradient(135deg, rgba(88,101,242,0.2) 0%, rgba(147,51,234,0.2) 100%);
    border: 1px solid rgba(88,101,242,0.3);
    color: #a5adff !important;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    width: auto;
    padding: 0 10px;
    gap: 4px;
}

.toolbar-btn-ai:hover {
    background: linear-gradient(135deg, rgba(88,101,242,0.35) 0%, rgba(147,51,234,0.35) 100%) !important;
    border-color: rgba(88,101,242,0.5) !important;
    color: white !important;
}

/* Mode buttons */
.toolbar-mode-group { display: flex; gap: 1px; }
.toolbar-mode-btn { border-radius: 4px; }
.toolbar-mode-btn.active {
    background: rgba(88,101,242,0.18);
    color: var(--accent, #5865f2);
}

/* Right toolbar group */
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

/* ===== AI ORGANIZE PANEL ===== */
.notes-ai-organize-panel {
    position: absolute;
    bottom: 60px;
    left: 12px;
    right: 12px;
    background: var(--bg-tertiary, #161b2e);
    border: 1px solid rgba(88,101,242,0.25);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    z-index: 1000;
    overflow: hidden;
}

.ai-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.ai-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #e4e7ec);
}

.ai-panel-icon {
    font-size: 16px;
    color: #a5adff;
}

.ai-panel-close {
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}

.ai-panel-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary, #e4e7ec); }

.ai-panel-body {
    padding: 14px;
    max-height: 380px;
    overflow-y: auto;
}

.ai-panel-desc {
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    margin: 0 0 12px;
    line-height: 1.5;
}

.ai-panel-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-option-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    transition: background 0.15s;
}

.ai-option-card:hover { background: rgba(255,255,255,0.06); }

.ai-option-card.featured {
    background: linear-gradient(135deg, rgba(88,101,242,0.08) 0%, rgba(147,51,234,0.08) 100%);
    border-color: rgba(88,101,242,0.2);
}

.ai-option-icon { font-size: 18px; flex-shrink: 0; }

.ai-option-info { flex: 1; min-width: 0; }
.ai-option-info strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-primary, #e4e7ec); }
.ai-option-info p { font-size: 11px; color: var(--text-muted, #6b7280); margin: 2px 0 0; }

.ai-option-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    white-space: nowrap;
}

.ai-option-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary, #e4e7ec);
}

.ai-option-btn.primary {
    background: linear-gradient(135deg, #5865f2, #9333ea);
    border-color: transparent;
    color: white;
}

.ai-option-btn.primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Progress */
.ai-progress-area {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}

.ai-progress-bar-wrapper {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.ai-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #5865f2, #9333ea);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.ai-progress-label {
    font-size: 11.5px;
    color: var(--text-muted, #6b7280);
    margin: 0;
}

/* Result */
.ai-result-area { margin-top: 10px; }
.ai-result-success {
    padding: 10px 12px;
    background: rgba(52,211,153,0.08);
    border: 1px solid rgba(52,211,153,0.2);
    border-radius: 8px;
    font-size: 12.5px;
    color: #34d399;
    line-height: 1.7;
}
.ai-result-success ul { margin: 6px 0 0; padding-left: 16px; }
.ai-result-error {
    padding: 10px 12px;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    font-size: 12.5px;
    color: #ef4444;
}

/* ===== AI MINI PANEL ===== */
.notes-ai-mini-panel {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 320px;
    background: var(--bg-tertiary, #161b2e);
    border: 1px solid rgba(88,101,242,0.3);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
    z-index: 100;
    overflow: hidden;
    animation: slideInRight 0.2s ease;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.mini-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-size: 13px;
    font-weight: 600;
    color: #a5adff;
}

.mini-panel-header button {
    border: none;
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 6px;
    border-radius: 4px;
}

.mini-panel-header button:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }

.mini-panel-body { padding: 14px; }

.mini-panel-loading {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted, #6b7280);
    padding: 10px 0;
}

.mini-panel-result { display: flex; flex-direction: column; gap: 9px; }

.mini-result-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mini-result-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #6b7280);
}

.mini-result-value {
    font-size: 12.5px;
    color: var(--text-primary, #e4e7ec);
}

.mini-result-text {
    font-size: 12px;
    color: var(--text-secondary, #9ca3af);
    line-height: 1.5;
}

.mini-result-score {
    font-size: 16px;
    font-weight: 700;
    color: #fbbf24;
}

.mini-result-apply {
    border: 1px solid rgba(88,101,242,0.3);
    background: transparent;
    border-radius: 5px;
    color: #a5adff;
    font-size: 12px;
    padding: 4px 8px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}

.mini-result-apply:hover { background: rgba(88,101,242,0.12); }

.mini-result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.mini-tag {
    padding: 2px 7px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary, #9ca3af);
}

.mini-panel-actions {
    display: flex;
    gap: 7px;
    margin-top: 4px;
}

.mini-action-btn {
    flex: 1;
    padding: 7px 12px;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.1);
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}

.mini-action-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }
.mini-action-btn.primary {
    background: linear-gradient(135deg, #5865f2, #9333ea);
    border-color: transparent;
    color: white;
}
.mini-action-btn.primary:hover { opacity: 0.9; }

.mini-panel-error {
    font-size: 12px;
    color: #ef4444;
    text-align: center;
    padding: 8px;
}

/* ===== SIDEBAR CONTEXT MENU ===== */
.sidebar-context-menu {
    position: fixed;
    background: var(--bg-tertiary, #1a1f35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
    z-index: 1200;
    padding: 6px;
    min-width: 180px;
    animation: fadeInScale 0.12s ease;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary, #e4e7ec);
    transition: background 0.12s;
}

.context-menu-item:hover {
    background: rgba(255,255,255,0.08);
}

.context-menu-item.context-menu-danger { color: #ef4444; }
.context-menu-item.context-menu-danger:hover { background: rgba(239,68,68,0.12); }

.context-menu-label {
    padding: 6px 12px 4px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #6b7280);
    user-select: none;
}

.context-menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 4px 8px;
}

/* Note dragging state */
.note-item.dragging {
    opacity: 0.4;
    border-style: dashed;
    border-color: var(--accent, #5865f2);
}

/* ===== FOLDER POPUP MODAL ===== */
.nfp-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55);
    backdrop-filter: blur(4px);
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInScale 0.15s ease;
}

.nfp-modal {
    background: var(--bg-tertiary, #1a1f35);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.7);
    width: 380px;
    max-width: 90vw;
    overflow: hidden;
}

.nfp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.nfp-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #f0f2f5);
}

.nfp-close {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted, #6b7280);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}

.nfp-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary, #e4e7ec); }

.nfp-body {
    padding: 18px 22px;
}

.nfp-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #6b7280);
    margin-bottom: 6px;
}

.nfp-input {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: var(--text-primary, #e4e7ec);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.nfp-input:focus {
    border-color: var(--accent, #5865f2);
    box-shadow: 0 0 0 3px rgba(88,101,242,0.15);
}

.nfp-colors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nfp-color-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.nfp-color-dot:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.nfp-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px 18px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

.nfp-btn {
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
    border: none;
}

.nfp-btn-cancel {
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    border: 1px solid rgba(255,255,255,0.1);
}

.nfp-btn-cancel:hover { background: rgba(255,255,255,0.06); color: var(--text-primary, #e4e7ec); }

.nfp-btn-create {
    background: var(--accent, #5865f2);
    color: white;
}

.nfp-btn-create:hover {
    background: var(--accent-hover, #4752c4);
    transform: translateY(-1px);
}

/* ===== SIDEBAR NOTE & FOLDER ITEMS — improved styling ===== */
.sidebar-note-item {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    margin: 1px 4px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary, #9ca3af);
    transition: transform 0.12s ease-out, background 0.12s ease-out, border-color 0.12s ease-out, color 0.12s ease-out, opacity 0.12s ease-out;
    border: 1px solid transparent;
}

.sidebar-note-item:hover {
    background: rgba(128,128,128,0.08);
    color: var(--text-primary, #e4e7ec);
}

.sidebar-note-item.active {
    background: color-mix(in srgb, var(--accent, #5865f2) 15%, transparent);
    border-color: color-mix(in srgb, var(--accent, #5865f2) 25%, transparent);
    color: var(--accent-light, #818cf8);
}

.sidebar-note-icon { flex-shrink: 0; opacity: 0.6; }
.sidebar-note-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-folder-menu {
    opacity: 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: var(--text-muted, #6b7280);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease-out, background 0.12s ease-out, border-color 0.12s ease-out, color 0.12s ease-out, opacity 0.12s ease-out;
    flex-shrink: 0;
}

.sidebar-folder-header:hover .sidebar-folder-menu { opacity: 1; }
.sidebar-folder-menu:hover { background: rgba(255,255,255,0.1); color: var(--text-primary, #e4e7ec); }

/* Sidebar toolbar (new folder + new note buttons in tree) */
.sidebar-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px;
}

.sidebar-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary, #9ca3af);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.15s ease-out, background 0.15s ease-out, border-color 0.15s ease-out, color 0.15s ease-out, opacity 0.15s ease-out;
}

.sidebar-btn:hover { background: rgba(255,255,255,0.06); color: var(--text-primary, #e4e7ec); }

.sidebar-btn.sidebar-btn-primary {
    background: color-mix(in srgb, var(--accent, #5865f2) 15%, transparent);
    border-color: color-mix(in srgb, var(--accent, #5865f2) 25%, transparent);
    color: var(--accent-light, #818cf8);
}

.sidebar-btn.sidebar-btn-primary:hover {
    background: color-mix(in srgb, var(--accent, #5865f2) 25%, transparent);
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    margin: 0 8px 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 7px;
}

.sidebar-search-icon { color: var(--text-muted, #6b7280); flex-shrink: 0; display: flex; }

.sidebar-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary, #e4e7ec);
    font-size: 12px;
    font-family: inherit;
}

.sidebar-search-input::placeholder { color: var(--text-muted, #6b7280); }

.sidebar-folders {
    flex: 1;
    overflow-y: auto;
    padding: 0 4px 8px;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted, #6b7280);
}

.sidebar-empty {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted, #6b7280);
    font-size: 13px;
}

.sidebar-empty p { margin: 0 0 12px; }

/* Drag over state for folders */
.sidebar-folder-item.drag-over > .sidebar-folder-header {
    background: color-mix(in srgb, var(--accent, #5865f2) 12%, transparent);
    border-radius: 6px;
}

.sidebar-folder-children {
    padding-left: 14px;
    border-left: 1px solid rgba(255,255,255,0.04);
    margin-left: 10px;
}

/* ===== GRAPH VIEW — remove classification button ===== */
.graph-btn-classify { display: none !important; }
.notes-ai-classifier-btn { display: none !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .notes-app-sidebar { width: 100%; position: absolute; z-index: 50; }
    .notes-sidebar-resizer { display: none; }
    .notes-document-page { padding: 24px 18px; }
    .note-title-h1 { font-size: 22px; }
    .note-content-area { font-size: 14px; }
}
