/* =====================================================================
   comments-composer.css — RecordComments (paged thread + fixed footer) and
   the compact AddComment composer (IsEmbedded). Kept in its own file so
   edits to site.css cannot drop it (it was lost from site.css once).
   Linked in Pages/_Host.cshtml after site.css; dark tweaks stay in
   darkOverrid.css (html .ecm-root .ecm-cmp-*, html .ecm-vis-opt).
   ===================================================================== */
/* =====================================================================
   RecordComments — the thread between a top bar and a fixed footer
   (ecm-dock): only the list scrolls (ecm-scroll, 10 comments + 10 more
   on scroll). Dialog hosts cap the height; the home-feed side panel
   (PostMessageView) stretches it to the panel height.
   ===================================================================== */
.ecm-thread.has-dock {
    min-height: 0;
    gap: 10px;
    padding: 0;
}

.ecm-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 2px 2px 8px;
}

.ecm-dock {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 10px 0 2px;
    border-top: 1px solid var(--ecm-divider);
    background: var(--ecm-dock-bg, var(--ecm-canvas));
}

/* opened as a dialog (MessageView 650px, MessageListGrid): the thread gets a height so the footer stays put */
.rz-dialog-content > .ecm-thread.has-dock {
    max-height: min(76vh, 820px);
}

@media (max-width: 768px) {
    .rz-dialog-content > .ecm-thread.has-dock {
        max-height: calc(100dvh - 96px);
    }
}

/* =====================================================================
   AddComment (IsEmbedded) — the compact footer composer: avatar + a
   rounded text box without a toolbar; inside its bottom row "Send" and
   the who-can-see-it (menu in a PublicToolTip) and attach icons.
   ===================================================================== */
.ecm-cmp {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ecm-cmp-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

/* صورة الكاتب بحجم ثابت متناسب مع سطر الكتابة (قواعد img العامة لا تغيّرها) | the writer's avatar at a fixed size matching the text line (global img rules cannot change it) */
.ecm-root img.ecm-cmp-av {
    display: block;
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 36px;
    max-height: 36px;
    aspect-ratio: 1 / 1;
    margin: 0 0 4px;
    padding: 0;
    border: 1px solid var(--ecm-line);
    border-radius: 50%;
    object-fit: cover;
}

.ecm-cmp-box {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 8px 12px 6px;
    border: 1px solid var(--ecm-line);
    border-radius: 18px;
    background: var(--ecm-card);
    transition: border-color .15s ease, box-shadow .15s ease;
}

    .ecm-cmp-box:focus-within {
        border-color: var(--ecm-primary);
        box-shadow: 0 0 0 3px color-mix(in srgb, var(--ecm-primary) 14%, transparent);
    }

    .ecm-cmp-box.has-error {
        border-color: var(--ecm-danger);
    }

.ecm-cmp-input {
    display: block;
    width: 100%;
    min-height: 24px;
    max-height: 140px;
    padding: 0;
    border: 0;
    outline: 0;
    resize: none;
    overflow-y: auto;
    field-sizing: content;
    background: transparent;
    color: var(--ecm-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.5;
}

    .ecm-cmp-input::placeholder {
        color: var(--ecm-muted);
    }

.ecm-cmp-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
}

.ecm-cmp-gap {
    flex: 1 1 auto;
}

.ecm-cmp-host {
    display: inline-flex;
}

.ecm-cmp-ic {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ecm-muted);
    cursor: pointer;
}

    .ecm-cmp-ic .rzi {
        font-size: 20px;
    }

    .ecm-cmp-ic.is-public { color: var(--ecm-public); }
    .ecm-cmp-ic.is-private { color: var(--ecm-private); }
    .ecm-cmp-ic.is-custom { color: var(--ecm-custom); }

    .ecm-cmp-ic:hover,
    .ecm-cmp-ic:focus-visible {
        background: var(--ecm-chip);
        outline: none;
    }

    .ecm-cmp-ic:disabled {
        opacity: .5;
        cursor: default;
    }

.ecm-cmp-n {
    position: absolute;
    top: 1px;
    inset-inline-end: 1px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 8px;
    background: var(--ecm-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
}

.ecm-cmp-send {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 14px;
    border: 0;
    border-radius: 16px;
    background: var(--ecm-primary);
    color: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

    .ecm-cmp-send .rzi {
        font-size: 18px;
    }

    /* the send arrow points to the reading direction */
    [dir="rtl"] .ecm-cmp-send .rzi {
        transform: scaleX(-1);
    }

    .ecm-cmp-send:not(:disabled):hover {
        filter: brightness(1.08);
    }

    .ecm-cmp-send:disabled {
        background: var(--ecm-chip);
        color: var(--ecm-muted);
        cursor: default;
    }

.ecm-cmp-spin {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, .45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ecm-spin .8s linear infinite;
}

@keyframes ecm-spin {
    to { transform: rotate(360deg); }
}

/* added attachments and the picked people, above the box */
.ecm-cmp-atts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding-inline-start: 40px;
}

.ecm-cmp-att {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding-block: 3px;
    padding-inline: 8px 3px;
    border: 1px solid var(--ecm-line);
    border-radius: 10px;
    background: var(--ecm-card);
    font-size: 12.5px;
}

.ecm-cmp-att-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecm-cmp-att-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--ecm-muted);
    cursor: pointer;
}

    .ecm-cmp-att-x .rzi {
        font-size: 15px;
    }

    .ecm-cmp-att-x:hover,
    .ecm-cmp-att-x:focus-visible {
        background: var(--ecm-chip);
        color: var(--ecm-danger);
        outline: none;
    }

.ecm-cmp-to {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: calc(100% - 40px);
    height: 28px;
    margin-inline-start: 40px;
    padding: 0 10px;
    border: 1px solid color-mix(in srgb, var(--ecm-custom) 35%, transparent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--ecm-custom) 10%, transparent);
    color: var(--ecm-custom);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

    .ecm-cmp-to .rzi {
        font-size: 16px;
    }

    .ecm-cmp-to .ecm-cmp-to-edit {
        font-size: 14px;
        opacity: .7;
    }

.ecm-cmp-to-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ecm-cmp > .ecm-error {
    padding-inline-start: 40px;
}

/* the who-can-see-it menu (PublicToolTip, rendered in body — outside .ecm-root, so --home-* tokens) */
.e-tooltip-wrap.public-tooltip.ecm-vis-tip .e-tip-content {
    padding: 6px;
}

.ecm-vis-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 190px;
}

.ecm-vis-opt {
    --c: #0d9488;
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--home-text, #1C1E21);
    font: inherit;
    font-size: 13.5px;
    text-align: start;
    cursor: pointer;
}

    .ecm-vis-opt.is-private { --c: #B45309; }
    .ecm-vis-opt.is-custom { --c: #7c3aed; }

    .ecm-vis-opt > .rzi:first-child {
        font-size: 19px;
        color: var(--c);
    }

    .ecm-vis-opt:hover,
    .ecm-vis-opt:focus-visible {
        background: var(--home-hover, #F0F2F5);
        outline: none;
    }

    .ecm-vis-opt.is-on {
        font-weight: 700;
        background: var(--home-selected, #E5EFFF);
    }

.ecm-vis-opt-text {
    flex: 1 1 auto;
}

.ecm-vis-opt .ecm-vis-opt-check {
    font-size: 18px;
    color: var(--home-accent, #0064D1);
}

/* the people picker dialog of the footer */
.ecm-people {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

    .ecm-people .ecm-foot {
        padding-top: 12px;
        border-top: 1px solid var(--ecm-divider);
    }
