﻿/* ============================================================
   tw-document-preview.css
   Word-document-style live preview in a slide-out drawer (RHS).
   Typography/colour values extracted from the IPP assessment
   report template (Segoe UI; teal #1FB5BE; ink #323B42).
   Depends on: nothing (Bootstrap-compatible, no overrides).
   ============================================================ */

:root {
    --tw-doc-teal: #1FB5BE;
    --tw-doc-ink: #323B42;
    --tw-doc-orange: #F05A29;
    --tw-doc-rule: #BEBFBE;
    --tw-doc-red: #D2212C;
    --tw-doc-amber: #FFBE00;
    --tw-doc-green: #228722;
    --tw-doc-neutral: #DDDCDA;
    --tw-doc-page-width: 794px; /* A4 @ 96dpi */
}

/* ------------------------------------------------------------
   The drawer
   ------------------------------------------------------------ */
.tw-doc-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 620px; /* default; JS resizes + persists */
    max-width: 100vw;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: #f4f5f7;
    box-shadow: -4px 0 16px rgba(0, 0, 0, .18);
    transform: translateX(100%);
    transition: transform .28s ease;
    visibility: hidden; /* keep out of tab order when closed */
}

   

    .tw-doc-drawer.open {
        transform: none;
        visibility: visible;
    }

    .tw-doc-drawer.no-transition {
        transition: none;
    }
    /* body push while the drawer is open — value set by JS */
    body {
        transition: padding-right .28s ease;
    }

        body.tw-doc-no-transition {
            transition: none;
        }
    /* ------------------------------------------------------------
   The toggle tab: protrudes from the drawer's left edge so it
   travels with the drawer (visible when closed, moves when open)
   ------------------------------------------------------------ */
    .tw-doc-drawer-tab {
        position: absolute;
        left: -2.6rem;
        top: 40%;
        width: 2.6rem;
        padding: .85rem 0;
        border: 0;
        border-radius: .375rem 0 0 .375rem;
        background: var(--tw-doc-teal);
        color: #fff;
        box-shadow: -3px 2px 8px rgba(0, 0, 0, .22);
        writing-mode: vertical-rl;
        text-orientation: mixed;
        font-size: .8rem;
        letter-spacing: .04em;
        cursor: pointer;
        visibility: visible; /* stays visible even when drawer is hidden */
    }

        .tw-doc-drawer-tab:hover {
            filter: brightness(1.07);
        }

        .tw-doc-drawer-tab .fa-solid,
        .tw-doc-drawer-tab .fa-regular {
            margin-bottom: .45rem;
        }

        .tw-doc-drawer-tab.notes {
            top: 30%;
        }
    /* ------------------------------------------------------------
   The resize handle on the drawer's left edge
   ------------------------------------------------------------ */
    .tw-doc-drawer-resize {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 8px;
        cursor: col-resize;
        touch-action: none;
        user-select: none;
        z-index: 2;
    }

        .tw-doc-drawer-resize::after {
            content: "";
            position: absolute;
            left: 2px;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 44px;
            border-radius: 2px;
            background: #adb5bd;
            opacity: 0;
            transition: opacity .15s;
        }

        .tw-doc-drawer-resize:hover::after,
        .tw-doc-drawer.resizing .tw-doc-drawer-resize::after {
            opacity: 1;
        }

    body.tw-is-resizing {
        cursor: col-resize;
        user-select: none;
    }

        body.tw-is-resizing iframe {
            pointer-events: none;
        }
    /* TinyMCE iframes */
    /* ------------------------------------------------------------
   Drawer toolbar + the "desk"
   ------------------------------------------------------------ */
    .tw-doc-preview-toolbar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: .5rem;
        padding: .5rem .75rem .5rem 1rem;
        font-size: .8rem;
        color: #5b6570;
        border-bottom: 1px solid #dee2e6;
        background: #fff;
    }

