/**
 * Role-based profile accents (instructor vs student).
 * Option A: soft tint fill + primary-color border (instructor: 2px, student: 1px).
 * Shape: both circular; weight differs for grayscale / non-color cues.
 *
 * Example (standalone initials chip):
 *   <span class="ll-role-avatar ll-role-avatar--md ll-role-avatar--instructor" aria-hidden="true">
 *     <span class="ll-role-avatar__initials">AB</span>
 *   </span>
 *
 * Example (titlebar / hub host — classes on existing button):
 *   <button class="titlebar-avatar-button ll-role-accent--instructor" type="button">...</button>
 */

:root {
    --ll-role-instructor-primary: #2d7a3b;
    --ll-role-instructor-tint: #e6f2ea;
    --ll-role-instructor-ink: #1a4d25;

    --ll-role-student-primary: #d6b25e;
    --ll-role-student-primary-strong: #c49a2c;
    --ll-role-student-tint: #f8f1dc;
    --ll-role-student-ink: #6b5420;
}

.ll-role-avatar {
    --ll-role-avatar-size: 36px;
    --ll-role-border-w: 1px;
    --ll-role-weight: 600;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    width: var(--ll-role-avatar-size);
    height: var(--ll-role-avatar-size);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border: var(--ll-role-border-w) solid transparent;
    background: var(--ll-role-student-tint);
    line-height: 0;
}

.ll-role-avatar--sm {
    --ll-role-avatar-size: 28px;
    font-size: 0.68rem;
}

.ll-role-avatar--md {
    --ll-role-avatar-size: 36px;
    font-size: 0.82rem;
}

.ll-role-avatar--lg {
    --ll-role-avatar-size: 44px;
    font-size: 0.95rem;
}

.ll-role-avatar--instructor {
    --ll-role-border-w: 2px;
    --ll-role-weight: 700;
    background: var(--ll-role-instructor-tint);
    border-color: var(--ll-role-instructor-primary);
}

.ll-role-avatar--student {
    --ll-role-border-w: 1px;
    --ll-role-weight: 600;
    background: var(--ll-role-student-tint);
    border-color: var(--ll-role-student-primary-strong);
}

.ll-role-avatar__initials {
    font-weight: var(--ll-role-weight);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ll-role-student-ink);
    line-height: 1;
}

.ll-role-avatar__photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 2;
    background: transparent;
}

.ll-role-avatar--instructor .ll-role-avatar__initials {
    color: var(--ll-role-instructor-ink);
}

.ll-role-avatar--student .ll-role-avatar__initials {
    color: var(--ll-role-student-ink);
}

@media (prefers-contrast: more) {
    .ll-role-avatar--student {
        border-width: 2px;
    }

    .titlebar-avatar-button.ll-role-accent--student,
    .hub-avatar-button.ll-role-accent--student {
        border-width: 2px;
    }
}

@media (forced-colors: active) {
    .ll-role-avatar--instructor,
    .ll-role-avatar--student {
        border-color: CanvasText;
        forced-color-adjust: none;
    }

    .ll-role-avatar__initials {
        color: CanvasText;
    }
}

/* —— Titlebar host (main app) —— */

.titlebar-avatar-button.ll-role-accent--instructor,
.titlebar-avatar-button.ll-role-accent--student {
    background: var(--ll-role-instructor-tint);
    border-style: solid;
}

.titlebar-avatar-button.ll-role-accent--instructor {
    border-width: 2px;
    border-color: var(--ll-role-instructor-primary);
}

.titlebar-avatar-button.ll-role-accent--student {
    border-width: 1px;
    border-color: var(--ll-role-student-primary-strong);
    background: var(--ll-role-student-tint);
}

.titlebar-avatar-button.ll-role-accent--instructor .titlebar-avatar-button__fallback,
.titlebar-avatar-button.ll-role-accent--student .titlebar-avatar-button__fallback {
    background: transparent;
    color: var(--ll-role-instructor-ink);
}

.titlebar-avatar-button.ll-role-accent--student .titlebar-avatar-button__fallback {
    color: var(--ll-role-student-ink);
}

.titlebar-avatar-button.ll-role-accent--instructor .titlebar-avatar-button__fallback--initials,
.titlebar-avatar-button.ll-role-accent--student .titlebar-avatar-button__fallback--initials {
    background: transparent;
    color: inherit;
    font-weight: 700;
    text-shadow: none;
}

.titlebar-avatar-button.ll-role-accent--student .titlebar-avatar-button__fallback--initials {
    font-weight: 600;
}

.titlebar-avatar-button.ll-role-accent--instructor .titlebar-avatar-button__image,
.titlebar-avatar-button.ll-role-accent--student .titlebar-avatar-button__image {
    background: transparent;
}

/* —— Hub titlebar host —— */

