/* ==========================================================================
   Coject — member modals (shared) · Opus 5.5 · no Kendo, no tables
   Loaded by _LayoutOpus after layout-opus.css, so every page has it.
   Used by:  _InviteMemberModal.cshtml  (cjInvite — Project page, Members page …)
             Member.cshtml #mbEditModal  (edit role + boards)
   Moved here from member-opus.css (avatars, role dots, role cards, switch,
   boards) + new: email chips, footer link. Only --cj-* tokens → body.dark works.
   Logical properties → <html dir="rtl"> works.
   ========================================================================== */

.mb-ell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- avatars (photo with initials behind it) ---------- */
.mb-av {
    position: relative;
    margin: 0;
    line-height: 1;
    font-family: inherit;
    flex: none;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    overflow: hidden;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .02em;
}

    .mb-av.sm {
        width: 40px;
        height: 40px;
        font-size: 13px;
    }

    .mb-av.lg {
        width: 48px;
        height: 48px;
        font-size: 15px;
    }

    .mb-av img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .mb-av .cj-ic {
        width: 18px;
        height: 18px;
    }

    .mb-av.mb-h0 {
        background: #00015D;
        color: #00FFC3;
    }

    .mb-av.mb-h1 {
        background: #09C895;
        color: #0B0D2E;
    }

    .mb-av.mb-h2 {
        background: #FFF1D2;
        color: #8A5800;
    }

    .mb-av.mb-h3 {
        background: #E2F5EF;
        color: #007561;
    }

    .mb-av.mb-h4 {
        background: #E3E7F0;
        color: #00015D;
    }

    .mb-av.mail {
        background: var(--cj-warn-bg);
        color: var(--cj-warn-t);
    }

    .mb-av.gone {
        background: var(--cj-s3);
        color: var(--cj-t3);
    }

    .mb-av.add {
        background: var(--cj-hover);
        color: var(--cj-accent);
    }

body.dark .mb-av.mb-h0 {
    box-shadow: inset 0 0 0 1px rgba(0,255,195,.35);
}

body.dark .mb-av.mb-h2 {
    background: rgba(255,201,77,.13);
    color: #FFC94D;
}

body.dark .mb-av.mb-h3 {
    background: rgba(0,255,195,.12);
    color: #00FFC3;
}

body.dark .mb-av.mb-h4 {
    background: #2B2F58;
    color: #FFFFFF;
}

/* role dot */
.mb-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    flex: none;
    margin: 0;
    border-radius: 50%;
    vertical-align: middle;
    align-self: center;
}

    .mb-dot.mb-h0 {
        background: #00015D;
    }

body.dark .mb-dot.mb-h0 {
    background: #00FFC3;
}

.mb-dot.mb-h1 {
    background: #09C895;
}

.mb-dot.mb-h2 {
    background: #E8A33D;
}

.mb-dot.mb-h3 {
    background: #6F8DB9;
}

.mb-dot.mb-h4 {
    background: #C70D3A;
}

body.dark .mb-dot.mb-h4 {
    background: #FF6B6B;
}

/* ---------- modal frame (the rest comes from layout-opus .cj-modal) ---------- */
.mb-modal .modal-dialog {
    max-width: 640px;
}

.mb-modal .modal-header {
    align-items: flex-start !important;
}

    .mb-modal .modal-header h2 {
        margin: 0;
        font-size: 22px;
        font-weight: 700;
        color: var(--cj-title);
    }

    .mb-modal .modal-header p {
        margin-top: 3px;
        font-size: 13.5px;
        color: var(--cj-t3);
    }

    .mb-modal .modal-header > div:not(.mb-av) {
        flex: 1;
        min-width: 0;
    }

.mb-modal .modal-body {
    display: flex !important;
    flex-direction: column;
    gap: 20px;
}

.mb-modal .mb-foot-link {
    margin-inline-end: auto !important;
}

    .mb-modal .mb-foot-link[hidden] {
        display: none;
    }

.mb-lbl {
    display: block;
    margin: 0 0 8px;
    padding: 0;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--cj-t2);
}

.mb-field {
    height: 44px;
}

    .mb-field.err {
        border-color: var(--cj-danger-b);
    }

