/* GerirEditor — estilos (aspeto próximo do tema moono-lisa, escrito de raiz) */

/* #region Variáveis / tema */
.ge-editor,
.ge-ui {
    --ge-border: #d1d1d1;
    --ge-toolbar-bg: #f8f8f8;
    --ge-hover: #e5e5e5;
    --ge-on-bg: #ffffff;
    --ge-on-border: #bcbcbc;
    --ge-icon: #333333;
    --ge-sep: #bcbcbc;
    --ge-content-bg: #ffffff;
    --ge-text: #000000;
    --ge-panel-bg: #ffffff;
    --ge-muted: #777777;
    --ge-focus: #139ff7;
    --ge-selected: #e3f2fd;
    --ge-ok-bg: #09863e;
    --ge-ok-hover: #0a7a39;
    --ge-mention: #246ea4;
    --ge-table-border: #a0a0a0;
    --ge-table-guide: #d3d3d3;
    --ge-shadow: 0 1px 6px rgba(0, 0, 0, .25);
    --ge-ui-font: 12px/1.4 Oxygen, 'segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* tema escuro: forçado (classe ge-dark) ou a seguir o GERIR (classe "dark" no <body>, posta pelo MudarCssBodyConfUser) */
.ge-editor.ge-dark,
.ge-ui.ge-dark,
body.dark .ge-editor,
body.dark .ge-ui {
    --ge-border: #4a4a4a;
    --ge-toolbar-bg: #2d2d2d;
    --ge-hover: #3d3d3d;
    --ge-on-bg: #1e1e1e;
    --ge-on-border: #5a5a5a;
    --ge-icon: #e0e0e0;
    --ge-sep: #555555;
    --ge-content-bg: #1e1e1e;
    --ge-text: #ffffff;
    --ge-panel-bg: #2d2d2d;
    --ge-muted: #9a9a9a;
    --ge-selected: #094771;
    --ge-mention: #6cb4ee;
    --ge-table-border: #777777;
    --ge-table-guide: #4a4a4a;
    --ge-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}

.ge-editor *, .ge-editor *::before, .ge-editor *::after,
.ge-ui *, .ge-ui *::before, .ge-ui *::after {
    box-sizing: border-box;
}

.ge-editor [hidden],
.ge-ui[hidden],
.ge-ui [hidden] {
    display: none !important;
}
/* #endregion */

/* #region Estrutura */
.ge-editor {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--ge-border);
    background: var(--ge-content-bg);
    color: var(--ge-icon);
    font: var(--ge-ui-font);
    text-align: left;
    box-sizing: border-box;
}

.ge-scroll {
    flex: 1 1 auto;
    overflow: auto;
    background: var(--ge-content-bg);
    cursor: text;
}

.ge-readonly .ge-scroll {
    cursor: default;
}
/* #endregion */

/* #region Barra de ferramentas */
.ge-toolbar {
    display: flex;
    flex-direction: column;
    padding: 6px 8px 2px;
    background: var(--ge-toolbar-bg);
    border-bottom: 1px solid var(--ge-border);
    user-select: none;
    -webkit-user-select: none;
}

.ge-tb-bottom .ge-toolbar {
    border-bottom: 0;
    border-top: 1px solid var(--ge-border);
}

.ge-tbrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.ge-group {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    margin: 0 6px 4px 0;
}

.ge-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    margin: 0 4px;
    background: var(--ge-sep);
}

.ge-btn,
.ge-combo {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 28px;
    margin: 0;
    border: 1px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--ge-icon);
    font: inherit;
    line-height: 1;
    cursor: default;
    outline: none;
}

.ge-btn {
    justify-content: center;
    min-width: 28px;
    padding: 5px 6px;
}

.ge-btn svg,
.ge-btn img {
    display: block;
    flex: none;
    width: 16px;
    height: 16px;
}

.ge-btn-text {
    padding: 0 8px;
}

.ge-combo {
    justify-content: space-between;
    min-width: 64px;
    padding: 0 6px 0 8px;
}

.ge-combo-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ge-btn:hover:not(.ge-disabled),
.ge-combo:hover:not(.ge-disabled) {
    background: var(--ge-hover);
}

.ge-btn:focus-visible,
.ge-combo:focus-visible {
    border-color: var(--ge-focus);
}

.ge-btn.ge-on,
.ge-btn.ge-open,
.ge-combo.ge-open {
    background: var(--ge-on-bg);
    border-color: var(--ge-on-border);
}

.ge-disabled {
    opacity: .3;
}

