/* =============================================================================
   RICH EDITOR — Cadre + toolbar uniquement
   =============================================================================
   Les styles du CONTENU (h1, h2, blockquote, encadré, listes, tables, etc.)
   sont définis dans event-print.css via la classe .event-content.
   ============================================================================= */


/* Wrapper */
.rich-editor {
    position: relative;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
    border-radius: 6px;
    background: #fff;
    overflow: visible;
}


/* Autocomplete @ et # ------------------------------------------------------ */

.rich-autocomplete {
    position: absolute;
    z-index: 30;
    min-width: 180px;
    max-width: 280px;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
    border-radius: 6px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.10);
    padding: 4px 0;
    font-size: 14px;
}

.rich-autocomplete[hidden] { display: none; }

.rich-autocomplete-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    color: var(--color-text, #1a1a1a);
    line-height: 1.3;
    transition: background 0.08s ease;
}

.rich-autocomplete-item:hover,
.rich-autocomplete-item.is-active {
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.rich-autocomplete-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}


/* Toolbar ------------------------------------------------------------------- */

.rich-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    background: #fafafa;
    border-bottom: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
    flex-wrap: wrap;
}

.rich-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.rich-toolbar-sep {
    width: 1px;
    height: 22px;
    background: var(--color-border, rgba(0, 0, 0, 0.12));
    margin: 0 4px;
}

.rich-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--color-text, #1a1a1a);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.10s ease, border-color 0.10s ease;
}

.rich-btn:hover { background: rgba(0, 0, 0, 0.06); }

.rich-btn.is-active {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.20);
}

.rich-btn svg { display: block; }

.rich-format-select {
    height: 30px;
    padding: 0 26px 0 10px;
    background: #fff;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
    border-radius: 5px;
    font-size: 14px;
    color: var(--color-text, #1a1a1a);
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.rich-format-select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}


/* Boutons couleur ----------------------------------------------------------- */

.rich-color-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Main button (lettre/icône + bandeau couleur) */
.rich-color-main {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    height: 30px;
    min-width: 32px;
    gap: 0;
    flex-direction: column;
    /* coller au chevron : pas de bord arrondi à droite */
    border-radius: 5px 0 0 5px;
}

.rich-color-letter {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text, #1a1a1a);
    padding: 2px 0 0;
}

.rich-color-strip {
    display: block;
    width: 18px;
    height: 3px;
    margin-top: 1px;
    background: #A32D2D;
    border-radius: 1px;
}

/* Chevron qui ouvre le popover, collé au main button */
.rich-color-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    min-width: 18px;
    padding: 0 3px;
    /* coller au main : pas de bord arrondi à gauche */
    border-radius: 0 5px 5px 0;
    margin-left: -1px;
    color: var(--color-text-muted, #6b7280);
}

.rich-color-chevron:hover {
    color: var(--color-text, #1a1a1a);
}

.rich-color-pop {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--color-border, rgba(0, 0, 0, 0.15));
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.10);
    display: grid;
    grid-template-columns: repeat(4, 24px);
    gap: 6px;
}

.rich-color-pop[hidden] { display: none; }

.rich-color-swatch {
    width: 24px;
    height: 24px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    transition: transform 0.10s ease, box-shadow 0.10s ease;
}

.rich-color-swatch:hover {
    transform: scale(1.10);
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.10);
}

/* Bordures renforcées pour les swatches très clairs (blanc, jaune pâle) */
.rich-color-swatch[style*="#FFFFFF" i],
.rich-color-swatch[style*="#FFF8B0" i] {
    border-color: rgba(0, 0, 0, 0.25);
}


/* Zone éditable (placeholder + focus uniquement) --------------------------- */

.rich-editor-area {
    padding: 14px 16px;
    outline: none;
    background: #fff;
}

.rich-editor-area:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-light, #9ca3af);
    pointer-events: none;
}


/* Pied --------------------------------------------------------------------- */

.rich-editor-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #fafafa;
    border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
    flex-wrap: wrap;
}

.rich-editor-hints {
    display: flex;
    gap: 14px;
    font-size: 14px;
    color: var(--color-text-muted, #6b7280);
    flex-wrap: wrap;
}

.rich-editor-hints strong {
    color: var(--color-text, #1a1a1a);
    font-weight: 600;
    margin-right: 3px;
}

.rich-editor-hint-paste {
    color: var(--color-text-light, #9ca3af);
    font-style: italic;
}

.rich-editor-save {
    height: 32px;
    padding: 0 18px;
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.rich-editor-save:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}
