/* ==========================================================
   RichEditor — design tokens from CustomeStyle.css
   
   Key tokens used:
   - Font:          Mulish (matches font-family throughout)
   - Primary grad:  linear-gradient(0deg,#cb4c10 5.9%,#EF7F1A 94.28%)  (.header)
   - Orange btn:    #f0792e hover #d25612   (.btn-orange)
   - Page card:     white, border-radius:20px, padding:20px  (.allPagesbg)
   - Page title:    18px, bold, #cb4c10, border-bottom:2px solid #EF7F1A  (.mm-page-title)
   - Form label:    14px, 600, #495057, Mulish  (.form-label)
   - Action btn:    #f8f9fa, border:#dee2e6, radius:4px, 13px  (.action-btn)
   - Table search:  bg #f8f1ea  (.column-search-row th)
   - Orange accent: #EF7F1A, #cb4c10, #f4b183, #ffeee6
   ========================================================== */



/* ── Utilities ───────────────────────────────────────────── */
.re-modal-hidden {
    display: none !important;
}

.re-input-hidden {
    display: none !important;
}

/* ── Page container ──────────────────────────────────────── */
.re-page-container {
    max-width: 900px;
}

/* ── Page card — matches .allPagesbg ─────────────────────── */
.re-page-card {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 1px 8px rgba(0,0,0,0.07);
}

/* ── Page title — matches .mm-page-title ─────────────────── */
.re-page-title {
    font-size: 18px;
    font-weight: 700;
    color: #cb4c10;
    margin-bottom: 0;
    padding-bottom: 0;
    font-family: 'Mulish', sans-serif;
}

/* ── Back button — matches .action-btn ──────────────────── */
.re-back-btn {
    background-color: #f8f9fa;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: #000;
    border: 1px solid #dee2e6;
    font-size: 13px;
    font-family: 'Mulish', sans-serif;
    display: inline-block;
}

    .re-back-btn:hover {
        background-color: #e9ecef;
        color: #000;
        text-decoration: none;
    }

/* ── Divider under title — matches .mm-page-title border ─── */
.re-title-divider {
    border: none;
    border-top: 2px solid #EF7F1A;
    margin: 10px 0 20px 0;
}

/* ── Form label — matches .form-label ───────────────────── */
.re-form-label {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
    font-family: 'Mulish', sans-serif;
    display: block;
}

.re-form-label-opt {
    font-weight: 400;
    color: #adb5bd;
    font-size: 13px;
}

/* ── Title input — matches Bootstrap form-control style ──── */
.re-title-input {
    display: block;
    width: 100%;
    padding: 6px 12px;
    font-size: 14px;
    font-family: 'Mulish', sans-serif;
    font-weight: 400;
    color: #212529;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .re-title-input:focus {
        border-color: #EF7F1A;
        box-shadow: 0 0 0 0.2rem rgba(239,127,26,0.2);
    }

/* ══════════════════════════════════════════════════════════
   EDITOR WRAPPER
   ══════════════════════════════════════════════════════════ */
.re-wrapper {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    background: #fff;
    font-family: 'Mulish', 'Segoe UI', sans-serif;
    position: relative;
    overflow: visible;
}

/* ── Toolbar — uses .header gradient ────────────────────── */
.re-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 7px 10px;
    background: linear-gradient(0deg, #cb4c10 5.9%, #EF7F1A 94.28%);
    border-radius: 7px 7px 0 0;
    align-items: center;
}

.re-toolbar-group {
    display: flex;
    gap: 2px;
    align-items: center;
}

.re-toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.3);
    margin: 0 4px;
}

/* ── Toolbar buttons ─────────────────────────────────────── */
.re-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 27px;
    padding: 0 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: rgba(255,255,255,0.18);
    cursor: pointer;
    font-size: 12px;
    color: #fff;
    font-family: 'Mulish', sans-serif;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1;
    transition: background 0.12s, border-color 0.12s;
}

    .re-btn:hover {
        background: rgba(255,255,255,0.32);
        border-color: rgba(255,255,255,0.55);
    }

    .re-btn.re-active {
        background: #ffffff;
        border-color: #ffffff;
        color: #cb4c10;
        font-weight: 700;
    }

