/*
 * Rich text component, shared by the client file, the quote window, the customer
 * space and the management space. The rules lived in the manager calendar sheet
 * while one window used them; the customer space cannot load that sheet, so they
 * moved here whole rather than being written a second time.
 *
 * Every colour a professional can apply is a class of this file. Nothing is stored
 * as a literal colour, which is what keeps a note readable once the reader switches
 * to the dark theme and what lets the server turn the same class into an inline
 * colour for a mail.
 */

.oubkw-rte-wrap {
    border: 1.5px solid var(--oubkw-border, #e8ddd6);
    border-radius: var(--oubkw-radius-md, 8px);
    overflow: visible;
    background: var(--oubkw-surface-1, #FFFFFF);
    transition: border-color .15s;
}

.oubkw-rte-wrap:focus-within {
    border-color: var(--oubkw-primary-ui, #C4705A);
    box-shadow: 0 0 0 3px rgba(var(--oubkw-primary-ui-rgb, 196,112,90),.12);
}

.oubkw-rte-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
    padding: 5px 8px;
    background: var(--oubkw-surface-2, #FAF8F5);
    border-bottom: 1px solid var(--oubkw-border, #e8ddd6);
    border-radius: var(--oubkw-radius-md, 8px) var(--oubkw-radius-md, 8px) 0 0;
}

.oubkw-rte-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    padding: 3px 8px;
    font-size: 13px;
    color: var(--oubkw-text, #2C1F14);
    line-height: 1.4;
    transition: background .12s, border-color .12s;
    min-width: 28px;
    text-align: center;
}

.oubkw-rte-btn:hover,
.oubkw-rte-btn:focus-visible {
    background: var(--oubkw-surface-1, #FFFFFF);
    border-color: var(--oubkw-border, #e8ddd6);
}

.oubkw-rte-btn.is-active {
    background: var(--oubkw-primary, #C4705A);
    color: var(--oubkw-on-primary, #1a0a00);
    border-color: transparent;
}

.oubkw-rte-menu-host {
    position: relative;
    display: inline-flex;
}

.oubkw-rte-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    min-width: 168px;
    padding: 4px;
    background: var(--oubkw-surface-1, #FFFFFF);
    border: 1px solid var(--oubkw-border, #e8ddd6);
    border-radius: var(--oubkw-radius-md, 8px);
    box-shadow: 0 6px 18px rgba(var(--oubkw-text-rgb, 44,31,20),.14);
}

.oubkw-rte-swatch {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 5px 8px;
    background: none;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12.5px;
    color: var(--oubkw-text, #2C1F14);
    text-align: left;
}

.oubkw-rte-swatch:hover,
.oubkw-rte-swatch:focus-visible {
    background: var(--oubkw-surface-2, #FAF8F5);
}

.oubkw-rte-swatch-none {
    border-top: 1px solid var(--oubkw-border, #e8ddd6);
    margin-top: 4px;
    padding-top: 7px;
    color: var(--oubkw-text-muted, #8C7B6B);
}

.oubkw-rte-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid var(--oubkw-border, #e8ddd6);
    font-weight: 700;
    font-size: 12px;
}

.oubkw-rte-body {
    border-radius: 0 0 var(--oubkw-radius-md, 8px) var(--oubkw-radius-md, 8px);
    min-height: 90px;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.55;
    color: var(--oubkw-text, #2C1F14);
    outline: none;
    word-break: break-word;
}

.oubkw-rte-body:empty::before {
    content: attr(data-placeholder);
    color: var(--oubkw-text-muted, #8C7B6B);
    pointer-events: none;
}

.oubkw-rte-body p    { margin: 0 0 6px; }
.oubkw-rte-body ul   { margin: 4px 0; padding-left: 20px; }
.oubkw-rte-body ol   { margin: 4px 0; padding-left: 22px; }
.oubkw-rte-body li   { margin-bottom: 2px; }
.oubkw-rte-body strong,
.oubkw-rte-body b     { font-weight: 700; }
.oubkw-rte-body em,
.oubkw-rte-body i     { font-style: italic; }
.oubkw-rte-body hr {
    border: 0;
    border-top: 1px solid var(--oubkw-border, #e8ddd6);
    margin: 8px 0;
}

/*
 * The textarea stays in the document and stays the value the form reads. It is
 * taken out of the layout and out of the reading order, never out of the form.
 */
.oubkw-rte-source {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/*
 * The four tones and the two highlights, everywhere the text is READ as well as
 * where it is written: the client file, the customer space and the quote page all
 * print the same classes.
 */
.oubkw-rt-c-alert { color: var(--oubkw-error, #B91C1C); }
.oubkw-rt-c-warn  { color: var(--oubkw-warning, #974608); }
.oubkw-rt-c-ok    { color: var(--oubkw-success, #116630); }
.oubkw-rt-c-soft  { color: var(--oubkw-text-muted, #8C7B6B); }

.oubkw-rt-h-warn {
    background: var(--oubkw-warning-bg, #F8EEE6);
    color: var(--oubkw-warning, #974608);
    padding: 0 2px;
    border-radius: 3px;
}

.oubkw-rt-h-ok {
    background: var(--oubkw-success-bg, #E8F2EC);
    color: var(--oubkw-success, #116630);
    padding: 0 2px;
    border-radius: 3px;
}

/* A stored value is printed in these blocks, so they carry the same rhythm. */
.oubkw-rich-text p  { margin: 0 0 6px; }
.oubkw-rich-text ul { margin: 4px 0; padding-left: 20px; }
.oubkw-rich-text ol { margin: 4px 0; padding-left: 22px; }
.oubkw-rich-text li { margin-bottom: 2px; }
.oubkw-rich-text hr {
    border: 0;
    border-top: 1px solid var(--oubkw-border, #e8ddd6);
    margin: 8px 0;
}
.oubkw-rich-text > :last-child { margin-bottom: 0; }