.ge-arrow {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 4px;
    border-left: 3px solid transparent;
    border-right: 3px solid transparent;
    border-top: 3px solid currentColor;
}

.ge-busy > * {
    visibility: hidden;
}

.ge-busy::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border: 2px solid var(--ge-sep);
    border-top-color: var(--ge-focus);
    border-radius: 50%;
    animation: ge-spin .7s linear infinite;
}

@keyframes ge-spin {
    to { transform: rotate(360deg); }
}
/* #endregion */

/* #region Conteúdo
   O CKEditor usava um iframe e ficava isolado do CSS da página.
   Aqui o conteúdo vive na página, por isso repõem-se os estilos base dos elementos
   (o Bootstrap, por exemplo, muda margens de <p> e bordas de tabelas). */
.ge-content {
    position: relative;
    margin: 0;
    padding: 5px;
    outline: none;
    color: var(--ge-text);
    line-height: normal;
    overflow-wrap: break-word;
    word-wrap: break-word;
    text-align: left;
}

.ge-content p, .ge-content h1, .ge-content h2, .ge-content h3, .ge-content h4, .ge-content h5,
.ge-content h6, .ge-content blockquote, .ge-content pre, .ge-content ul, .ge-content ol,
.ge-content li, .ge-content dl, .ge-content dt, .ge-content dd, .ge-content hr, .ge-content a,
.ge-content caption {
    all: revert;
}

/* igual ao contentsCss que o projeto definia: ol,ul,dl { margin: 0px; padding: 0px 20px; } */
.ge-content ul,
.ge-content ol,
.ge-content dl {
    margin: 0;
    padding: 0 20px;
}

/* linha simples também nas tabelas antigas (o CKEditor gravava cellspacing="1", que dá linha dupla) */
.ge-content table {
    border-collapse: collapse;
    caption-side: top;
}

.ge-content td,
.ge-content th {
    padding: 1px;
}

.ge-content table[border]:not([border="0"]) {
    border: 1px solid var(--ge-table-border);
}

.ge-content table[border]:not([border="0"]) :is(td, th) {
    border: 1px solid var(--ge-table-border);
}

/* guias tracejadas para tabelas sem borda (só no editor, não vão para o HTML) */
.ge-content table:not([border]) :is(td, th),
.ge-content table[border="0"] :is(td, th) {
    border: 1px dotted var(--ge-table-guide);
}

.ge-content img {
    max-width: 100%;
}

.ge-content .ge-mention {
    color: var(--ge-mention);
}

.ge-content.ge-empty::before {
    content: attr(data-placeholder);
    position: absolute;
    color: var(--ge-muted);
    pointer-events: none;
}
/* #endregion */

/* #region Aviso */
.ge-notify {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 6px 10px;
    border: 1px solid var(--ge-border);
    background: var(--ge-panel-bg);
    color: var(--ge-icon);
    box-shadow: var(--ge-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    z-index: 2;
}

.ge-notify.ge-show {
    opacity: 1;
}
/* #endregion */

/* #region Painéis (tamanho, cores, emoji, menu de contexto) */
.ge-ui {
    color: var(--ge-icon);
    font: var(--ge-ui-font);
}

.ge-panel {
    position: fixed;
    z-index: 10010;
    min-width: 40px;
    padding: 4px;
    background: var(--ge-panel-bg);
    border: 1px solid var(--ge-border);
    box-shadow: var(--ge-shadow);
}

.ge-list {
    display: flex;
    flex-direction: column;
    min-width: 90px;
    max-height: 300px;
    overflow-y: auto;
    padding: 2px 0;
}

.ge-listitem,
.ge-menuitem {
    display: block;
    width: 100%;
    border: 0;
    background: none;
    color: var(--ge-text);
    text-align: left;
    cursor: default;
    outline: none;
}

.ge-listitem {
    padding: 2px 10px;
    font-family: inherit;
    line-height: 1.2;
}

.ge-menu {
    min-width: 190px;
    padding: 2px 0;
}

.ge-menuitem {
    padding: 6px 12px;
    font: inherit;
}

.ge-listitem:hover, .ge-listitem:focus-visible,
.ge-menuitem:hover, .ge-menuitem:focus-visible {
    background: var(--ge-hover);
}

.ge-listitem.ge-on {
    background: var(--ge-on-bg);
    box-shadow: inset 0 0 0 1px var(--ge-on-border);
}

.ge-menusep {
    height: 1px;
    margin: 2px 0;
    background: var(--ge-border);
}

.ge-color-auto,
.ge-color-more {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 4px 6px;
    border: 1px solid transparent;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: default;
}

.ge-color-more {
    justify-content: center;
}

.ge-color-auto:hover,
.ge-color-more:hover {
    background: var(--ge-hover);
}

.ge-swatch-auto {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 1px solid var(--ge-on-border);
    background: linear-gradient(to top left, transparent calc(50% - 1px), #e74c3c, transparent calc(50% + 1px)), #ffffff;
}

.ge-color-grid {
    display: grid;
    grid-template-columns: repeat(6, 22px);
    gap: 3px;
    padding: 4px 2px;
}

.ge-swatch {
    width: 22px;
    height: 22px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, .15);
    cursor: default;
}

.ge-swatch:hover,
.ge-swatch:focus-visible {
    outline: 2px solid var(--ge-focus);
    outline-offset: -1px;
}

.ge-color-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.ge-emoji {
    width: 300px;
}

.ge-emoji-search {
    width: 100%;
    height: 28px;
    margin-bottom: 4px;
    padding: 2px 6px;
    border: 1px solid var(--ge-border);
    background: var(--ge-content-bg);
    color: var(--ge-text);
    font: inherit;
    outline: none;
}

.ge-emoji-search:focus {
    border-color: var(--ge-focus);
}

.ge-emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    max-height: 210px;
    overflow-y: auto;
}

