/* TipTap Editor Styles */
.tiptap-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-group {
    display: flex;
    gap: 4px;
    padding: 0 4px;
    border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
    border-right: none;
}

.tiptap-btn,
.tiptap-toolbar button {
    padding: 6px 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tiptap-toolbar button:hover {
    background: var(--hover-bg);
}

.tiptap-toolbar button.active {
    background: var(--primary-color);
    color: white;
}

.tiptap-toolbar select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.character-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 0 8px;
}

.tiptap-editor {
    min-height: 300px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.6;
    overflow-y: auto;
    max-height: calc(100vh - 300px);
}

.tiptap-content,
.ProseMirror {
    outline: none;
}

/* Content styles */
.tiptap-editor h1 { font-size: 2em; margin: 0.67em 0; font-weight: 600; }
.tiptap-editor h2 { font-size: 1.5em; margin: 0.75em 0; font-weight: 600; }
.tiptap-editor h3 { font-size: 1.17em; margin: 0.83em 0; font-weight: 600; }
.tiptap-editor p { margin: 1em 0; }
.tiptap-editor ul, .tiptap-editor ol { margin: 1em 0; padding-left: 2em; }
.tiptap-editor li { margin: 0.5em 0; }
.tiptap-editor strong { font-weight: bold; }
.tiptap-editor em { font-style: italic; }
.tiptap-editor s { text-decoration: line-through; }
.tiptap-editor u { text-decoration: underline; }
.tiptap-editor sub { vertical-align: sub; font-size: smaller; }
.tiptap-editor sup { vertical-align: super; font-size: smaller; }

.tiptap-editor blockquote {
    margin: 1em 0;
    padding-left: 20px;
    border-left: 4px solid #ddd;
    color: #666;
}

.tiptap-editor code {
    background: #f4f4f4;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.tiptap-editor pre {
    background: #f4f4f4;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
}

.tiptap-editor pre code {
    background: none;
    padding: 0;
}

.tiptap-editor a {
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
}

.tiptap-editor img {
    max-width: 100%;
    height: auto;
    display: inline-block;
}

.tiptap-editor iframe {
    max-width: 100%;
    border-radius: 4px;
}

/* Table styles */
.tiptap-editor table {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
    margin: 1em 0;
    overflow: hidden;
}

.tiptap-editor td,
.tiptap-editor th {
    min-width: 1em;
    border: 1px solid #ccc;
    padding: 8px;
    vertical-align: top;
    box-sizing: border-box;
    position: relative;
}

.tiptap-editor th {
    font-weight: bold;
    text-align: left;
    background-color: #f4f4f4;
}

.tiptap-editor .selectedCell:after {
    z-index: 2;
    position: absolute;
    content: "";
    left: 0; right: 0; top: 0; bottom: 0;
    background: rgba(200, 200, 255, 0.4);
    pointer-events: none;
}

/* Task list styles */
.tiptap-editor ul[data-type="taskList"] {
    list-style: none;
    padding: 0;
}

.tiptap-editor ul[data-type="taskList"] li {
    display: flex;
    align-items: flex-start;
}

.tiptap-editor ul[data-type="taskList"] li > label {
    flex: 0 0 auto;
    margin-right: 0.5rem;
    user-select: none;
}

.tiptap-editor ul[data-type="taskList"] li > div {
    flex: 1 1 auto;
}

/* Highlight styles */
.tiptap-editor mark {
    background-color: #ffe066;
    padding: 0.125em 0;
    border-radius: 0.25em;
}

/* Text alignment */
.tiptap-editor .has-text-align-left { text-align: left; }
.tiptap-editor .has-text-align-center { text-align: center; }
.tiptap-editor .has-text-align-right { text-align: right; }
.tiptap-editor .has-text-align-justify { text-align: justify; }

/* Placeholder */
.tiptap-editor p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: #adb5bd;
    pointer-events: none;
    height: 0;
}

/* Syntax highlighting */
.tiptap-editor .hljs-comment,
.tiptap-editor .hljs-quote { color: #8e908c; }
.tiptap-editor .hljs-variable,
.tiptap-editor .hljs-template-variable,
.tiptap-editor .hljs-tag,
.tiptap-editor .hljs-name,
.tiptap-editor .hljs-selector-id,
.tiptap-editor .hljs-selector-class,
.tiptap-editor .hljs-regexp,
.tiptap-editor .hljs-deletion { color: #c82829; }
.tiptap-editor .hljs-number,
.tiptap-editor .hljs-built_in,
.tiptap-editor .hljs-builtin-name,
.tiptap-editor .hljs-literal,
.tiptap-editor .hljs-type,
.tiptap-editor .hljs-params,
.tiptap-editor .hljs-meta,
.tiptap-editor .hljs-link { color: #f5871f; }
.tiptap-editor .hljs-attribute { color: #eab700; }
.tiptap-editor .hljs-string,
.tiptap-editor .hljs-symbol,
.tiptap-editor .hljs-bullet,
.tiptap-editor .hljs-addition { color: #718c00; }
.tiptap-editor .hljs-title,
.tiptap-editor .hljs-section { color: #4271ae; }
.tiptap-editor .hljs-keyword,
.tiptap-editor .hljs-selector-tag { color: #8959a8; }

/* Error state */
.tiptap-error,
.editor-error {
    padding: 20px;
    text-align: center;
    color: var(--error-color);
    font-size: 14px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    margin: 10px;
}