.re-btn-heading {
    font-size: 11px;
}

/* ── Editable area ───────────────────────────────────────── */
.re-editable {
    min-height: 280px;
    padding: 14px 16px;
    outline: none;
    font-size: 14px;
    line-height: 1.7;
    color: #212529;
    word-wrap: break-word;
    overflow-y: auto;
    font-family: 'Mulish', 'Segoe UI', sans-serif;
}

    .re-editable:focus {
        box-shadow: inset 0 0 0 2px rgba(239,127,26,0.15);
    }

    /* ── Text alignment classes ──────────────────────────────── */
    .re-editable .re-align-left {
        text-align: left;
    }

    .re-editable .re-align-center {
        text-align: center;
    }

    .re-editable .re-align-right {
        text-align: right;
    }

    /* ── Typography inside editor ────────────────────────────── */
    .re-editable h1 {
        font-size: 1.6em;
        font-weight: 700;
        margin: 0.5em 0 0.3em;
    }

    .re-editable h2 {
        font-size: 1.3em;
        font-weight: 700;
        margin: 0.45em 0 0.25em;
    }

    .re-editable h3 {
        font-size: 1.1em;
        font-weight: 600;
        margin: 0.4em 0 0.2em;
    }

    .re-editable p {
        margin: 0 0 0.55em;
    }

    .re-editable ul,
    .re-editable ol {
        padding-left: 1.5em;
        margin: 0 0 0.55em;
    }

    .re-editable li {
        margin-bottom: 0.2em;
    }

    .re-editable a {
        color: #f0792e;
        text-decoration: underline;
    }

    /* ── Images in editor ────────────────────────────────────── */
    .re-editable .re-img,
    .re-editable img {
        max-width: 100%;
        height: auto;
        border-radius: 4px;
        margin: 6px 4px;
        border: 1px solid #dee2e6;
        display: block;
        cursor: pointer;
        outline-offset: 2px;
        transition: outline 0.1s;
    }

        /* Highlight on click */
        .re-editable img.re-img-selected {
            outline: 2px solid #f0792e;
        }

        /* ── Image sizes ─────────────────────────────────────────── */
        .re-editable img.re-img-sm {
            width: 160px;
            max-width: 100%;
        }

        .re-editable img.re-img-md {
            width: 320px;
            max-width: 100%;
        }

        .re-editable img.re-img-lg {
            width: 560px;
            max-width: 100%;
        }

        .re-editable img.re-img-full {
            width: 100%;
        }

        /* ── Image alignment — flexbox on wrapper ────────────────── */
        .re-editable img.re-img-float-left,
        .re-editable img.re-img-float-center,
        .re-editable img.re-img-float-right {
            float: none;
            display: block;
            margin: 4px;
        }

    .re-editable .re-img-wrap-left,
    .re-editable .re-img-wrap-center,
    .re-editable .re-img-wrap-right {
        display: flex;
        width: 100%;
    }

    .re-editable .re-img-wrap-left {
        justify-content: flex-start;
    }

    .re-editable .re-img-wrap-center {
        justify-content: center;
    }

    .re-editable .re-img-wrap-right {
        justify-content: flex-end;
    }

        .re-editable .re-img-wrap-left > img,
        .re-editable .re-img-wrap-center > img,
        .re-editable .re-img-wrap-right > img {
            flex: 0 0 auto;
            max-width: 100%;
        }

    /* ── Pending-operation dim (replaces inline opacity — CSP-safe) ── */
    .re-editable img.re-img-dimmed {
        opacity: 0.35;
        pointer-events: none;
    }

    /* ── Upload placeholder ──────────────────────────────────── */
    .re-editable .re-uploading {
        display: inline-block;
        padding: 3px 10px;
        background: #ffeee6;
        border: 1px dashed #f0792e;
        border-radius: 4px;
        font-size: 13px;
        color: #cb4c10;
    }

/* ══════════════════════════════════════════════════════════
   FLOATING IMAGE TOOLBAR
   ══════════════════════════════════════════════════════════ */
