/* Make TipTap editor scrollable with fixed toolbar */
.tiptap-wrapper {
    display: flex;
    flex-direction: column;
    height: 44rem;
    max-height: 44rem;
    overflow: hidden;
    position: relative;
}

.tiptap-wrapper .tiptap-toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: white;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.tiptap-wrapper .tiptap-content {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    height: 100%;
}

.tiptap-wrapper .tiptap-content .ProseMirror {
    min-height: calc(44rem - 4rem);
    padding: 1.5rem;
    overflow: visible !important;
}

/* Ensure content stays within bounds */
.tiptap-wrapper .tiptap-content .ProseMirror > * {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Fix for the editor container */
.filament-tiptap-editor {
    overflow: hidden !important;
}

/* Ensure blocks panel doesn't overflow */
.tiptap-blocks-panel {
    max-height: calc(44rem - 4rem);
    overflow-y: auto;
}

/* Dark mode support */
.dark .tiptap-scrollable .tiptap-wrapper .tiptap-toolbar {
    background-color: rgb(31, 41, 55);
    border-bottom-color: rgb(55, 65, 81);
}

/* Ensure proper scrollbar styling */
.tiptap-scrollable .tiptap-wrapper .tiptap-content::-webkit-scrollbar {
    width: 8px;
}

.tiptap-scrollable .tiptap-wrapper .tiptap-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tiptap-scrollable .tiptap-wrapper .tiptap-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.tiptap-scrollable .tiptap-wrapper .tiptap-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* TipTap Image Styles */
.tiptap-content img,
.ProseMirror img {
    max-width: 100%;
    height: auto;
}

/* Responsive image handling */
@media (max-width: 640px) {
    .tiptap-content img,
    .ProseMirror img {
        max-width: 100%;
        height: auto;
    }
}