﻿/* Styles for BUZZHub rich text editor */
.bh-rte-toolbar {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 100;
    padding: 4px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.bh-rte-editor {
    position: relative;
    border: 1px solid #ccc;
    min-height: 200px;
    padding: 4px;
    font-family: Arial, sans-serif;
    overflow-y: auto;
    max-height: 1200px;
    resize: vertical;
}

    .bh-rte-editor table {
        border-collapse: collapse;
        position: relative;
    }

    .bh-rte-editor td,
    .bh-rte-editor th {
        position: relative;
    }

.col-resizer {
    position: absolute;
    top: 0;
    right: -2px;
    width: 4px;
    cursor: col-resize;
    user-select: none;
    height: 100%;
    z-index: 1;
}

.table-resizer {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    cursor: nwse-resize;
    background: transparent;
    z-index: 2;
}

/* Allow native image drag/resize and forward pointer events */
.bh-rte-editor img {
    max-width: none !important;
    display: inline-block !important;
    position: static !important;
    pointer-events: auto !important;
    user-select: auto !important;
    touch-action: manipulation !important;
}

/* optional helper class to enable pointer interaction globally */
img.bh-pointer {
    max-width: none !important;
    display: inline-block !important;
    position: static !important;
    pointer-events: auto !important;
    user-select: auto !important;
    touch-action: manipulation !important;
}

    /* override global pseudo elements that block mouse events */
    .bh-rte-editor img::before,
    .bh-rte-editor img::after,
    img.bh-pointer::before,
    img.bh-pointer::after {
        display: none !important;
        content: none !important;
        pointer-events: none !important;
    }

.bh-rte-editor img.selected {
    outline: 2px dashed #3b99fc;
    cursor: nwse-resize;
}

.bh-rte-editor img:focus:not(.selected) {
    outline: none !important;
}

.bh-rte-editor ol,
.bh-rte-editor ul {
    padding-left: 3em;
    list-style-position: outside;
}

.bh-rte-editor li {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

    .bh-rte-editor li::marker {
        font-family: inherit;
        font-size: inherit;
        color: inherit;
    }


.bh-rte-editor table {
    border-collapse: collapse;
    width: 100%;
}

    .bh-rte-editor table td,
    .bh-rte-editor table th {
        border: 1px solid #ccc;
        padding: 4px;
    }

.bh-rte-editor table {
    width: auto !important;
    table-layout: fixed; /* so your pixel widths stick */
}

.bh-rte-overlay {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none; /* toggled by JS: overlay.style.display = 'flex' */
    pointer-events: none; /* or auto if you want to block interactions while loading */
    background: rgba(255,255,255,0.6);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
    .bh-rte-overlay.show {
        display: flex; 
        pointer-events: auto;
    }

    .bh-rte-overlay .spinner-border {
        position: static !important;
    }

/* outer wrapper */
.bh-rte-container {
    position: relative;
    border: 1px solid #fdb913;
    border-radius: 4px;
    margin-top: 5px;
    padding-left: 2px;
    margin-bottom: 5px;
    overflow: hidden; 
}

    /* split the border between toolbar & editor */
    .bh-rte-container .bh-rte-toolbar {
        border-bottom: 1px solid #fdb913;
    }


.word-count {
    font-size: .875rem;
    color: #666;
    user-select: none;
}

/* editor already has padding, so just remove its own border */
.bh-rte-editor {
    border: none;
    min-height: 200px;
    font-family: Arial, sans-serif;
    resize: vertical;
    border: none;
    min-height: 200px;
    resize: vertical;
    padding: 0 0.75rem 0.375rem;
    transition: padding-top 0.15s;
}
.bh-rte-toolbar.show + .bh-rte-editor {
    padding-top: calc( var(--toolbar-height) + 4px );
}
    .bh-rte-editor.form-control {
        padding: 0 .75rem .375rem;
    }

/* hide toolbar until active */
.bh-rte-container {
    border: 1px solid #fdb913;
    border-radius: 4px;
    overflow: hidden;
}

.bh-rte-toolbar {
    position:absolute !important;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s, visibility 0.15s;
}


    .bh-rte-toolbar.show {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
        width: 100%;
        padding-right: 5px;
    }

    .bh-rte-toolbar button.active {
        background-color: #f0f0f0;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
    }

        .bh-rte-toolbar button.active i {
            color: #007bff; 
        }

        /* Example: hover/active combined */
        .bh-rte-toolbar button.active:hover {
            background-color: #d0d0d0;
        }

#tableGrid .cell {
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    background: #f8f8f8;
}

    #tableGrid .cell.hovered {
        background-color: #007bff;
    }



    .bh-rte-toolbar .bh-table-dropdown #tableGrid .cell {
        width: 20px;
        height: 20px;
        background: #f9f9f9;
        border: 1px solid #ccc;
        cursor: pointer;
    }


/* 1. Make the dropdown wrapper position itself as the origin */
.bh-rte-toolbar .bh-table-dropdown {
    position: relative;
}

        .bh-rte-toolbar .bh-table-dropdown #tableGrid .cell.hovered {
            background: #007bff;
        }



    /* 2. Hide the entire panel by default, and absolutely position it */
    .bh-rte-toolbar .bh-table-dropdown .bh-table-panel {
        display: none;
        position: absolute;
        top: calc(100% + 4px);
        right: 0;
        background: #fff;
        border: 1px solid #ccc;
        padding: 8px;
        z-index: 2000;
        box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    }

    /* 3. When its parent has “open”, show the panel */
    .bh-rte-toolbar .bh-table-dropdown.open .bh-table-panel {
        display: block;
    }

    /* 4. Tidy the button row under the grid */
    .bh-rte-toolbar .bh-table-dropdown #bh-table-controls {
        margin-top: 8px;
        display: flex;
        gap: 4px;
    }

.bh-rte-editor.form-control {
    border: none;
    color: black;
}
.bh-rte-editor.form-control {
    /* default height */
    min-height: 300px;
}

/* Override by wrapper size */
.richtextwrapper-xs .bh-rte-editor.form-control {
    min-height: 150px;
}

.richtextwrapper-sm .bh-rte-editor.form-control {
    min-height: 200px;
}

.RadMultiLine .bh-rte-editor.form-control {
    min-height: 200px;
}
.richtextwrapper-lg .bh-rte-editor.form-control {
    min-height: 700px;
}

.RTEHeading .bh-rte-editor.form-control {
    min-height: 75px;
    font-weight: 900;
    font-size: 25px !important;
}

/* Always override for screens under 990px */
@media (max-width: 990px) {
    .bh-rte-editor.form-control {
        min-height: 400px !important;
    }
}