.re-img-toolbar {
    position: absolute;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 3px;
    background: #fff;
    border: 1px solid #dee2e6;
    top: var(--re-tb-top, 4px);
    left: var(--re-tb-left, 0px);
    top: var(--re-tb-top, 4px);
    left: var(--re-tb-left, 0px);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.14);
    padding: 4px 8px;
    white-space: nowrap;
    font-family: 'Mulish', sans-serif;
}

.re-img-toolbar-label {
    font-size: 11px;
    font-weight: 700;
    color: #6c757d;
    margin-right: 2px;
}

.re-img-toolbar-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: #dee2e6;
    margin: 0 5px;
}

.re-img-tb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 24px;
    padding: 0 6px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    font-family: 'Mulish', sans-serif;
    line-height: 1;
    transition: background 0.1s, border-color 0.1s;
}

    .re-img-tb-btn:hover {
        background: #ffeee6;
        border-color: #f0792e;
        color: #cb4c10;
    }

    .re-img-tb-btn.re-img-tb-active {
        background: #f0792e;
        border-color: #d25612;
        color: #ffffff;
    }

    /* Replace button — orange accent */
    .re-img-tb-btn.re-img-tb-replace {
        background: #fff8f4;
        border-color: #f0792e;
        color: #cb4c10;
        font-size: 11px;
        padding: 0 8px;
    }

        .re-img-tb-btn.re-img-tb-replace:hover {
            background: #f0792e;
            border-color: #d25612;
            color: #fff;
        }

    /* Delete button — red danger */
    .re-img-tb-btn.re-img-tb-delete {
        background: #fff5f5;
        border-color: #f5c6cb;
        color: #dc3545;
        font-size: 11px;
        padding: 0 8px;
    }

        .re-img-tb-btn.re-img-tb-delete:hover {
            background: #dc3545;
            border-color: #c82333;
            color: #fff;
        }


.re-attachments {
    border-top: 1px solid #dee2e6;
    padding: 7px 12px;
    background: #f8f1ea;
    border-radius: 0 0 7px 7px;
    min-height: 40px;
}

.re-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ── File chip ───────────────────────────────────────────── */
.re-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffeee6;
    border: 1px solid #f4b183;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 12px;
    font-family: 'Mulish', sans-serif;
}

.re-file-link {
    color: #cb4c10;
    text-decoration: none;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    font-size: 12px;
}

    .re-file-link:hover {
        text-decoration: underline;
    }

.re-file-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: #aaa;
    font-size: 10px;
    padding: 0;
    line-height: 1;
    transition: color 0.12s;
}

    .re-file-remove:hover {
        color: #cb4c10;
    }

/* ══════════════════════════════════════════════════════════
   SAVE / CANCEL BUTTONS — matches .btn-orange / .action-btn
   ══════════════════════════════════════════════════════════ */
.re-save-btn {
    background-color: #f0792e;
    color: #ffffff;
    padding: 6px 20px;
    border-radius: 4px;
    border: 0;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Mulish', sans-serif;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.15s;
}

    .re-save-btn:hover {
        background-color: #d25612;
        color: #ffffff;
    }

.re-cancel-btn {
    background-color: #f8f9fa;
    padding: 6px 16px;
    border-radius: 4px;
    text-decoration: none;
    color: #000;
    border: 1px solid #dee2e6;
    font-size: 14px;
    font-family: 'Mulish', sans-serif;
    display: inline-block;
    transition: background-color 0.15s;
}

    .re-cancel-btn:hover {
        background-color: #e9ecef;
        color: #000;
        text-decoration: none;
    }

/* ══════════════════════════════════════════════════════════
   INDEX PAGE
   ══════════════════════════════════════════════════════════ */
.re-index-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

/* New Note button — matches .btn-orange */
.re-new-btn {
    background-color: #f0792e;
    color: #ffffff;
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Mulish', sans-serif;
    border: 0;
    transition: background-color 0.15s;
}

    .re-new-btn:hover {
        background-color: #d25612;
        color: #ffffff;
        text-decoration: none;
    }