.mb-hint {
    margin-top: 6px !important;
    font-size: 12px;
    color: var(--cj-t3);
}

    .mb-hint.err {
        font-weight: 700;
        color: var(--cj-danger);
    }

.mb-resend {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--cj-warn-bg);
    color: var(--cj-warn-t);
}

    .mb-resend[hidden] {
        display: none;
    }

    .mb-resend b {
        display: block;
    }

    .mb-resend small {
        font-size: 12.5px;
    }

/* ---------- email chips (invite one or many) ---------- */
.mb-emails {
    height: auto;
    min-height: 44px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding-block: 6px;
    cursor: text;
}

    .mb-emails > .cj-ic {
        flex: none;
    }

    .mb-emails input {
        flex: 1 1 160px;
        min-width: 120px;
        height: 30px;
        border: 0 !important;
        outline: 0;
        background: none !important;
        box-shadow: none !important;
    }

.mb-echip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    min-width: 0;
    height: 28px;
    padding-inline: 10px 3px;
    border-radius: 99px;
    background: var(--cj-s3);
    color: var(--cj-t1);
    font-size: 13px;
    font-weight: 600;
    cursor: default;
}

    .mb-echip bdi {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mb-echip small {
        flex: none;
        padding: 1px 7px;
        border-radius: 99px;
        background: rgba(255,255,255,.55);
        font-size: 10.5px;
        font-weight: 800;
        letter-spacing: .02em;
    }

    .mb-echip button {
        flex: none;
        width: 22px;
        height: 22px;
        display: grid;
        place-items: center;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: transparent;
        color: inherit;
        cursor: pointer;
    }

        .mb-echip button:hover {
            background: rgba(11,13,46,.08);
        }

        .mb-echip button:focus-visible {
            outline: 2px solid var(--cj-teal);
            outline-offset: 1px;
        }

        .mb-echip button .cj-ic {
            width: 13px;
            height: 13px;
        }

    .mb-echip.bad, .mb-echip.fail {
        background: rgba(232,15,67,.10);
        color: var(--cj-danger);
    }

    .mb-echip.member, .mb-echip.invited {
        background: var(--cj-warn-bg);
        color: var(--cj-warn-t);
    }

        .mb-echip.member bdi, .mb-echip.invited bdi {
            text-decoration: line-through;
            text-decoration-thickness: 1px;
        }

body.dark .mb-echip small {
    background: rgba(0,0,0,.25);
}

body.dark .mb-echip button:hover {
    background: rgba(255,255,255,.10);
}

/* ---------- role cards (radio inputs) ---------- */
.mb-roles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.mb-rcard {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 11px 12px;
    border: 1.5px solid var(--cj-line-2);
    border-radius: 12px;
    background: var(--cj-input-bg);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

    .mb-rcard:hover {
        border-color: var(--cj-input);
    }

    .mb-rcard input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

    .mb-rcard .mb-radio {
        width: 16px;
        height: 16px;
        flex: none;
        margin-top: 2px;
        border-radius: 50%;
        border: 1.5px solid var(--cj-input);
    }

    .mb-rcard b {
        display: flex;
        align-items: center;
        gap: 7px;
        font-size: 13.5px;
        font-weight: 700;
        color: var(--cj-t1);
    }

    .mb-rcard small {
        display: block;
        margin-top: 2px;
        font-size: 12px;
        color: var(--cj-t3);
    }

    .mb-rcard:has(input:checked) {
        border-color: var(--cj-electric);
        background: var(--cj-hover);
    }

        .mb-rcard:has(input:checked) .mb-radio {
            border-color: var(--cj-check);
            box-shadow: inset 0 0 0 3px var(--cj-s2), inset 0 0 0 8px var(--cj-check);
        }

    .mb-rcard:has(input:focus-visible) {
        outline: 2px solid var(--cj-teal);
        outline-offset: 2px;
    }

body.dark .mb-rcard:has(input:checked) {
    border-color: var(--cj-neon-raw);
    background: rgba(0,255,195,.08);
}

    body.dark .mb-rcard:has(input:checked) .mb-radio {
        box-shadow: inset 0 0 0 3px var(--cj-s1), inset 0 0 0 8px var(--cj-check);
    }

/* ---------- access box: switch + boards ---------- */
.mb-access {
    border: 1px solid var(--cj-line-2);
    border-radius: 14px;
    overflow: hidden;
}

.mb-access-h {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

    .mb-access-h > div {
        flex: 1;
        min-width: 0;
    }

    .mb-access-h b {
        display: block;
        font-weight: 700;
        color: var(--cj-t1);
    }

    .mb-access-h small {
        font-size: 12.5px;
        color: var(--cj-t3);
    }

.mb-sw {
    position: relative;
    width: 44px;
    height: 26px;
    flex: none;
    margin: 0;
}

    .mb-sw input {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        opacity: 0;
        cursor: pointer;
        z-index: 1;
    }

    .mb-sw span {
        position: absolute;
        inset: 0;
        border-radius: 99px;
        border: 1.5px solid var(--cj-input);
        background: var(--cj-s3);
        transition: background .15s;
    }

        .mb-sw span::before {
            content: "";
            position: absolute;
            top: 50%;
            inset-inline-start: 3px;
            width: 17px;
            height: 17px;
            border-radius: 50%;
            background: var(--cj-t3);
            transform: translateY(-50%);
            transition: transform .15s, background .15s;
        }

    .mb-sw input:checked + span {
        background: var(--cj-teal);
        border-color: var(--cj-teal);
    }

        .mb-sw input:checked + span::before {
            background: #fff;
            transform: translate(17px, -50%);
        }

[dir="rtl"] .mb-sw input:checked + span::before {
    transform: translate(-17px, -50%);
}

.mb-sw input:focus-visible + span {
    outline: 2px solid var(--cj-teal);
    outline-offset: 2px;
}

.mb-sw input:disabled {
    cursor: wait;
}

.mb-boards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0 16px 16px;
    list-style: none;
}

    .mb-boards[hidden] {
        display: none;
    }

.mb-chk {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--cj-line);
    border-radius: 10px;
    color: var(--cj-t1);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
}

    .mb-chk:hover {
        background: var(--cj-s1);
    }

    .mb-chk:has(input:checked) {
        border-color: var(--cj-teal);
    }

    .mb-chk input {
        width: 18px;
        height: 18px;
        margin: 0;
        accent-color: #09C895;
        cursor: pointer;
    }

.mb-boards .mb-loading {
    grid-column: 1 / -1;
    height: 44px;
    border-radius: 10px;
}

.mb-boards .mb-hint {
    grid-column: 1 / -1;
}

/* ---------- long lists: roles and boards scroll on their own ----------
   the header, email chips, access switch and footer stay in place */
.mb-roles, .mb-boards {
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--cj-line-2) transparent;
}

