/* mud-rte.css - Tiptap Rich Text Editor Styles */

/* Editor container */
.mud-rte-container {
    position: relative;
}

/* Tiptap editor area */
.tiptap-editor {
    border: 1px solid rgba(0, 0, 0, 0.23);
    border-radius: 4px;
    padding: 12px;
    overflow-y: auto;
    background: #fff;
}

.tiptap-editor:focus-within {
    border-color: var(--mud-palette-primary, #1976d2);
    outline: none;
    box-shadow: 0 0 0 1px var(--mud-palette-primary, #1976d2);
}

/* ProseMirror editor content */
.tiptap-editor .ProseMirror {
    outline: none;
    min-height: 100px;
}

.tiptap-editor .ProseMirror p {
    margin: 0 0 0.5rem 0;
}

.tiptap-editor .ProseMirror p:last-child {
    margin-bottom: 0;
}

.tiptap-editor .ProseMirror ul,
.tiptap-editor .ProseMirror ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.tiptap-editor .ProseMirror a {
    color: var(--mud-palette-primary, #1976d2);
    text-decoration: underline;
}

/* Table styles in editor */
.tiptap-editor .ProseMirror table,
.tiptap-table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.5rem 0;
    table-layout: fixed;
}

.tiptap-editor .ProseMirror td,
.tiptap-editor .ProseMirror th {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    min-width: 50px;
    vertical-align: top;
    position: relative;
}

.tiptap-editor .ProseMirror th {
    background-color: rgba(0, 0, 0, 0.04);
    font-weight: 600;
}

.tiptap-editor .ProseMirror td > *,
.tiptap-editor .ProseMirror th > * {
    margin: 0;
}

/* Selected cell */
.tiptap-editor .ProseMirror .selectedCell {
    background-color: rgba(25, 118, 210, 0.1);
}

/* Toolbar styles */
.tiptap-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    align-items: center;
}

.tiptap-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.7);
    transition: all 0.15s ease;
}

.tiptap-toolbar-btn:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.2);
}

.tiptap-toolbar-btn:active {
    background: rgba(0, 0, 0, 0.08);
}

.tiptap-toolbar-btn.active {
    background: var(--mud-palette-primary, #1976d2);
    color: #fff;
    border-color: var(--mud-palette-primary, #1976d2);
}

.tiptap-toolbar-separator {
    width: 1px;
    height: 24px;
    background: rgba(0, 0, 0, 0.12);
    margin: 0 4px;
}

/* ReadOnly mode styles (reused from original) */
.rte-readonly table {
    border-collapse: collapse;
    width: 100%;
}

.rte-readonly td,
.rte-readonly th {
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 6px;
}

.rte-readonly p {
    margin: 0 0 0.5rem 0;
}

/* Placeholder for empty editor */
.tiptap-editor .ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    color: rgba(0, 0, 0, 0.38);
    pointer-events: none;
    height: 0;
}

/* Dark mode support (if using MudBlazor dark theme) */
.mud-theme-dark .tiptap-editor {
    background: #1e1e1e;
    border-color: rgba(255, 255, 255, 0.23);
    color: #fff;
}

.mud-theme-dark .tiptap-editor:focus-within {
    border-color: var(--mud-palette-primary, #90caf9);
    box-shadow: 0 0 0 1px var(--mud-palette-primary, #90caf9);
}

.mud-theme-dark .tiptap-toolbar {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.12);
}

.mud-theme-dark .tiptap-toolbar-btn {
    background: #2d2d2d;
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
}

.mud-theme-dark .tiptap-toolbar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.mud-theme-dark .tiptap-toolbar-separator {
    background: rgba(255, 255, 255, 0.12);
}

.mud-theme-dark .tiptap-editor .ProseMirror td,
.mud-theme-dark .tiptap-editor .ProseMirror th {
    border-color: rgba(255, 255, 255, 0.2);
}

.mud-theme-dark .tiptap-editor .ProseMirror th {
    background-color: rgba(255, 255, 255, 0.04);
}

.mud-theme-dark .rte-readonly td,
.mud-theme-dark .rte-readonly th {
    border-color: rgba(255, 255, 255, 0.2);
}