.ge-emoji-grid button {
    height: 34px;
    padding: 0;
    border: 0;
    background: none;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', sans-serif;
    font-size: 20px;
    line-height: 1;
    cursor: default;
}

.ge-emoji-grid button:hover,
.ge-emoji-grid button:focus-visible {
    background: var(--ge-hover);
    outline: none;
}

.ge-ac-muted {
    color: var(--ge-muted);
}
/* #endregion */

/* #region Autocompletar (menções e emoji) */
.ge-autocomplete {
    position: fixed;
    z-index: 10011;
    min-width: 180px;
    max-height: 220px;
    margin: 0;
    padding: 2px 0;
    overflow-y: auto;
    list-style: none;
    background: var(--ge-panel-bg);
    border: 1px solid var(--ge-border);
    box-shadow: var(--ge-shadow);
}

.ge-autocomplete li {
    padding: 5px 10px;
    color: var(--ge-text);
    white-space: nowrap;
    cursor: pointer;
}

.ge-autocomplete li:hover {
    background: var(--ge-hover);
}

.ge-autocomplete li.ge-selected {
    background: var(--ge-selected);
}
/* #endregion */

/* #region Diálogo */
.ge-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .5);
}

.ge-overlay.ge-dark,
body.dark .ge-overlay {
    background: rgba(0, 0, 0, .5);
}

.ge-dialog {
    min-width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--ge-panel-bg);
    border: 1px solid var(--ge-border);
    box-shadow: 0 2px 14px rgba(0, 0, 0, .3);
}

.ge-dialog-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--ge-toolbar-bg);
    border-bottom: 1px solid var(--ge-border);
    font-size: 13px;
    font-weight: bold;
}

.ge-dialog-close {
    padding: 0 4px;
    border: 0;
    background: none;
    color: inherit;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.ge-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 12px;
}

.ge-form-row {
    display: flex;
    gap: 12px;
}

.ge-dialog label {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
}

.ge-dialog label.ge-check {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.ge-dialog input[type="number"],
.ge-dialog input[type="text"],
.ge-dialog select {
    height: 28px;
    padding: 2px 6px;
    border: 1px solid var(--ge-border);
    background: var(--ge-content-bg);
    color: var(--ge-text);
    font: inherit;
    outline: none;
}

.ge-dialog input:focus,
.ge-dialog select:focus {
    border-color: var(--ge-focus);
}

.ge-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: var(--ge-toolbar-bg);
    border-top: 1px solid var(--ge-border);
}

.ge-dialog-btn {
    min-width: 72px;
    height: 28px;
    padding: 0 12px;
    border: 1px solid var(--ge-on-border);
    background: var(--ge-panel-bg);
    color: var(--ge-icon);
    font: inherit;
    cursor: pointer;
}

.ge-dialog-btn:hover {
    background: var(--ge-hover);
}

.ge-dialog-btn.ge-ok {
    border-color: var(--ge-ok-bg);
    background: var(--ge-ok-bg);
    color: #ffffff;
}

.ge-dialog-btn.ge-ok:hover {
    background: var(--ge-ok-hover);
}

.ge-dialog-btn:focus-visible {
    outline: 2px solid var(--ge-focus);
    outline-offset: 1px;
}
/* #endregion */
