/* css/representation.css
 *
 * Guilds and representatives: the Representation & Affiliations card on the
 * profile, the Reps tab of Edit Profile, and the guild badges on
 * Member Directory cards. See js/representation.js and
 * includes/representation.php.
 *
 * The guild field borrows the script dialog's tag field wholesale --
 * .sm-tag-field, .sm-tag-chip, .sm-tag-dropdown, .sm-tag-option in
 * css/dashboard.css -- as the Credits tab's job field does. Only its entry box
 * is restated below, because dashboard.css styles that one by id.
 */

/* ── THE CARD ON THE PROFILE ───────────────────────────────────────────── */

.profile-reps-card {
    margin-top: 20px;
    padding: 20px 24px;
}

.profile-reps-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.profile-reps-head .script-section-label {
    margin-bottom: 0;
}

.profile-reps-empty {
    margin: 0;
    font-size: 15px;
    color: var(--text-muted);
}

.profile-reps-section + .profile-reps-section {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.profile-reps-label {
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.profile-guilds {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.profile-guilds .script-tag-pill {
    margin-right: 0;
}

.profile-reps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px 24px;
}

.profile-rep-type {
    font-size: 13px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--color-text-body);
    margin-bottom: 5px;
}

.profile-rep-who {
    font-size: 16px;
    color: var(--text-dark);
    line-height: 1.35;
}

.profile-rep-name {
    font-weight: 600;
}

/* A rep who is a member: their face and name, as a link to their profile. */
.profile-rep-member {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: inherit;
    text-decoration: none;
    vertical-align: middle;
}

.profile-rep-member:hover .profile-rep-name {
    color: var(--primary);
    text-decoration: underline;
}

.profile-rep-avatar {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-dim, #eef1f0);
    color: var(--color-blue, #005e6a);
    font-size: 10px;
    font-weight: 700;
}

.profile-rep-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* A member rep who has not confirmed yet -- shown to the profile's owner. */
.profile-rep-waiting {
    margin-top: 2px;
    font-size: 13px;
    font-style: italic;
    color: #8a5a00;
}

.profile-rep-waiting i {
    margin-right: 4px;
}

/* A company the reader can follow into the Directory. */
.profile-rep-company-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dotted var(--text-muted);
}

.profile-rep-company-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.profile-rep-sep {
    margin: 0 6px;
    color: var(--text-muted);
}

.profile-rep-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 14px;
    margin-top: 2px;
    font-size: 14px;
}

.profile-rep-contact a {
    color: var(--text-soft);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.profile-rep-contact a:hover {
    color: var(--primary);
}

.profile-rep-contact i {
    margin-right: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── THE TAB: GUILDS ───────────────────────────────────────────────────── */

/* The entry box inside the guild field -- the part dashboard.css styles by id
   (#sm-tag-entry), restated for this field's. */
#rep-guild-chips {
    display: contents;
}

#rep-guild-entry {
    flex: 1 1 160px;
    min-width: 120px;
    border: 0;
    outline: none;
    padding: 0;
    font: inherit;
    background: transparent;
}

/* Taller than the tag list's 240px: this one has section titles in it. */
#rep-guild-dropdown {
    max-height: 300px;
}

.rep-guild-group {
    margin: 6px 6px 2px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: default;
}

.rep-guild-group:first-child {
    margin-top: 2px;
}

.rep-guild-option {
    align-items: baseline;
}

.rep-guild-abbr {
    flex: none;
    font-weight: 600;
    color: var(--text-dark);
}

.rep-guild-name {
    min-width: 0;
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rep-guild-none {
    cursor: default;
    color: var(--text-muted);
}

/* ── THE TAB: REPRESENTATIVES ──────────────────────────────────────────── */

.rep-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
}

.rep-head .form-label {
    margin-bottom: 0;
}

.rep-head-gap {
    flex: 1 1 auto;
}

.rep-privacy {
    display: block;
    margin: 4px 0 10px;
}

.rep-empty {
    margin: 0;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    font-size: 15px;
    color: var(--text-muted);
}

.rep-row {
    position: relative;
    padding: 14px 44px 4px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-white);
}

.rep-row + .rep-row {
    margin-top: 10px;
}

.rep-row-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 12px;
}

.rep-row-grid .form-group {
    margin-bottom: 10px;
}

/* Type and What kind? share the first line; Name always starts the second,
   whether or not What kind? is showing, so the pairs below stay paired. */
.rep-other-wrap[hidden] {
    display: none;
}

.rep-name-group {
    grid-column: 1;
    position: relative;
}

/* The member finder's results float over the fields below rather than
   pushing them down, the way the guild list does. The rest of its look is
   the invite dialog's .inv-member-* in css/global.css. */
.rep-name-group .rep-member-list {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 60;
    box-shadow: var(--shadow-lg);
}

/* The chosen member, the same height as the box it replaces. */
.rep-name-group .rep-member-picked {
    min-height: 40px;
    padding: 4px 10px;
}