/* ── Table — matches .table-grid / DataTables style ──────── */
.re-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: 'Mulish', sans-serif;
    margin-top: 12px;
}

    /* thead — gradient header matches .header */
    .re-table thead tr {
        background: linear-gradient(0deg, #cb4c10 5.9%, #EF7F1A 94.28%);
    }

    .re-table thead th {
        color: #ffffff;
        font-weight: 700;
        padding: 9px 12px;
        text-align: left;
        font-size: 12px;
        border: none;
        white-space: nowrap;
        font-family: 'Mulish', sans-serif;
    }

    /* tbody rows */
    .re-table tbody tr {
        border-bottom: 1px solid #dee2e6;
        transition: background 0.1s;
    }

        .re-table tbody tr:hover td {
            background-color: #fff9f5;
        }

    .re-table tbody td {
        padding: 9px 12px;
        color: #212529;
        vertical-align: middle;
        border: none;
        border-bottom: 1px solid #dee2e6;
        font-size: 13px;
        height: 26px;
        background-color: #ffffff;
    }

    .re-table tbody tr:last-child td {
        border-bottom: none;
    }

.re-col-title {
    width: 180px;
}

.re-col-actions {
    width: 130px;
    white-space: nowrap;
}

/* Note title */
.re-note-title {
    font-weight: 600;
    color: #cb4c10;
    font-size: 13px;
}

.re-note-untitled {
    color: #adb5bd;
    font-style: italic;
    font-size: 13px;
}

/* Edit / Delete action buttons — matches .action-btn / .btn-orange */
.re-edit-btn {
    background-color: #f8f9fa;
    padding: 3px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: #000;
    border: 1px solid #dee2e6;
    font-size: 12px;
    font-family: 'Mulish', sans-serif;
    display: inline-block;
    transition: background-color 0.12s;
}

    .re-edit-btn:hover {
        background-color: #f0792e;
        color: #fff;
        border-color: #f0792e;
        text-decoration: none;
    }

.re-delete-btn {
    background-color: #f8f9fa;
    padding: 3px 10px;
    border-radius: 4px;
    text-decoration: none;
    color: #dc3545;
    border: 1px solid #f5c6cb;
    font-size: 12px;
    font-family: 'Mulish', sans-serif;
    display: inline-block;
    margin-left: 4px;
    transition: background-color 0.12s;
}

    .re-delete-btn:hover {
        background-color: #dc3545;
        color: #fff;
        border-color: #dc3545;
        text-decoration: none;
    }

/* Empty state */
.re-empty {
    text-align: center;
    padding: 32px 20px;
    color: #6c757d;
    font-size: 13px;
    font-style: italic;
    font-family: 'Mulish', sans-serif;
    background-color: #ffffff;
}

    .re-empty a {
        color: #f0792e;
        font-weight: 600;
        text-decoration: none;
    }

        .re-empty a:hover {
            text-decoration: underline;
        }

/* ── Index preview ────────────────────────────────────────── */
.note-html-preview {
    max-height: 80px;
    overflow: hidden;
    font-size: 12px;
    color: #495057;
    line-height: 1.5;
    font-family: 'Mulish', sans-serif;
}

    .note-html-preview h1,
    .note-html-preview h2,
    .note-html-preview h3 {
        font-size: 13px;
        font-weight: 700;
        margin: 0;
    }

    .note-html-preview p {
        margin: 0 0 2px;
    }

.re-preview-img {
    max-height: 45px;
    max-width: 90px;
    border-radius: 3px;
    display: inline-block;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 576px) {
    .re-page-card {
        padding: 14px;
    }

    .re-toolbar {
        padding: 5px 6px;
    }

    .re-btn {
        min-width: 26px;
        height: 25px;
        font-size: 11px;
    }

    .re-index-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* ══════════════════════════════════════════════════════════
   DETAILS PAGE — read-only public content view
   ══════════════════════════════════════════════════════════ */

/* Content body — renders stored HTML cleanly */
.re-details-body {
    font-family: 'Mulish', 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #212529;
    min-height: 80px;
    padding: 4px 0 16px 0;
}

    /* Typography matching editor output */
    .re-details-body h1 {
        font-size: 1.6em;
        font-weight: 700;
        margin: 0.5em 0 0.3em;
    }

    .re-details-body h2 {
        font-size: 1.3em;
        font-weight: 700;
        margin: 0.45em 0 0.25em;
    }

    .re-details-body h3 {
        font-size: 1.1em;
        font-weight: 600;
        margin: 0.4em 0 0.2em;
    }

    .re-details-body p {
        margin: 0 0 0.65em;
    }

    .re-details-body ul,
    .re-details-body ol {
        padding-left: 1.5em;
        margin: 0 0 0.65em;
    }

    .re-details-body ul {
        list-style: none;
        padding-left: 0.5em;
    }

        .re-details-body ul li {
            display: flex;
            align-items: flex-start;
            margin-bottom: 0.25em;
        }

    .re-details-body ol li {
        margin-bottom: 0.25em;
    }

    .re-details-body a {
        color: #f0792e;
        text-decoration: underline;
    }

        .re-details-body a:hover {
            color: #d25612;
        }

    /* Alignment classes preserved from editor */
    .re-details-body .re-align-left {
        text-align: left;
    }

    .re-details-body .re-align-center {
        text-align: center;
    }

    .re-details-body .re-align-right {
        text-align: right;
    }

    /* Images */
    .re-details-body .re-details-img,
    .re-details-body img {
        max-width: 100%;
        height: auto;
        /*  border-radius: 6px;
        border: 1px solid #dee2e6;*/
        margin: 8px 4px;
        /* inline-block allows margin:auto centering to work
           even on older saved records without a wrapper class */
        display: inline-block;
        vertical-align: top;
    }

        /* ── Image sizes (mirror editor classes) ─────────────────────── */
        .re-details-body img.re-img-sm {
            width: 160px;
            max-width: 100%;
        }

        .re-details-body img.re-img-md {
            width: 320px;
            max-width: 100%;
        }

        .re-details-body img.re-img-lg {
            width: 560px;
            max-width: 100%;
        }

        .re-details-body img.re-img-full {
            width: 100%;
        }

        /* ── Image alignment (mirror editor classes) ─────────────────── */
        /* ── Image alignment — NO float, wrapper drives text-align ─── */
        .re-details-body img.re-img-float-left,
        .re-details-body img.re-img-float-center,
        .re-details-body img.re-img-float-right {
            float: none;
            display: inline-block;
            margin: 4px;
        }

    /* ── Image alignment — flexbox on wrapper, beats any global img rules */
    .re-details-body .re-img-wrap-left,
    .re-details-body .re-img-wrap-center,
    .re-details-body .re-img-wrap-right {
        display: flex;
        width: 100%;
    }

    .re-details-body .re-img-wrap-left {
        justify-content: flex-start;
    }

    .re-details-body .re-img-wrap-center {
        justify-content: center;
    }

    .re-details-body .re-img-wrap-right {
        justify-content: flex-end;
    }

        /* img inside a wrapper: flex-child, don't stretch */
        .re-details-body .re-img-wrap-left > img,
        .re-details-body .re-img-wrap-center > img,
        .re-details-body .re-img-wrap-right > img {
            flex: 0 0 auto;
            display: block;
            max-width: 100%;
        }

/* Empty state */
.re-details-empty {
    color: #adb5bd;
    font-style: italic;
    font-size: 13px;
    font-family: 'Mulish', sans-serif;
}

/* Attachments section */
.re-details-attachments {
    border-top: 1px solid #dee2e6;
    margin-top: 16px;
    padding-top: 14px;
}

.re-details-attach-title {
    font-size: 12px;
    font-weight: 700;
    color: #cb4c10;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
    font-family: 'Mulish', sans-serif;
}

.re-details-attach-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.re-details-attach-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffeee6;
    border: 1px solid #f4b183;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 12px;
    color: #cb4c10;
    font-weight: 600;
    text-decoration: none;
    font-family: 'Mulish', sans-serif;
    transition: background 0.12s;
}

    .re-details-attach-chip:hover {
        background: #f4b183;
        color: #fff;
        text-decoration: none;
    }

/* Clickable title link in Index table */
.re-note-link {
    color: #cb4c10;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    font-family: 'Mulish', sans-serif;
}

    .re-note-link:hover {
        color: #f0792e;
        text-decoration: underline;
    }
