/* ============================================================================
   EDITOR DE TEXTO DAS TAREFAS - ver app/js/mcx-editor.js
   Mesmo acabamento do editor dos lembretes (inicio.php).
   ========================================================================= */

.mcx-ed {
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #fff;
    overflow: visible;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, .03);
    transition: border-color .15s, box-shadow .15s;
}

.mcx-ed:focus-within {
    border-color: var(--cfg-info, #17a2b8);
    box-shadow: 0 0 0 3px rgba(23, 162, 184, .12);
}

.mcx-ed-barra {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 9px 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    border-bottom: 1px solid #e4e7ec;
    border-radius: 14px 14px 0 0;
}

.mcx-ed-grupo {
    display: inline-flex;
    gap: 4px;
}

.mcx-ed-sep {
    width: 1px;
    height: 22px;
    background: #d9e0ea;
    margin: 0 2px;
}

.mcx-ed-btn {
    position: relative;
    width: 32px;
    height: 32px;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    background: #fff;
    color: #344054;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s ease;
}

.mcx-ed-btn:hover,
.mcx-ed-btn:focus {
    border-color: var(--cfg-info, #17a2b8);
    color: var(--cfg-info, #17a2b8);
    outline: none;
}

.mcx-ed-btn.ativo {
    border-color: var(--cfg-info, #17a2b8);
    background: linear-gradient(180deg, var(--cfg-info, #17a2b8) 0%, #1492a7 100%);
    color: #fff;
    box-shadow: 0 6px 14px rgba(23, 162, 184, .25);
}

/* Faixa de cor embaixo do ícone do marcador / cor da letra (última usada). */
.mcx-ed-barra-cor {
    position: absolute;
    left: 7px;
    right: 7px;
    bottom: 4px;
    height: 3px;
    border-radius: 2px;
    background: #fff3a3;
}

/* Botão de cor em duas partes: [ícone liga/desliga][▾ escolhe a cor]. */
.mcx-ed-grupo-pop {
    position: relative;
    display: inline-flex;
}

.mcx-ed-grupo-pop .mcx-ed-btn-cor {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.mcx-ed-seta {
    width: 18px;
    margin-left: -1px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-size: 11px;
    color: #667085;
}

/* A faixa de cor continua visível com o botão ligado (fundo azul). */
.mcx-ed-btn.ativo .mcx-ed-barra-cor {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .85);
}

.mcx-ed-pop {
    display: none;
    position: absolute;
    top: 38px;
    left: 0;
    z-index: 30;
    gap: 6px;
    padding: 8px;
    border: 1px solid #e3e9f1;
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(18, 43, 93, .16);
    white-space: nowrap;
}

.mcx-ed-pop.aberto {
    display: flex;
}

.mcx-ed-cor {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #d0d5dd;
    background: var(--cor);
    cursor: pointer;
    padding: 0;
}

.mcx-ed-cor:hover {
    box-shadow: 0 0 0 2px var(--cfg-info, #17a2b8);
}

/* ── Área de texto ──────────────────────────────────────────────────────── */
.mcx-ed-area {
    position: relative;
    /* Altura inicial (a opção "altura" troca); o puxador do canto inferior
       direito aumenta ou diminui, como num <textarea>. */
    height: 200px;
    min-height: 110px;
    resize: vertical;
    overflow-y: auto;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.65;
    color: #1f2937;
    word-break: break-word;
}

.mcx-ed-area:focus {
    outline: none;
}

.mcx-ed.vazio .mcx-ed-area::before {
    content: attr(data-placeholder);
    color: #98a2b3;
    pointer-events: none;
    position: absolute;
}

.mcx-ed-area p,
.mcx-ed-area ul,
.mcx-ed-area ol,
.mcx-ed-area blockquote {
    margin: 0 0 .5em;
}

.mcx-ed-area ul,
.mcx-ed-area ol {
    padding-left: 1.4em;
}

.mcx-ed-area blockquote {
    padding: 6px 12px;
    border-left: 4px solid #c9d4e2;
    background: #f6f8fb;
    color: #4a5a70;
    border-radius: 0 8px 8px 0;
}

.mcx-ed-area a {
    color: #1c5aa8;
    text-decoration: underline;
}

.mcx-ed-area mark {
    background: #fff3a3;
    padding: 0 2px;
    border-radius: 3px;
}

/* ── Ortografia ─────────────────────────────────────────────────────────── */

/* Sublinhado ondulado das palavras com erro. Desenhado pelo navegador por
   cima do texto (CSS Custom Highlight API) - não entra no HTML salvo. */
::highlight(mcx-orto) {
    text-decoration: underline wavy #e5484d;
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
    background-color: rgba(229, 72, 77, .07);
}

/* Balão de sugestões, abaixo da palavra clicada. */
.mcx-ed {
    position: relative;
}

.mcx-ed-orto {
    display: none;
    position: absolute;
    z-index: 40;
    width: 270px;
    padding: 12px;
    border: 1px solid #e3e9f1;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(18, 43, 93, .18);
    animation: mcxOrtoEntra .14s ease-out;
}

.mcx-ed-orto.aberto {
    display: block;
}

@keyframes mcxOrtoEntra {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.mcx-ed-orto-topo {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: #c0392b;
}

.mcx-ed-orto-palavra {
    margin: 4px 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    text-decoration: underline wavy #e5484d;
    text-underline-offset: 3px;
}

.mcx-ed-orto-rotulo {
    font-size: 11.5px;
    color: #7b8aa0;
    margin-bottom: 6px;
}

.mcx-ed-orto-sugs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.mcx-ed-orto-sug {
    padding: 5px 11px;
    border: 1px solid #bfe3d0;
    border-radius: 8px;
    background: #f1faf5;
    color: #1c7c55;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .12s ease;
}

.mcx-ed-orto-sug:first-child {
    background: #1c7c55;
    border-color: #1c7c55;
    color: #fff;
}

.mcx-ed-orto-sug:hover {
    background: #2fa76f;
    border-color: #2fa76f;
    color: #fff;
}

.mcx-ed-orto-acoes {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px solid #f0f3f8;
}

.mcx-ed-orto-acoes button {
    flex: 1;
    padding: 5px 8px;
    border: 1px solid #e3e9f1;
    border-radius: 8px;
    background: #fff;
    color: #5f6e84;
    font-size: 11.5px;
    cursor: pointer;
}

.mcx-ed-orto-acoes button:hover {
    border-color: #c9d4e2;
    color: #1f2d45;
}

/* ── Rodapé: situação da verificação + atalhos para as palavras ─────────── */
.mcx-ed-rodape {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    min-height: 32px;
    padding: 5px 14px;
    border-top: 1px solid #f0f3f8;
    font-size: 11.5px;
    color: #98a2b3;
}

.mcx-ed-status i {
    margin-right: 3px;
}

.mcx-ed-status.ok {
    color: #1c7c55;
}

.mcx-ed-status.alerta {
    color: #c0392b;
    font-weight: 600;
}

.mcx-ed-status-dica {
    font-weight: 400;
    color: #98a2b3;
}

.mcx-ed-lista {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.mcx-ed-lista button {
    padding: 2px 9px;
    border: 1px solid #f3c7c9;
    border-radius: 7px;
    background: #fff5f5;
    color: #c0392b;
    font-size: 11.5px;
    cursor: pointer;
    text-decoration: underline wavy #e5484d;
    text-underline-offset: 3px;
}

.mcx-ed-lista button:hover {
    background: #fdecee;
}

@media (max-width: 575px) {
    .mcx-ed-status-dica {
        display: none;
    }
}

/* Somente leitura (setReadOnly): barra apagada, texto sem cursor. */
.mcx-ed.somente-leitura .mcx-ed-barra {
    opacity: .45;
    pointer-events: none;
}

.mcx-ed.somente-leitura .mcx-ed-area {
    background: #f8fafc;
    color: #667085;
    cursor: default;
}

/* Contador de caracteres (opção "limite", ex.: lembretes). */
.mcx-ed-contador {
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 7px;
    background: #f2f6fb;
    color: #667085;
    font-size: 11px;
    font-weight: 600;
}

.mcx-ed-contador.estourou {
    background: #fdecee;
    color: #c0392b;
}

/* ── Exibir o texto salvo pelo editor com a mesma cara de quando foi
   digitado (lista de observações padrão do E-doc, mensagens...).
   Uso: <div class="mcx-ed-html"> ...HTML salvo... </div> ─────────────────── */
.mcx-ed-html {
    font-size: 14px;
    line-height: 1.65;
    color: #1f2937;
    word-break: break-word;
}

.mcx-ed-html p,
.mcx-ed-html ul,
.mcx-ed-html ol,
.mcx-ed-html blockquote {
    margin: 0 0 .5em;
}

.mcx-ed-html> :last-child {
    margin-bottom: 0;
}

.mcx-ed-html ul,
.mcx-ed-html ol {
    padding-left: 1.4em;
}

.mcx-ed-html blockquote {
    padding: 6px 12px;
    border-left: 4px solid #c9d4e2;
    background: #f6f8fb;
    color: #4a5a70;
    border-radius: 0 8px 8px 0;
}

.mcx-ed-html a {
    color: #1c5aa8;
    text-decoration: underline;
}

.mcx-ed-html mark {
    background: #fff3a3;
    padding: 0 2px;
    border-radius: 3px;
}

/* ── Imagens dentro do texto (opção "imagens") ──────────────────────────── */

/* A imagem é SEMPRE um bloco na linha dela: o texto fica acima ou abaixo,
   nunca ao lado. Miniatura limitada (o print não ocupa a tela inteira);
   duplo clique no editor ou clique no texto exibido abre em tamanho real. */
.mcx-ed-area img,
.mcx-ed-html img,
.mcx-ed-midia img {
    display: block;
    max-width: min(100%, 560px);
    max-height: 340px;
    height: auto;
    margin: 10px 0;
    padding: 4px;
    background: #fff;
    border: 1px solid #e3e9f1;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(18, 43, 93, .10);
}

.mcx-ed-html img,
.mcx-ed-midia img {
    cursor: zoom-in;
    transition: box-shadow .15s ease, transform .15s ease;
}

.mcx-ed-html img:hover,
.mcx-ed-midia img:hover {
    box-shadow: 0 10px 24px rgba(18, 43, 93, .18);
    transform: translateY(-1px);
}

.mcx-ed-area img {
    cursor: default;
}

.mcx-ed-area img.mcx-ed-img-foco {
    border-color: var(--cfg-info, #17a2b8);
    box-shadow: 0 0 0 3px rgba(23, 162, 184, .18);
}

/* Lixeira no canto superior direito da imagem (aparece ao passar o mouse). */
.mcx-ed-img-del {
    display: none;
    position: absolute;
    z-index: 35;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(220, 53, 69, .4);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.mcx-ed-img-del.visivel {
    display: inline-flex;
}

.mcx-ed-img-del:hover {
    background: #b52a37;
    transform: scale(1.06);
}

/* Arrastando imagem para dentro do editor. */
.mcx-ed.soltando .mcx-ed-area {
    background: #eef8fa;
    box-shadow: inset 0 0 0 2px var(--cfg-info, #17a2b8);
}

/* Imagem ampliada. */
.mcx-ed-zoom {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: rgba(15, 23, 42, .82);
    cursor: zoom-out;
    animation: mcxOrtoEntra .15s ease-out;
}

.mcx-ed-zoom img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    background: #fff;
}

.mcx-ed-zoom-fechar {
    position: absolute;
    top: 16px;
    right: 22px;
    border: 0;
    background: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
}
