.tiptap-editor {
    outline: none;
    caret-color: black;
}

.tiptap-editor p { margin-bottom: 0.75rem; }
.tiptap-editor h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.tiptap-editor h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.tiptap-editor h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.tiptap-editor ul { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 0.75rem; }
.tiptap-editor ol { list-style-type: decimal; padding-left: 1.5rem; margin-bottom: 0.75rem; }
.tiptap-editor li { margin-bottom: 0.25rem; }
.tiptap-editor strong { font-weight: 700; }
.tiptap-editor em { font-style: italic; }
.tiptap-editor u { text-decoration: underline; }
.tiptap-editor a { color: var(--color-primary-600); text-decoration: underline; }
.tiptap-editor blockquote { border-left: 3px solid #d1d5db; padding-left: 1rem; color: #6b7280; }
.tiptap-editor table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; }
.tiptap-editor td, .tiptap-editor th { border: 1px solid #d1d5db; padding: 0.5rem; min-width: 1em; }
.tiptap-editor th { background-color: #f9fafb; font-weight: 600; }
.tiptap-editor .selectedCell { background-color: #dbeafe; }

.toolbar-btn {
    padding: 0.375rem;
    border-radius: 0.25rem;
    color: rgb(55 65 81);
    transition: background-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
}

.toolbar-btn:hover {
    background-color: rgb(229 231 235);
}

.toolbar-btn-active {
    background-color: rgb(209 213 219);
    color: rgb(17 24 39);
}

.tiptap-editor .ProseMirror {
    min-height: 380px;
    outline: none;
}

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


.tiptap-content p { margin-bottom: 0.75rem; }
.tiptap-content h1 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.5rem; }
.tiptap-content h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.tiptap-content h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.tiptap-content ul { list-style-type: disc; padding-left: 1.5rem; margin-bottom: 0.75rem; }
.tiptap-content ol { list-style-type: decimal; padding-left: 1.5rem; margin-bottom: 0.75rem; }
.tiptap-content li { margin-bottom: 0.25rem; }
.tiptap-content strong { font-weight: 700; }
.tiptap-content em { font-style: italic; }
.tiptap-content u { text-decoration: underline; }
.tiptap-content a { color: var(--color-primary-600); text-decoration: underline; }
.tiptap-content blockquote { border-left: 3px solid #d1d5db; padding-left: 1rem; color: #6b7280; }
.tiptap-content table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; }
.tiptap-content td, .tiptap-content th { border: 1px solid #d1d5db; padding: 0.5rem; min-width: 1em; }
.tiptap-content th { background-color: #f9fafb; font-weight: 600; }

.tiptap-image {
    max-width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: 4px;
}

.tiptap-image.ProseMirror-selectednode {
    outline: 2px solid var(--color-primary-500);
}

.tiptap-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem 0.5rem 0 0;
}
.tiptap-editor img,
.tiptap-editor video {
    cursor: pointer;
}

.tiptap-editor img.ProseMirror-selectednode,
.tiptap-editor video.ProseMirror-selectednode {
    outline: 2px solid var(--color-primary-500);
}

.tiptap-media-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 0.5rem 0;
}

.tiptap-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(220, 38, 38, 0.85);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    z-index: 10;
    line-height: 1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.tiptap-media-wrapper:hover .tiptap-delete-btn {
    display: flex;
}

.tiptap-delete-btn:hover {
    background: rgb(185, 28, 28);
}

.tiptap-resize-handle {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--color-primary-500);
    border-radius: 3px;
    cursor: se-resize;
    display: none;
    opacity: 0.8;
}

.tiptap-resize-handle::after {
    content: '';
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

.tiptap-media-wrapper:hover .tiptap-resize-handle {
    display: block;
}

.tiptap-media-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin: 0.5rem 0;
}

.tiptap-media-wrapper img,
.tiptap-media-wrapper video {
    display: block;
    width: 100%;
    height: auto;
}

.tiptap-content [data-align="left"] { text-align: left; }
.tiptap-content [data-align="center"] { text-align: center; }
.tiptap-content [data-align="right"] { text-align: right; }

.tiptap-content [data-align] img,
.tiptap-content [data-align] video {
    display: inline-block;
    max-width: 100%;
    height: auto;
}

/* Show page — video */
.tiptap-content video {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Table — align in th */
.tiptap-content th {
    text-align: left;
}

/* YouTube iframe */
.tiptap-content iframe {
    max-width: 100%;
    border-radius: 4px;
}
