/* Éditeur WYSIWYG « maison » (assets/js/rich-text.js).
   Harmonisé avec les champs .form-control de l'app (clair uniquement) : même fond blanc,
   même bordure #ced4da, même rayon var(--radius), même focus. Pas de dark auto (OS) :
   les formulaires de l'app ne réagissent pas à prefers-color-scheme, l'éditeur non plus. */
.rich-text {
    --rt-border: #ced4da;          /* = bordure .form-control */
    --rt-toolbar-bg: #f8f9fa;      /* gris très léger (en-têtes/inputs group) */
    --rt-btn-color: #495057;
    --rt-btn-hover-bg: #e9ecef;
    --rt-editor-bg: #ffffff;       /* = fond .form-control */
    --rt-editor-color: #212529;    /* = texte .form-control */
    --rt-placeholder: #6c757d;     /* = placeholder .form-control */

    display: block;
    border: 1px solid var(--rt-border);
    border-radius: var(--radius, 0.375rem);
    overflow: hidden;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

/* Focus aligné sur .form-control:focus de l'app. */
.rich-text:focus-within {
    border-color: var(--color-primary, #86b7fe);
    box-shadow: 0 0 0 .25rem var(--shadow-color, rgba(0, 0, 0, 0.05));
}

.rich-text-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem;
    padding: 0.25rem 0.375rem;
    background: var(--rt-toolbar-bg);
    border-bottom: 1px solid var(--rt-border);
}

.rich-text-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9rem;
    height: 1.9rem;
    padding: 0 0.4rem;
    border: 0;
    border-radius: 0.25rem;
    background: transparent;
    color: var(--rt-btn-color);
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
}

.rich-text-btn:hover {
    background: var(--rt-btn-hover-bg);
}

/* La pastille couleur héberge un <input type=color> invisible superposé. */
.rich-text-color {
    position: relative;
    overflow: hidden;
}

.rich-text-color input[type="color"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    border: 0;
    padding: 0;
}

.rich-text-select {
    width: auto;
    min-width: 5.5rem;
    height: 1.9rem;
    padding: 0 1.4rem 0 0.4rem;
    font-size: 0.8rem;
}

.rich-text-sep {
    width: 1px;
    align-self: stretch;
    margin: 0.15rem 0.25rem;
    background: var(--rt-border);
}

.rich-text-editor {
    min-height: 6.5rem;
    max-height: 30rem;
    overflow-y: auto;
    padding: 0.75rem 1rem;                        /* ~ .form-control */
    background: var(--rt-editor-bg);
    color: var(--rt-editor-color);
    font-family: var(--font-text-family, inherit);
    font-size: 1rem;
    line-height: 1.4;
    border: 0;
    border-radius: 0;
}

.rich-text-editor:focus {
    outline: none;
    box-shadow: none;
}

/* Placeholder quand l'éditeur est vide. */
.rich-text-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--rt-placeholder);
    pointer-events: none;
}

/* Le textarea source reste dans le DOM (soumission du formulaire) mais masqué. */
.rich-text-source {
    display: none !important;
}