.tw-doc-preview-panel {
    background: #ebe7df;
    padding: 1rem;
    overflow-y: auto;
    flex: 1 1 auto;
}
    /* ------------------------------------------------------------
   The sheet
   ------------------------------------------------------------ */
    .tw-doc-page-wrapper {
        overflow: hidden;
    }

    .tw-doc-page {
        /*width: var(--tw-doc-page-width);
        min-height: 1123px;*/ /* A4 min-height; grows with content */
        /*padding: 96px;*/ /* 2.54cm margins, per the template */
        /*background: #fff;
        box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
        transform-origin: top left;
        font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
        font-size: 10pt;
        line-height: 1.33;*/ /* 13.3pt leading, measured */
        /*color: var(--tw-doc-ink);*/
    }

        .tw-doc-page.notes {
            width:100%;
        }
    /* ------------------------------------------------------------
   Document typography (matches the Word template styles)
   ------------------------------------------------------------ */
    .tw-doc-page p {
        margin: 0 0 8pt;
    }

    .tw-doc-page h1 { /* document-level heading */
        font-size: 16pt;
        font-weight: 600; /* Segoe UI Semibold */
        color: var(--tw-doc-teal);
        margin: 0 0 10pt;
        line-height: 1.2;
    }

    .tw-doc-page h2 { /* numbered section headings */
        font-size: 14pt;
        font-weight: 600;
        color: var(--tw-doc-teal);
        margin: 14pt 0 6pt;
        line-height: 1.2;
    }

    .tw-doc-page h3 { /* sub-headings, ink not teal */
        font-size: 14pt;
        font-weight: 600;
        color: var(--tw-doc-ink);
        margin: 12pt 0 6pt;
        line-height: 1.2;
    }

    .tw-doc-page strong {
        font-weight: 700;
    }
    /* orange bullet glyphs, ink text */
    .tw-doc-page ul {
        margin: 0 0 8pt;
        padding-left: 22pt;
        list-style: none;
    }

        .tw-doc-page ul li {
            position: relative;
            margin-bottom: 2pt;
        }

            .tw-doc-page ul li::before {
                content: "\2022";
                color: var(--tw-doc-orange);
                position: absolute;
                left: -12pt;
                font-weight: 700;
            }
    /* ------------------------------------------------------------
   Tables: 0.5pt hairline borders
   ------------------------------------------------------------ */
    .tw-doc-page table {
        width: 100%;
        border-collapse: collapse;
        margin: 0 0 10pt;
        font-size: 10pt;
    }

        .tw-doc-page table td,
        .tw-doc-page table th {
            border: 0.5pt solid var(--tw-doc-rule);
            padding: 6pt 9pt;
            text-align: left;
            vertical-align: top;
            font-weight: 400;
        }

        .tw-doc-page table th {
            font-weight: 700;
        }
    /* traffic-light rating cells */
    .tw-doc-page td.rating-red {
        background: var(--tw-doc-red);
        color: #fff;
    }

    .tw-doc-page td.rating-amber {
        background: var(--tw-doc-amber);
    }

    .tw-doc-page td.rating-green {
        background: var(--tw-doc-green);
        color: #fff;
    }

    .tw-doc-page td.rating-noted {
        background: var(--tw-doc-neutral);
    }
    /* ------------------------------------------------------------
   Merge tokens
   ------------------------------------------------------------ */
    .tw-doc-page .doc-token-empty {
        color: #9aa2a9;
        font-style: italic;
        background: #f2f4f5;
        border-radius: 2px;
        padding: 0 2px;
    }

    .tw-doc-page [data-token]:not(.valid) {
        /*color: #FFF;
        font-style: italic;
        background: orange;
        border:2px solid red;*/
    }
    /* conditional sections hidden until their trigger value matches */
    .tw-doc-page .doc-section-hidden {
        display: none;
    }
    /* ------------------------------------------------------------
   Small screens: full-width overlay, no push
   ------------------------------------------------------------ */
    @media (max-width: 991.98px) {
        .tw-doc-drawer {
            width: 100vw !important;
        }

        .tw-doc-drawer-resize {
            display: none;
        }
    }
    /* ------------------------------------------------------------
   Admin editor: token chips (non-editable islands in TinyMCE)
   ------------------------------------------------------------ */
    .tw-doc-page .doc-token-chip {
        display: inline-block;
        background: rgba(31, 181, 190, .10);
        border: 1px solid var(--tw-doc-teal);
        border-radius: 3px;
        color: #0E7C83;
        padding: 0 4px;
        font-size: 9pt;
        line-height: 1.4;
        white-space: nowrap;
        cursor: default;
    }

        .tw-doc-page .doc-token-chip.has-content {
            border: none;
            /*border-bottom: 1px solid var(--tw-doc-teal);*/
            background: none;
        }
/* ---- End user notes + autosave status ---- */

.enduser-notes {
    border-radius: 5px;
    width: 100%;
    height: 20vh;
}

.enduser-notes-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 1.4rem;
    margin: 0.25rem 0 1rem;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #6c757d;
    /* Reserve the row so showing/hiding the message never reflows the notes column */
    visibility: hidden;
}

.enduser-notes-status.is-visible {
    visibility: visible;
}

.enduser-notes-status.is-error {
    color: #b02a37;
}

.enduser-notes-status .enduser-notes-retry {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font-size: inherit;
    text-decoration: underline;
    cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
    .enduser-notes-status .fa-spinner {
        animation: enduser-notes-spin 1s linear infinite;
    }
}

@keyframes enduser-notes-spin {
    to { transform: rotate(360deg); }
}
