/* Header profile menu, avatar, dropdown */

.profile-menu {
    position: relative;
}

.profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px 0 4px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    line-height: 1;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
    max-width: 260px;
    height: 36px;
    box-sizing: border-box;
    flex-shrink: 0;
}

.profile-trigger .avatar {
    width: 26px;
    height: 26px;
    font-size: 10px;
}
.profile-trigger:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.profile-trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }

.profile-trigger[aria-expanded="true"] {
    border-color: var(--border-strong);
    background: var(--bg-subtle);
}

.profile-name-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    overflow: hidden;
}

.profile-name {
    font-size: 12px;
    line-height: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.profile-username {
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 10px;
    line-height: 12px;
    color: var(--text-subtle);
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.profile-caret {
    color: var(--text-muted);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.profile-trigger[aria-expanded="true"] .profile-caret {
    transform: rotate(180deg);
}

/* Avatar */

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.02em;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background-size: cover;
    background-position: center;
    vertical-align: middle;
}
.avatar-initials { line-height: 1; }
.avatar.has-image .avatar-initials { visibility: hidden; }

.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-xl { width: 96px; height: 96px; font-size: 32px; border-radius: 50%; }

/* Profile dropdown */

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    max-width: 320px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-dropdown);
    padding: 6px;
    z-index: 50;
    animation: dropdownIn 0.12s ease-out;
}
@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.profile-dropdown[hidden] { display: none; }

.profile-dropdown-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 10px 12px;
}
.profile-dropdown-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    gap: 2px;
}
.profile-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-dropdown-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 2px -6px;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.12s ease;
}
.profile-dropdown-item:hover,
.profile-dropdown-item:focus-visible {
    background: var(--bg-subtle);
    outline: none;
}
.profile-dropdown-item svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.profile-dropdown-item:hover svg { color: var(--text); }

.profile-dropdown-item.is-current {
    background: var(--bg-subtle);
    font-weight: 600;
}
.profile-dropdown-item.is-current svg { color: var(--text); }

.profile-dropdown-item-danger {
    color: var(--danger);
}
.profile-dropdown-item-danger svg { color: var(--danger); }
.profile-dropdown-item-danger:hover,
.profile-dropdown-item-danger:focus-visible {
    background: var(--danger-bg);
}