.rep-member-tag {
    flex: none;
    padding: 1px 7px;
    border-radius: 10px;
    background: var(--primary-dim, #eef1f0);
    color: var(--color-blue, #005e6a);
    font-size: 11.5px;
    font-weight: 600;
}

.rep-name-group .rep-name[hidden] {
    display: none;
}

.rep-contact-group[hidden],
.rep-status-note[hidden] {
    display: none;
}

/* A member rep who has not confirmed: amber, like the waiting line. */
.rep-member-tag--wait {
    background: #fdecc8;
    color: #8a5a00;
}

.rep-status-note {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ── THE TAB: CLIENTS WHO LIST YOU ─────────────────────────────────────── */

.rep-clients[hidden] {
    display: none;
}

.rep-clients-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.rep-client {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
}

.rep-client:first-child {
    border-top: 0;
}

.rep-client.is-pending {
    background: #fffaf0;
}

.rep-client-face {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--primary-dim, #eef1f0);
    color: var(--color-blue, #005e6a);
    font-size: 12px;
    font-weight: 700;
}

.rep-client-face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rep-client-who {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.rep-client-type {
    font-size: 13px;
    color: var(--text-muted);
}

.rep-client-acts {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rep-client-end:hover {
    color: #e85347;
}

/* The company box: the tag field's dropdown (.sm-tag-dropdown, absolute
   against this group) and the member picker's chosen-state box. */
.rep-company-group {
    position: relative;
}

.rep-company-group .rep-company[hidden],
.rep-company-group .rep-company-picked[hidden] {
    display: none;
}

.rep-company-group .rep-company-picked {
    min-height: 40px;
    padding: 4px 10px;
}

.rep-company-icon {
    flex: none;
    width: 24px;
    text-align: center;
    color: var(--text-muted);
}

.rep-company-name {
    flex: 1 1 auto;
    min-width: 0;
}

.rep-company-alias {
    color: var(--text-muted);
    font-size: 13px;
}

.rep-row-delete {
    position: absolute;
    top: 10px;
    right: 8px;
}

.rep-row-delete:hover {
    color: #e85347;
}

/* ── A CLIENT'S SCREENPLAY, IN THE LIBRARY ─────────────────────────────── */

/* The CLIENT chip and wash on a card whose author the viewer represents --
   the SHARED pair in css/dashboard.css, in a lavender of their own so the two
   can never be confused: shared is "lent to you", client is "you represent
   whoever wrote it". Hover stays the ordinary gold, for the reason the shared
   rules give. */
:root {
    --client-tint: #f1edfb;
}

.dash-chip--client {
    background: #e4dcf7;
    color: #5b3fa8;
}

.dash-chip--client i {
    margin-right: 2px;
    font-size: 11px;
}

/* The client's name on the chip: in their own case rather than the chip's
   capitals, so "CLIENT: Jane Doe" reads as a label and a name. Cut short
   rather than wrapping a long name across the card. */
.dash-chip-client-name {
    text-transform: none;
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.dash-card.is-client,
tr.is-client {
    background: var(--client-tint);
}

/* The handshake beside "My Clients' Scripts" in the Screenplays filter menu,
   as .script-shared-icon is beside Shared with Me. */
.script-client-icon {
    margin-right: 4px;
    color: #5b3fa8;
    font-size: 13px;
}

.link-list li[hidden] {
    display: none;
}

/* "Your client ..." under the title in the Screenplays table -- the shared
   byline (.shared-by in css/dashboard.css) in the client colour. */
.client-by > i {
    color: #5b3fa8;
}

@media (hover: hover) {
    .dash-card.is-client:hover {
        background: var(--gold-tint);
    }
}

/* ── A SCREENPLAY THE MEMBER IS ATTACHED TO ────────────────────────────── */

/* Its own wash and chip (Ben, 2026-10-05). It used to wear the SHARED green,
   so a script somebody was attached to AND invited to looked like any invited
   one. A soft blue, clear of shared's green, the client's lavender and the
   gold of hover -- and scriptListWash() puts it ahead of both of the others.
   Hover stays gold, as for the other two. */
:root {
    --attached-tint: #e6f0fa;
}

.dash-card.is-attached,
tr.is-attached {
    background: var(--attached-tint);
}

.dash-chip--attached {
    background: #d2e3f5;
    color: #1d5a92;
}

.dash-chip--attached i {
    margin-right: 2px;
    font-size: 11px;
}

@media (hover: hover) {
    .dash-card.is-attached:hover {
        background: var(--gold-tint);
    }
}

/* ── THE AUTHOR'S REPS, ON A SCRIPT'S INVITATIONS ──────────────────────── */

.inv-reps {
    margin: 0 0 12px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--client-tint);
}

.inv-reps-head {
    font-weight: 600;
    color: #5b3fa8;
}

.inv-reps-note {
    font-weight: 400;
    font-size: 14px;
    color: var(--text-muted);
}

.inv-reps ul {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
}

.inv-rep {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 4px 0;
}

.inv-rep .iconDiv {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    background: #e4dcf7;
    color: #5b3fa8;
    font-size: 11px;
    font-weight: 700;
}

.inv-rep .iconDiv img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.inv-rep-name {
    font-weight: 600;
    color: var(--text-dark);
}

.inv-rep-type {
    color: var(--text-soft);
}

.inv-rep-access {
    padding: 1px 8px;
    border-radius: 10px;
    background: #e4dcf7;
    color: #5b3fa8;
    font-size: 13px;
    font-weight: 600;
}

.inv-rep-pending {
    font-size: 13px;
    font-style: italic;
    color: #8a5a00;
}

/* ── ATTACHED TO A SCRIPT ──────────────────────────────────────────────────
 *
 * The Attached step of Edit Script wears the Reps tab's rows (.rep-row etc.,
 * above); the summary page widget and the Library popup are below. See
 * includes/scriptattached.php and js/attached.js. */

/* The note runs the width of the row, under the role and the name. */
.att-row .att-note-group {
    grid-column: 1 / -1;
}

.att-row .att-name-group {
    grid-column: auto;
}

#att-empty[hidden] {
    display: none;
}

.attached-card {
    padding: 16px 20px;
}

.att-roles {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px 24px;
}

.att-person {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin-top: 2px;
    font-size: 16px;
    color: var(--text-dark);
}

.att-name {
    font-weight: 600;
}

.att-note {
    font-size: 14px;
    color: var(--text-muted);
}

.att-leave {
    margin-left: 2px;
    font-size: 13px;
}

.att-leave:hover {
    color: #e85347;
}

.att-reps.has-people {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

/* ── THE PROFILE'S RELATIONSHIP CARDS ──────────────────────────────────────
 *
 * Attached To, Clients and the reader's own Messages, under the profile card.
 * All three wear the Representation card's frame (.profile-reps-card, above).
 * See renderAttachedToCard(), renderClientsCard() and
 * renderProfileMessagesCard(). */

/* The link in a card's heading: the Library filtered, or every message. */
.profile-card-more {
    font-size: 14px;
    color: var(--text-soft);
    text-decoration: none;
    white-space: nowrap;
}

.profile-card-more i {
    margin-right: 4px;
    color: var(--text-muted);
}

.profile-card-more:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* Attached To: poster, title, role, author. */
.profile-attached-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px 24px;
}

.profile-attached {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.profile-attached-poster {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 62px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--cream, #f7f5f0);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 20px;
}

.profile-attached-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-attached-body {
    min-width: 0;
}

.profile-attached-title {
    display: block;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-attached-title:hover {
    color: var(--primary);
    text-decoration: underline;
}

.profile-attached-roles {
    margin-top: 2px;
    font-size: 14px;
    color: var(--text-soft);
}

.profile-attached-role {
    font-weight: 600;
}

.profile-attached-by {
    margin-top: 1px;
    font-size: 13px;
    color: var(--text-muted);
}

/* Screenplays: the Script Library's own cards, in the card frame. */
.profile-scripts-count {
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--bg-muted, #f0f1f4);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
}

.profile-scripts-card .mk-scope-note {
    margin-left: 6px;
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-muted);
}

/* Clients: what the rep does for them, under the name. */
.profile-client-as {
    margin-top: 2px;
    padding-left: 31px;
    font-size: 13px;
    color: var(--text-muted);
}

/* The reader's own messages: the Messages page's rows (.mi-row in
   css/messages.css) run to the card's edges, so the unread bar sits where it
   does on that page. */
.profile-msgs-card {
    padding-bottom: 0;
    overflow: hidden;
}

.profile-msgs-list {
    margin: 0 -24px;
    border-top: 1px solid var(--border);
}

.profile-msgs-list .mi-row {
    padding-left: 20px;
    padding-right: 24px;
}

/* The subject leads here, where the list leads with the name -- every row is
   with the same person. It gives way to the date rather than pushing it off. */
.profile-msgs-list .mi-top .mi-subject {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0;
}

/* Two lines of the last message rather than the list's one. */
.profile-msgs-list .mi-preview {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ── THE DIRECTORY'S GUILD BADGES ──────────────────────────────────────── */

.md-guilds {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.md-guild {
    padding: 1px 7px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--cream);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
    transition: color .15s, border-color .15s;
}

.md-guild:hover {
    color: var(--primary);
    border-color: var(--primary);
}

@media (max-width: 600px) {
    .profile-reps-card {
        padding: 16px;
    }

    .profile-msgs-card {
        padding-bottom: 0;
    }

    .profile-msgs-list {
        margin: 0 -16px;
    }

    .profile-msgs-list .mi-row {
        padding-left: 12px;
        padding-right: 16px;
    }

    .rep-row-grid {
        grid-template-columns: 1fr;
    }

    .rep-head {
        flex-wrap: wrap;
    }
}