.hub-avatar-button.ll-role-accent--instructor,
.hub-avatar-button.ll-role-accent--student {
    background: var(--ll-role-instructor-tint);
    border-style: solid;
}

.hub-avatar-button.ll-role-accent--instructor {
    border-width: 2px;
    border-color: var(--ll-role-instructor-primary);
}

.hub-avatar-button.ll-role-accent--student {
    border-width: 1px;
    border-color: var(--ll-role-student-primary-strong);
    background: var(--ll-role-student-tint);
}

.hub-avatar-button.ll-role-accent--instructor .hub-avatar-button__fallback,
.hub-avatar-button.ll-role-accent--student .hub-avatar-button__fallback {
    background: transparent;
    color: var(--ll-role-instructor-ink);
}

.hub-avatar-button.ll-role-accent--student .hub-avatar-button__fallback {
    color: var(--ll-role-student-ink);
}

.hub-avatar-button.ll-role-accent--instructor .hub-avatar-button__fallback--initials,
.hub-avatar-button.ll-role-accent--student .hub-avatar-button__fallback--initials {
    font-weight: 700;
}

.hub-avatar-button.ll-role-accent--student .hub-avatar-button__fallback--initials {
    font-weight: 600;
}

.hub-avatar-button.ll-role-accent--instructor .hub-avatar-button__image,
.hub-avatar-button.ll-role-accent--student .hub-avatar-button__image {
    background: transparent;
}

/* —— Directory / list rows —— */

.contact-row-avatar {
    align-self: flex-start;
    margin-top: 2px;
}

.contact-row-avatar .ll-role-avatar {
    --ll-role-avatar-size: 48px;
    border-width: 2px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.46);
}

.contact-row-avatar .ll-role-avatar__initials {
    font-size: 1rem;
}

.contact-row.contact-row--with-avatar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.contact-row.contact-row--with-avatar .contact-row-copy {
    min-width: 0;
}

.contact-row.contact-row--with-avatar.contact-row--directory-stack {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
}

.contact-row--directory-stack .contact-row-main {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.contact-row--directory-stack .contact-row-actions {
    align-self: flex-end;
    margin-top: 2px;
}

.contact-row--directory-stack .contact-row-name {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
}

.contact-row.contact-row--with-avatar.contact-row--directory-stack.contact-row--compact {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    min-height: 48px;
}

.contact-row--compact .contact-row-avatar {
    align-self: center;
    margin-top: 0;
    transform: none;
}

.contact-row--compact .contact-row-avatar .ll-role-avatar {
    --ll-role-avatar-size: 36px;
    box-shadow: none;
}

.contact-row--compact .contact-row-avatar .ll-role-avatar__initials {
    font-size: 0.76rem;
}

.contact-row--directory-stack.contact-row--compact .contact-row-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.contact-row--directory-stack.contact-row--compact .contact-row-name {
    grid-column: 1;
    min-width: 0;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    font-size: 0.94rem;
    line-height: 1.12;
}

.contact-row--directory-stack.contact-row--compact .contact-row-actions {
    grid-column: 2;
    justify-self: end;
    align-self: center;
    margin-top: 0;
}

@media (max-width: 380px) {
    .contact-row--directory-stack.contact-row--compact .contact-row-main {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
    }

    .contact-row--directory-stack.contact-row--compact .contact-row-name {
        font-size: 0.9rem;
    }
}

/* —— Today chat —— */

.today-chat-conversation.today-chat-conversation--with-avatar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    text-align: left;
}

.today-chat-conversation-avatar {
    align-self: center;
}

.today-chat-conversation-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.today-chat-message-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
}

.today-chat-message-avatar {
    margin-top: 2px;
}

.today-chat-message.is-current-user .today-chat-message-row {
    direction: rtl;
}

.today-chat-message.is-current-user .today-chat-message-row > * {
    direction: ltr;
}

/* Modern Golf Tech role accents */
:root {
    --ll-role-instructor-primary: var(--primary, #2D7A3B);
    --ll-role-instructor-tint: rgba(63, 168, 90, 0.16);
    --ll-role-instructor-ink: var(--text-primary, #e6edf3);

    --ll-role-student-primary: var(--accent, #f4c542);
    --ll-role-student-primary-strong: var(--accent, #f4c542);
    --ll-role-student-tint: rgba(244, 197, 66, 0.14);
    --ll-role-student-ink: var(--text-primary, #e6edf3);
}

.ll-role-avatar,
.ll-role-avatar--instructor,
.ll-role-avatar--student,
.titlebar-avatar-button.ll-role-accent--instructor,
.titlebar-avatar-button.ll-role-accent--student,
.hub-avatar-button.ll-role-accent--instructor,
.hub-avatar-button.ll-role-accent--student {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
