/* Monochrome Edge Editor Styles */

.editor-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--theme-bg);
}

/* Toolbar */
.editor-toolbar {
    display: flex;
    align-items: center;
    height: 48px;
    padding: 0 1rem;
    background: var(--theme-surface);
    border-bottom: 1px solid var(--theme-border);
    gap: 0.5rem;
    overflow-x: auto;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 0.25rem;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--theme-border);
}

.toolbar-spacer {
    flex: 1;
}

.editor-toolbar button {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--theme-text-secondary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

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

.editor-toolbar button:active {
    transform: scale(0.95);
}

.editor-toolbar button.active {
    background: var(--theme-accent);
    color: white;
}

/* Editor Content */
.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* Editor Blocks */
.editor-block {
    margin: 0.5rem 0;
    min-height: 1.5em;
    outline: none;
    position: relative;
    transition: all 0.2s;
}

.editor-block:empty::before {
    content: attr(data-placeholder);
    color: var(--theme-text-muted);
    pointer-events: none;
    position: absolute;
}

.editor-block:focus {
    outline: none;
}

/* Block Types */
.block-heading1 {
    font-size: 2.5em;
    font-weight: 700;
    margin: 1.5rem 0 1rem;
    color: var(--theme-text-primary);
}

.block-heading2 {
    font-size: 2em;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
    color: var(--theme-text-primary);
}

.block-heading3 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 1rem 0 0.5rem;
    color: var(--theme-text-primary);
}

.block-heading4 {
    font-size: 1.25em;
    font-weight: 600;
    margin: 0.75rem 0 0.5rem;
    color: var(--theme-text-primary);
}

.block-paragraph {
    line-height: 1.7;
    color: var(--theme-text-primary);
}

.block-quote {
    border-left: 4px solid var(--theme-accent);
    padding-left: 1rem;
    color: var(--theme-text-secondary);
    font-style: italic;
    margin: 1rem 0;
}

.block-codeblock {
    background: var(--theme-bg);
    border-radius: var(--border-radius);
    padding: 1rem;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 14px;
    margin: 1rem 0;
    overflow-x: auto;
}

.block-codeblock code {
    display: block;
    white-space: pre;
    background: transparent;
    padding: 0;
}

.block-math {
    background: var(--theme-bg);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    margin: 1rem 0;
    cursor: pointer;
}

.block-math.editing {
    outline: 2px solid var(--theme-accent);
}

.block-bullet {
    padding-left: 2rem;
    position: relative;
}

.block-bullet::before {
    content: "•";
    position: absolute;
    left: 0.5rem;
    color: var(--theme-text-secondary);
}

.block-number {
    padding-left: 2rem;
    position: relative;
}

.block-number::before {
    content: attr(data-number) ".";
    position: absolute;
    left: 0;
    color: var(--theme-text-secondary);
    min-width: 1.5rem;
}

.block-checkbox {
    padding-left: 2rem;
    position: relative;
    cursor: pointer;
}

.block-checkbox::before {
    content: "☐";
    position: absolute;
    left: 0.5rem;
    color: var(--theme-text-secondary);
    cursor: pointer;
}

.block-checkbox[data-checked="true"]::before {
    content: "☑";
    color: var(--theme-accent);
}

/* Inline Styles */
.editor-block strong {
    font-weight: 600;
    color: var(--theme-text-primary);
}

.editor-block em {
    font-style: italic;
}

.editor-block del {
    text-decoration: line-through;
    opacity: 0.7;
}

.editor-block code {
    background: var(--theme-bg);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: "SF Mono", Monaco, monospace;
    font-size: 0.9em;
    color: var(--theme-accent);
}

.editor-block a {
    color: var(--theme-accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.editor-block a:hover {
    border-bottom-color: var(--theme-accent);
}

/* Document Links */
.document-link {
    color: var(--theme-accent);
    background: var(--theme-bg);
    padding: 0.2em 0.5em;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.document-link:hover {
    background: var(--theme-accent);
    color: white;
}

/* Tables */
.editor-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.editor-table th,
.editor-table td {
    border: 1px solid var(--theme-border);
    padding: 0.5rem;
    text-align: left;
}

.editor-table th {
    background: var(--theme-bg);
    font-weight: 600;
}

.editor-table tr:hover {
    background: var(--theme-bg);
}

/* Images */
.editor-block img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    display: block;
}

/* Floating Toolbar */
.floating-toolbar {
    position: absolute;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    display: none;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

.floating-toolbar.active {
    display: flex;
    gap: 0.25rem;
}

.floating-toolbar button {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--theme-text-secondary);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.2s;
}

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

.floating-toolbar .toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--theme-border);
    margin: 0 0.25rem;
    align-self: center;
}

/* Slash Commands Menu */
.slash-menu {
    position: absolute;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    min-width: 250px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.slash-menu.active {
    display: block;
}

.slash-item {
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s;
}

.slash-item:hover,
.slash-item.selected {
    background: var(--theme-bg);
}

.slash-item-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--theme-text-secondary);
}

.slash-item-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slash-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--theme-text-primary);
}

.slash-item-shortcut {
    font-size: 11px;
    color: var(--theme-text-muted);
    font-family: "SF Mono", Monaco, monospace;
}

/* Document Link Popup */
.document-link-popup {
    position: absolute;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    width: 300px;
    display: none;
    z-index: 1002;
}

.document-link-popup.active {
    display: block;
}

.document-link-popup input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--theme-border);
    border-radius: var(--border-radius-sm);
    background: var(--theme-bg);
    color: var(--theme-text-primary);
    outline: none;
    margin-bottom: 0.5rem;
}

.document-list {
    max-height: 200px;
    overflow-y: auto;
}

.document-item {
    padding: 0.5rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.document-item:hover {
    background: var(--theme-bg);
}

.document-item-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.document-item-title {
    flex: 1;
    font-size: 14px;
    color: var(--theme-text-primary);
}

.document-item-path {
    font-size: 11px;
    color: var(--theme-text-muted);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes convertBlock {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.02);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.editor-block.converting {
    animation: convertBlock 0.3s ease;
}

/* Drag & Drop */
.editor-content.dragover {
    background: var(--theme-bg);
    outline: 2px dashed var(--theme-accent);
}

.drop-indicator {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--theme-accent);
    pointer-events: none;
    display: none;
}

.drop-indicator.active {
    display: block;
}

/* Image Upload Progress */
.image-upload-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--theme-bg);
    border-radius: var(--border-radius);
    margin: 1rem 0;
}

.upload-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--theme-border);
    border-top-color: var(--theme-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .editor-content {
        padding: 1rem;
    }

    .editor-toolbar {
        padding: 0 0.5rem;
    }

    .toolbar-group button {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* Higher specificity to override inline styles */
    .editor-content-wrapper .floating-toolbar[style],
    .editor-wrapper .floating-toolbar {
        top: auto;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
    }
}
