/* ═══════════════════════════════════════════════════════════════════
   NotionEditor — Notion-like WYSIWYG Editor Styles
   Calm, clean, premium typography inspired by Notion + Bauhaus.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Editor Wrapper ── */
.ne-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.ne-editor-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.08) transparent;
}

.ne-editor-area::-webkit-scrollbar {
    width: 4px;
}

.ne-editor-area::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

/* ── ProseMirror Editor Core ── */
.ne-editor-area .ProseMirror {
    outline: none;
    min-height: 200px;
    padding: 0.25rem 0;
    font-family: var(--lk-font-sans, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif);
    font-size: 0.9375rem;
    line-height: 1.75;
    color: var(--lk-text, #37352f);
    caret-color: var(--lk-primary, #3E6D66);
}

.ne-editor-area .ProseMirror:focus {
    outline: none;
}

/* ── Placeholder ── */
.ne-editor-area .ProseMirror.ne-empty::before {
    content: attr(data-placeholder);
    float: left;
    color: var(--lk-text-muted, #a0aec0);
    pointer-events: none;
    height: 0;
    font-style: normal;
    opacity: 0.6;
}

.ne-editor-area .ProseMirror p.ne-empty-node:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: var(--lk-text-muted, #a0aec0);
    pointer-events: none;
    height: 0;
    font-style: normal;
    opacity: 0.5;
}

/* ── Typography — Notion-style ── */
.ne-editor-area .ProseMirror p {
    margin: 0.125rem 0;
}

.ne-editor-area .ProseMirror h1 {
    font-family: var(--lk-font-display, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif);
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.25;
    margin-top: 2rem;
    margin-bottom: 0.25rem;
    color: var(--lk-text, #37352f);
    letter-spacing: -0.02em;
}

.ne-editor-area .ProseMirror h2 {
    font-family: var(--lk-font-display, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif);
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    margin-top: 1.5rem;
    margin-bottom: 0.125rem;
    color: var(--lk-text, #37352f);
    letter-spacing: -0.01em;
}

.ne-editor-area .ProseMirror h3 {
    font-family: var(--lk-font-display, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.35;
    margin-top: 1.25rem;
    margin-bottom: 0.125rem;
    color: var(--lk-text, #37352f);
}

/* First heading should not have extra top margin */
.ne-editor-area .ProseMirror > h1:first-child,
.ne-editor-area .ProseMirror > h2:first-child,
.ne-editor-area .ProseMirror > h3:first-child {
    margin-top: 0;
}

/* ── Bold / Italic / Strike / Underline ── */
.ne-editor-area .ProseMirror strong {
    font-weight: 650;
}

.ne-editor-area .ProseMirror em {
    font-style: italic;
}

.ne-editor-area .ProseMirror s {
    text-decoration: line-through;
    opacity: 0.65;
}

.ne-editor-area .ProseMirror u {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ── Inline Code ── */
.ne-editor-area .ProseMirror code {
    font-family: var(--lk-font-mono);
    font-size: 0.85em;
    background: rgba(135, 131, 120, 0.12);
    color: #eb5757;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
}

/* ── Code Block ── */
.ne-editor-area .ProseMirror .ne-code-block {
    font-family: var(--lk-font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    background: rgba(135, 131, 120, 0.06);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin: 0.5rem 0;
    overflow-x: auto;
    tab-size: 2;
    white-space: pre;
}

.ne-editor-area .ProseMirror .ne-code-block code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
    border-radius: 0;
}

/* ── Blockquote ── */
.ne-editor-area .ProseMirror .ne-blockquote {
    border-left: 3px solid var(--lk-primary, #3E6D66);
    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    background: rgba(62, 109, 102, 0.06);
    border-radius: 0 0.5rem 0.5rem 0;
    color: var(--lk-text, #37352f);
    opacity: 0.9;
}

.ne-editor-area .ProseMirror .ne-blockquote p {
    margin: 0;
}

/* ── Lists ── */
.ne-editor-area .ProseMirror .ne-bullet-list,
.ne-editor-area .ProseMirror .ne-ordered-list {
    padding-left: 1.5rem;
    margin: 0.25rem 0;
}

.ne-editor-area .ProseMirror .ne-bullet-list li,
.ne-editor-area .ProseMirror .ne-ordered-list li {
    margin: 0.125rem 0;
}

.ne-editor-area .ProseMirror .ne-bullet-list li::marker {
    color: var(--lk-text-muted, #a0aec0);
}

/* ── Task List ── */
.ne-editor-area .ProseMirror .ne-task-list {
    list-style: none;
    padding-left: 0;
    margin: 0.25rem 0;
}

.ne-editor-area .ProseMirror .ne-task-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.25rem 0;
}

.ne-editor-area .ProseMirror .ne-task-list li > label {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-top: 0.2rem;
}

.ne-editor-area .ProseMirror .ne-task-list li > label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 2px solid var(--lk-text-muted, #cbd5e0);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.ne-editor-area .ProseMirror .ne-task-list li > label input[type="checkbox"]:hover {
    border-color: var(--lk-primary, #3E6D66);
    background: rgba(62, 109, 102, 0.05);
}

.ne-editor-area .ProseMirror .ne-task-list li > label input[type="checkbox"]:checked {
    background: var(--lk-primary, #3E6D66);
    border-color: var(--lk-primary, #3E6D66);
}

.ne-editor-area .ProseMirror .ne-task-list li > label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.ne-editor-area .ProseMirror .ne-task-list li[data-checked="true"] > div {
    text-decoration: line-through;
    opacity: 0.5;
}

/* ── Horizontal Rule ── */
.ne-editor-area .ProseMirror .ne-hr {
    border: none;
    border-top: 1px solid rgba(55, 53, 47, 0.09);
    margin: 1rem 0;
}

/* ── Link ── */
.ne-editor-area .ProseMirror .ne-link {
    color: var(--lk-primary, #3E6D66);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: rgba(62, 109, 102, 0.4);
    cursor: pointer;
    transition: text-decoration-color 0.15s ease;
}

.ne-editor-area .ProseMirror .ne-link:hover {
    text-decoration-color: var(--lk-primary, #3E6D66);
}

/* ── Highlight / Mark ── */
.ne-editor-area .ProseMirror mark {
    background: rgba(255, 212, 0, 0.35);
    border-radius: 2px;
    padding: 0.0625rem 0;
}

/* ═══════════════════════════════════════════════════════════
   BUBBLE MENU (floating toolbar on selection)
   ═══════════════════════════════════════════════════════════ */

.ne-bubble-menu {
    position: absolute;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 1px;
    padding: 4px 6px;
    background: #1f2023;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255, 255, 255, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px) scale(0.98);
    transition: opacity 0.12s ease, visibility 0.12s ease, transform 0.12s ease;
    pointer-events: none;
}

.ne-bubble-menu--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.ne-bubble-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #ffffffcc;
    cursor: pointer;
    transition: all 0.1s ease;
    padding: 0;
}

.ne-bubble-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.ne-bubble-btn--active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.ne-bubble-btn .material-symbols-outlined {
    font-size: 18px;
    font-variation-settings: 'FILL' 0, 'wght' 400;
}

.ne-bubble-sep {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.12);
    margin: 0 3px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   SLASH COMMAND MENU
   ═══════════════════════════════════════════════════════════ */

.ne-slash-menu {
    position: absolute;
    z-index: 100;
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--lk-surface, #fff);
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.04);
    padding: 6px;
    scrollbar-width: thin;
    animation: ne-slash-in 0.12s ease;
}

@keyframes ne-slash-in {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ne-slash-header {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lk-text-muted, #718096);
    padding: 6px 8px 4px;
}

.ne-slash-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.04);
    margin: 4px 8px;
}

.ne-slash-item {
    all: unset;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.625rem !important;
    width: 100%;
    padding: 6px 8px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    text-align: left !important;
    transition: background 0.08s ease;
    font-family: inherit;
    font-size: inherit;
    box-sizing: border-box !important;
}

.ne-slash-item:hover,
.ne-slash-item--selected {
    background: rgba(62, 109, 102, 0.06);
}

.ne-slash-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    min-height: 36px;
    border-radius: 6px;
    background: rgba(62, 109, 102, 0.08);
    color: var(--lk-primary, #3E6D66);
    font-size: 20px;
    flex-shrink: 0;
    flex-grow: 0;
    padding: 0;
    box-sizing: border-box;
    font-variation-settings: 'FILL' 0, 'wght' 300;
    overflow: hidden;
}

.ne-slash-text {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
}

.ne-slash-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--lk-text, #37352f);
    line-height: 1.3;
}

.ne-slash-desc {
    font-size: 0.75rem;
    color: var(--lk-text-muted, #718096);
    line-height: 1.3;
}

/* ═══════════════════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════════════════ */

.dark-theme .ne-editor-area .ProseMirror {
    color: #e2e8f0;
}

.dark-theme .ne-editor-area .ProseMirror h1,
.dark-theme .ne-editor-area .ProseMirror h2,
.dark-theme .ne-editor-area .ProseMirror h3 {
    color: #f7fafc;
}

.dark-theme .ne-editor-area .ProseMirror code {
    background: rgba(135, 131, 120, 0.2);
    color: #ff7b72;
}

.dark-theme .ne-editor-area .ProseMirror .ne-code-block {
    background: rgba(255, 255, 255, 0.05);
}

.dark-theme .ne-editor-area .ProseMirror .ne-blockquote {
    border-left-color: rgba(90, 158, 149, 0.6);
    background: rgba(90, 158, 149, 0.08);
    color: #e2e8f0;
}

.dark-theme .ne-editor-area .ProseMirror .ne-hr {
    border-top-color: rgba(255, 255, 255, 0.08);
}

.dark-theme .ne-editor-area .ProseMirror mark {
    background: rgba(255, 212, 0, 0.2);
}

.dark-theme .ne-editor-area .ProseMirror .ne-task-list li > label input[type="checkbox"] {
    border-color: #4a5568;
}

.dark-theme .ne-editor-area .ProseMirror .ne-task-list li > label input[type="checkbox"]:hover {
    border-color: rgba(90, 158, 149, 0.7);
    background: rgba(90, 158, 149, 0.08);
}

.dark-theme .ne-editor-area .ProseMirror .ne-link {
    color: #5a9e95;
    text-decoration-color: rgba(90, 158, 149, 0.4);
}

.dark-theme .ne-editor-area .ProseMirror .ne-link:hover {
    text-decoration-color: #5a9e95;
}

.dark-theme .ne-editor-area .ProseMirror .ne-bullet-list li::marker {
    color: #4a5568;
}

/* Slash menu dark mode */
.dark-theme .ne-slash-menu {
    background: #2d3748;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.dark-theme .ne-slash-divider {
    background: rgba(255, 255, 255, 0.06);
}

.dark-theme .ne-slash-item:hover,
.dark-theme .ne-slash-item--selected {
    background: rgba(90, 158, 149, 0.12);
}

.dark-theme .ne-slash-icon {
    background: rgba(90, 158, 149, 0.15);
    color: #5a9e95;
}

.dark-theme .ne-slash-label {
    color: #f7fafc;
}

.dark-theme .ne-slash-desc {
    color: #a0aec0;
}

.dark-theme .ne-slash-header {
    color: #a0aec0;
}

/* Dark mode scrollbar */
.dark-theme .ne-editor-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.dark-theme .ne-editor-area {
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .ne-editor-area .ProseMirror {
        font-size: 0.875rem;
    }

    .ne-editor-area .ProseMirror h1 {
        font-size: 1.5rem;
    }

    .ne-editor-area .ProseMirror h2 {
        font-size: 1.25rem;
    }

    .ne-editor-area .ProseMirror h3 {
        font-size: 1.125rem;
    }

    .ne-slash-menu {
        width: 240px;
    }
}

/* ═══════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════ */

@media print {
    .ne-bubble-menu,
    .ne-slash-menu {
        display: none !important;
    }
}
