/* ModsEditor - see editor.js. All classes start with me-, so they do not collide with mods.css. */

/* The editor fills the whole width of the cell it sits in (a fixed table on the admin page, a percent table on the member page). */
.me-root { position: relative; box-sizing: border-box; width: 100%; max-width: none; min-width: 0; margin: 0 0 10px 0; font-family: Arial, sans-serif; }

.me-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    padding: 6px; background: #f4f4f4; border: 1px solid #bbb; border-bottom: none;
}
/* The toolbar stays at the top of the window while a long text is scrolled (the page scrolls, not the editor). The site has no fixed top menu, so top: 0.
   It sticks inside .me-root only, so it leaves with the editor. On a low window it would take too much room: then it scrolls with the page. */
.me-toolbar { position: sticky; top: 0; z-index: 50; }
@media (max-height: 600px) { .me-toolbar { position: static; } }
.me-group { position: relative; display: inline-flex; align-items: center; gap: 3px; padding-right: 6px; border-right: 1px solid #ccc; }
.me-group:last-child { border-right: none; }

.me-btn {
    position: relative; box-sizing: border-box; width: 30px; height: 30px; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #bbb; background: #fff; color: #222; font-size: 14px; cursor: pointer;
}
.me-btn:hover { background: #e2e2e2; }
.me-btn input[type=color] { position: absolute; width: 0; height: 0; opacity: 0; }
.me-color-a { border-bottom: 3px solid #d00; line-height: 1; }
.me-color-h { background: #ff0; line-height: 1; padding: 0 2px; }
.me-select { height: 30px; border: 1px solid #bbb; background: #fff; font-size: 13px; }

.me-area {
    min-height: 250px; padding: 10px; box-sizing: border-box; overflow: auto;
    border: 1px solid #bbb; background: #fff; color: #000; font-size: 14px; line-height: 1.4; outline: none;
}
.me-area:focus { border-color: #3a7bd5; }
.me-area img { max-width: 100%; cursor: pointer; }
/* The border is counted in max-width:100% (the same rule as on the article page, mods.css), so picture + border is never wider than the editor. */
.me-area img[style*="border"] { box-sizing: border-box; }
.me-area ul, .me-area ol { margin: 6px 0 6px 28px; padding: 0; }
.me-area table { border-collapse: collapse; }
.me-area td, .me-area th { border: 1px dotted #999; }

/* The frame and the corner handles of a selected picture (a box of its own over the writing area, never part of the text) */
.me-sel { display: none; position: absolute; z-index: 40; box-sizing: border-box; pointer-events: none; border: 2px solid #3a7bd5; }
.me-sel.me-sel-on { display: block; }
.me-handle { position: absolute; width: 12px; height: 12px; box-sizing: border-box; background: #fff; border: 2px solid #3a7bd5; pointer-events: auto; touch-action: none; }
.me-handle-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.me-handle-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.me-handle-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.me-handle-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.me-sel-btn { position: absolute; right: 6px; top: 6px; pointer-events: auto; padding: 2px 8px; font-size: 12px; cursor: pointer; background: #fff; border: 1px solid #3a7bd5; color: #222; }
.me-sel-size { display: none; position: absolute; left: 6px; top: 6px; padding: 2px 6px; font-size: 12px; color: #fff; background: rgba(0, 0, 0, .7); }
.me-sel.me-sel-drag .me-sel-size { display: block; }
@media (pointer: coarse) {
    .me-handle { width: 24px; height: 24px; }
    .me-handle-nw { left: -13px; top: -13px; } .me-handle-ne { right: -13px; top: -13px; }
    .me-handle-sw { left: -13px; bottom: -13px; } .me-handle-se { right: -13px; bottom: -13px; }
    .me-sel-btn { padding: 6px 12px; }
}

/* The emoji panel: under the emoji button, over the writing area (the toolbar is above it, z-index 50) */
.me-emoji-panel { display: none; position: absolute; z-index: 60; top: 100%; left: 0; margin-top: 3px; padding: 6px; gap: 2px;
                  grid-template-columns: repeat(10, 32px); background: #fff; border: 1px solid #999; box-shadow: 0 3px 10px rgba(0, 0, 0, .25); }
.me-emoji-panel.me-open { display: grid; }
.me-emoji { width: 32px; height: 32px; padding: 0; font-size: 20px; line-height: 1; cursor: pointer; border: 1px solid transparent; background: none;
            font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.me-emoji:hover, .me-emoji:focus { background: #e2e2e2; border-color: #bbb; outline: none; }
@media (max-width: 520px) { .me-emoji-panel { grid-template-columns: repeat(6, 36px); } .me-emoji { width: 36px; height: 36px; } }

.me-hidden { display: none; }
.me-source-mode .me-area { display: none; }
.me-source-mode .me-toolbar .me-btn, .me-source-mode .me-toolbar .me-select { opacity: .4; pointer-events: none; }
.me-source-mode .me-toolbar .me-source-btn { opacity: 1; pointer-events: auto; }
.me-root textarea {
    width: 100%; box-sizing: border-box; min-height: 250px; border: 1px solid #bbb;
    font-family: "Courier New", monospace; font-size: 13px;
}

.me-info { text-align: right; font-size: 11px; color: #777; margin-top: 3px; }
.me-info.me-too-big { color: #c00; font-weight: bold; }

/* Error message under the editor (picture upload) */
.me-msg { display: none; margin-top: 4px; padding: 6px 8px; font-size: 12px; color: #900; background: #fdeaea; border: 1px solid #e0a0a0; }
.me-msg.me-show { display: block; }

/* Placeholder with progress bar while a picture uploads (replaced by the picture when done) */
.me-upload { display: inline-block; vertical-align: middle; min-width: 200px; max-width: 100%; box-sizing: border-box; padding: 6px 10px; margin: 2px 0;
             font-size: 12px; color: #335; background: #eef3fb; border: 1px dashed #7a9bd0; user-select: none; }
.me-upload-text { display: block; }
.me-progress { display: block; height: 6px; margin-top: 4px; background: #d3dcec; }
.me-progress-bar { display: block; height: 100%; width: 0; background: #3a7bd5; transition: width .15s; }

.me-overlay { display: none; position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .5);
              align-items: center; justify-content: center; }
.me-overlay.me-open { display: flex; }
.me-modal { background: #fff; padding: 20px; width: 520px; max-width: 92vw; font-family: Arial, sans-serif; font-size: 13px; }
.me-modal h3 { margin: 0 0 12px 0; font-size: 16px; }
.me-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.me-fields label { display: flex; flex-direction: column; gap: 4px; font-weight: bold; color: #444; }
.me-fields .me-wide { grid-column: 1 / -1; }
.me-fields .me-check { flex-direction: row; align-items: center; gap: 6px; font-weight: normal; }
.me-fields .me-check input { width: auto; height: auto; }
.me-hint { color: #b00000; font-weight: normal; }
.me-fields input, .me-fields select { box-sizing: border-box; width: 100%; height: 30px; font-size: 13px; }
.me-modal-buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.me-modal-buttons button { padding: 6px 14px; cursor: pointer; }
.me-btn.me-wide-btn { width: auto; padding: 0 8px; font-size: 12px; }