.mb-roles {
    max-height: 196px;
    padding: 2px;
    margin: -2px;
}
/* ≈ 3 rows (the 4th peeks out, so it is clear the list scrolls); padding keeps the focus ring visible */
.mb-boards {
    max-height: 212px;
    align-content: start;
}
    /* ≈ 4 rows of boards */
    .mb-roles::-webkit-scrollbar, .mb-boards::-webkit-scrollbar {
        width: 6px;
    }

    .mb-roles::-webkit-scrollbar-thumb, .mb-boards::-webkit-scrollbar-thumb {
        border-radius: 6px;
        background: var(--cj-line-2);
    }

    .mb-roles::-webkit-scrollbar-track, .mb-boards::-webkit-scrollbar-track {
        background: transparent;
    }
/* the email box can also grow with many chips */
.mb-emails {
    max-height: 116px;
    overflow-y: auto;
}

/* ---------- responsive ---------- */
@media (max-width: 767px) {
    .mb-roles, .mb-boards {
        grid-template-columns: minmax(0, 1fr);
    }

    .mb-roles {
        max-height: 200px;
    }

    .mb-boards {
        max-height: 180px;
    }

    .mb-modal .modal-header h2 {
        font-size: 19px;
    }
}

@media (max-width: 480px) {
    .mb-modal .mb-foot-link span {
        display: none;
    }
    /* icon only, keeps the footer on one line */
}
